I have two images and found three similar 2D points using a sift. I need to compute the affine transformation between the images. Unfortunately, I missed lecture and the information out there is a little dense for me. What would the general method be for computing this 2x3 matrix?
I have the matrix of points in a 2x3 matrix [x1 y1;x2 y2;x3 y3] but I am lost from there. Thanks for any help.
Usually, an affine transormation of 2D points is experssed as
x' = A*x
Where x
is a three-vector [x; y; 1]
of original 2D location and x'
is the transformed point. The affine matrix A
is
A = [a11 a12 a13; a21 a22 a23; 0 0 1]
This form is useful when x
and A
are known and you wish to recover x'
.
However, you can express this relation in a different way. Let
X = [xi yi 1 0 0 0; 0 0 0 xi yi 1 ]
and a
is a 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 you wish to recover the paramters of A
.
Stacking all your points in a large matrix X
(two rows for each point) you'll have 2*n-by-6 matrix X
multiplyied by 6-vector of unknowns a
equals a 2*n-by-1 column vector of the stacked corresponding points (denoted by x_prime
):
X*a = x_prime
Solving for a
:
a = X \ x_prime
Recovers the parameters of a
in a least-squares sense.
Good luck and stop skipping class!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With