How do I determine the angle, scale and translation between two images after imregister?
10 views (last 30 days)
Show older comments
I have one rotated, scaled, translated image and a fixed image. The output of imregister, t is shown:
[movingregistered] = imregister(fixed,moving,'similarity',optimizer,metric,'DisplayOptimization',1);
t = [1.001092e+00 -6.373544e-04 0.000000e+00;...
6.373544e-04 1.001092e+00 0.000000e+00;...
-1.351965e+00 5.672809e-01 1.000000e+00];
I need accurate subpixel knowledge of the offset and rotation of two images. Is t rotated about center pixel or upper left pixel (1,1). It is not sufficient to show the images "look" registered :) Using R2012B
What is the definition of the 9 elements of t?
Thanks, Howard
1 Comment
Matt J
on 19 Jun 2013
Your code doesn't show how t was produced. It appears nowhere in your call to imregister. Did you call imregister with a 2nd output arg that you aren't showing?
Answers (3)
Sean de Wolski
on 19 Jun 2013
You can use imregtform to get the transformation matrix:
doc imregtform
8 Comments
Sean de Wolski
on 11 Jul 2013
You could make a local copy in that directory. That way it has access to the private files.
Matt J
on 19 Jun 2013
Edited: Matt J
on 19 Jun 2013
Is t rotated about center pixel or upper left pixel (1,1).
After some experimentation with code (below) that duplicates the relevant portions of IMREGISTER, I think I can safely say that the rotation is about the upper left pixel.
M=100;N=M;
A=zeros(M);
A(1:M+1:50*(M+1))=1;
%30 degree rotation
t=[ 0.8660 -0.5000 0
0.5000 0.8660 0
0 0 1.0000];
B = imtransform(A, maketform('affine',t), 'XData', [1 N], 'YData', [1 M], ...
'Size', [M N]);
figure;imagesc(A)
figure; imagesc(B+A)
0 Comments
Howard
on 10 Jul 2013
Edited: Matt J
on 11 Jul 2013
1 Comment
Matt J
on 11 Jul 2013
Edited: Matt J
on 11 Jul 2013
This seems like a different question than what you originally posted. First, please confirm whether that question is still open. I thought I provided pretty convincing evidence that the rotation was about the upper left corner. If you agree, please Accept-click that answer and start a new question. If you don't agree, please explain why the question is unanswered.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!