Usually affine trans morphine of two-dimensional points expersed as
x' = A*x
Where x is a three-vector [x; y; 1] [x; y; 1] [x; y; 1] original 2D location, and x' is the transformed point. The affine matrix A is equal to
A = [a11 a12 a13; a21 a22 a23; 0 0 1]
This form is useful when x and A known, and you want to restore x' .
However, you can express this attitude differently. Let
X = [xi yi 1 0 0 0; 0 0 0 xi yi 1 ]
and A is the column vector
a = [a11; a12; a13; a21; a22; a23]
Then
X*a = [xi'; yi']
Holds for all pairs of corresponding points x_i, x_i' .
This alternative form is very useful when you know the correspondence between pairs of points and want to restore the parameters A
Stacking all your points in a large matrix x (two rows for each point), you will have a 2 * n-6, x matrix multiplied by a 6-vector of unknown A , equal to 2 * n-by -1 column vector of stacked corresponding points (indicated by x_prime ):
X*a = x_prime
Solution for A :
a = X \ x_prime
Restores the parameters of A in the sense of least squares.
Good luck and stop skipping class!
Shai
source share