imtransform, tracking a projection destination of some pixel

3 ビュー (過去 30 日間)
Yanliang
Yanliang 2013 年 3 月 27 日
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 件のコメント
Image Analyst
Image Analyst 2013 年 3 月 27 日
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.
Yanliang
Yanliang 2013 年 3 月 28 日
編集済み: Yanliang 2013 年 3 月 28 日
Thank you, major problem in this code is the misunderstanding of the coordinate system. More specifically I switch the place of x and y coordinate. On top of that, Alex's answer is enough to make it right.

サインインしてコメントする。

採用された回答

Alex Taylor
Alex Taylor 2013 年 3 月 27 日
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 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by