Need suggestion on finding rotation angle.
2 views (last 30 days)
Show older comments
Hi,
I downloaded the M file above that uses SURF to detect same feature point between 2 images. Then i extract 10 same feature points between the 2 images and with some calculation i got the scale and rotation difference between 2 images.
Result: scale =
Columns 1 through 5
0.5004 0.5002 0.5006 0.5004 0.5006
Columns 6 through 9
0.5008 0.5005 0.5005 0.5008
angle =
Columns 1 through 5
174.8310 -4.9214 -5.0368 -5.0544 -4.2956
Columns 6 through 9
-2.9111 -5.0442 -5.7359 -5.0155
For scale i use the method of distance of point 1 to 2 of ImageA over distance of point 1 to 2 of ImageB.
While for the angle i found it with Inverse tangent the slope of point 1 to 2 of imageA minus Inverse tangent the slope of point 1 to 2 of imageB.
With 10 feature point i calculate the scale and angle 9 times with different pair corresponding points.
The result of the scale is pretty consistent however for angle wise, i have some problem. (The correct scale diff=0.5, angle=-5)
Please suggest another method of finding the rotation angle different between 2 image.
Thanks
0 Comments
Answers (1)
Alex Taylor
on 7 Jun 2011
Hi Kyle,
If you look at example3.m of the link you provided, the next step after finding SURF features is to find the best matches of features in each image.
Once you have more matching features than you do degrees of freedom in the geometric transformation you assume exists between both images (3 if you assume there is rotation, homogeneous scale, and translation between your two images), then you are trying to solve an over-constrained least squares problem. That's what the following code is doing from example3.m of the link you provided (see doc mrdivide)
% Calculate affine matrix
Pos1(:,3)=1; Pos2(:,3)=1;
M=Pos1'/Pos2'
A common issue that is not shown in the link you provided is that some of your SURF matches will be outliers, and this will throw off the estimate of the transformation if you attempt to solve this as a least-squares problem directly. You might want to look at the RANSAC algorithm to see how outliers are eliminated in feature based image registration problems. The following MATLAB file exchange link shows how RANSAC is used in a feature based registration pipeline:
Hope this helps,
Alex.
See Also
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!