I know there is a way to generate a transformation matrix from three pairs of points taken before and after the transformation, but I can not find any documentation on how to determind the transformation matrix. Here is my problem:

Given the three pairs of points (x1,y1,z1) --> (x'1,y'1,z'1) etc., how do I find the transformation matrix M?

Spara

```
```

|--- ---| |--- ---| |--- ---|

|x'1 x'2 x'3| | | | x1 x2 x3 |

| | | | | |

|y'1 y'2 y'3| = | Matrix M | x | y1 y2 y3 |

| | | | | |

|z'1 z'2 z'3| | | | z1 z2 z3 |

|--- ---| |--- ---| |--- ---|

Given the three pairs of points (x1,y1,z1) --> (x'1,y'1,z'1) etc., how do I find the transformation matrix M?

Spara

Work out the inverse the the rightmost matrix and multiply it on the righthand side of the left most one.

Thanks. I figured it was something simple like that. Now, to continue my question... if I have more than three sets of points, how can I use them all in the same way to make the transformation more accurate?

Spara

Spara

The transformation should be perfectly accurate with just the one set. Unless there are inaccurcies in the points data. Have anymore info?

Yeah, I'm anticipating innacuracies. I'm doing transforms on images so I'm stuck with integer point data. I may also allow the user to select their own points instead of doing it automaticaly so that'll introduce more innacuracies.

Spara

Spara

Well since you'll probably be dealing with small inaccurcies then working out a couple of matrices and just averaging the components indivually will probably be good enough.

If you know there will be some constraints on the atrix then renforce these on the averaged matrix. Eg if you know the transformation can only consist of translations and rotations then you could renormalise the rotation bits of the matrix. Thats just an example though which may not apply to your needs.

If you know there will be some constraints on the atrix then renforce these on the averaged matrix. Eg if you know the transformation can only consist of translations and rotations then you could renormalise the rotation bits of the matrix. Thats just an example though which may not apply to your needs.

Ok I've run into another problem. Once I actualy implemented the code to do this I realized that (since I'm working with 2D coordinates in a 3x3 matrix) the right column of my matrix is always zero. This presents a problem when trying to find the inverse as there is no determinant.

Should I fill the right column of both of my matrices with a constant (1 for example) or should I fill it with (0, 0, 1) as if it were an identity matrix?

The goal of my program is to stitch pictures together in a mosaic so they're one image. I'm working on the image matching portion and using the transformation matrix to combine the images. Thanks.

Spara

Should I fill the right column of both of my matrices with a constant (1 for example) or should I fill it with (0, 0, 1) as if it were an identity matrix?

The goal of my program is to stitch pictures together in a mosaic so they're one image. I'm working on the image matching portion and using the transformation matrix to combine the images. Thanks.

Spara

Yes, you should put a 1 in the bottom right corner as you guessed.