About "projective" command
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a problem, i have an imagen and then i applied "imtransform" like this tutorial ( http://www.mathworks.com/help/toolbox/images/ref/imtransform.html). I used tform = maketform('projective'...). So the question: Is there anyway to known where goes any pixel and known what is it his transformation in the new coordinates?. I hope you can help me
Thanks.
Alex
댓글 수: 0
답변 (1개)
Alex Taylor
2012년 5월 7일
Yes,
The functions tformfwd and tforminv are what you are looking for.
help tformfwd
help tforminv
You can calculate where the forward transformation T maps in the input point (1,2) using the following example:
tform = maketform('projective',[2 1 0; 2 1 2; 0.1 0 2]);
[X,Y] = tformfwd(tform,1,2)
Hope that helps,
Alex.
댓글 수: 2
Yanliang
2013년 3월 27일
Hey Alex,
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 ;
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!