imtransform, tracking a projection destination of some pixel
1 view (last 30 days)
Show older comments
Hey Guys,
I am doing imtransform, yet it scale the output image automatically,
And I can not find the destination of a specific feature point.
Could you help me out?
Related codes for checking:
[ imgDouble{1}, ybound, xbound ] = imtransform( imgDouble{1}, tform );
Ap = tformfwd( tform, inlier_array );
Ap = mean(Ap);
ApCord = tformfwd( tform, [ [1, 1]; [height, 1]; [1, width]; [height, width] ] );
ApCord = [ min( ApCord ); max( ApCord ) ];
AppH = xbound(2) - xbound(1) + 1;
ApCordH = ApCord( 2, 1 ) - ApCord( 1, 1 ) + 1;
App(1) = ( Ap(1) - ApCord( 1, 1 ) + 1 ) * AppH / ApCordH + xbound(1) - 1;
AppW = ybound(2) - ybound(1) + 1;
ApCordW = ApCord( 2, 2 ) - ApCord( 1, 2 ) + 1;
App(2) = ( Ap(2) - ApCord( 1, 2 ) + 1 ) * AppW / ApCordW + ybound(1) - 1;
B_Location = mean( dest_array );
A_Location = App - [ xbound(1), ybound(1) ] + [1, 1];
offset_AB = A_Location - B_Location + [1, 1];
putative_off_B = offset_AB ;
2 Comments
Image Analyst
on 27 Mar 2013
You forgot to supply same data so we can help you out. I can't run this snippet of code to even see what's going on.
Accepted Answer
Alex Taylor
on 27 Mar 2013
I cannot tell from your code example what you are trying to accomplish. It's also not clear from your question how the Auto-Scale behavior of imtransform is related to the point mapping problem that you are interested in.
If you are using a version of MATLAB older than R2013a, you can use tformfwd and tforminv to map points by the forward and inverse geometric transformation.
If you are using R2013a and later, you can use the transformPointsForward and transformPointsInverse methods of the geometric transformation classes (e.g. affine2d, projective2d).
If you are using R2013a, you might consider looking at the new function imwarp. It does not use any scaling behavior when determining the output grid size and world limits.
0 Comments
More Answers (0)
See Also
Categories
Find more on Feature Detection and Extraction in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!