利用Matlab,我试图解决的6个三角形(见A
和Aprime
)仿射变换...如何查找三角形之间的仿射变换?
3三角形在A
triangle1: points 1,2,3 of A
triangle2: points 4,5,6 of A
triangle3: points 7,8,9 of A
其中,X/Y A的坐标为:
A.x = [x1 x2 x3; x4 x5 x6; x7 x8 x9]
和 A.y = [y1 y2 y3; y4 y5 y6; y7 y8 y9]
还有还有在Aprim
3个三角形。
triangle5:points 1,2,3 of Aprim
triangle6:points 4,5,6 of Aprim
triangle7:points 7,8,9 of Aprim
其中,X/Y Aprim的坐标为:
Aprim.x = [xp1 xp2 xp3; xp4 xp5 xp6; xp7 xp8 xp9]
和Aprim.y = [yp1 yp2 yp3; yp4 yp5 yp6; yp7 yp8 yp9]
我需要找到这样的A
每个三角形映射到Aprim
三角仿射变换:
- t1是将A的三角形1映射到Aprim的三角形1的仿射变换。
- t2是将A的三角形2映射到Aprim的三角形2的仿射变换。
- t3是仿射变换,将A点的三角形3映射到Aprim的三角形3 。
问题#1:在我的代码,TForm的只给我仿射变换T3。我不知道如何改变它以知道t1,t2,t3的仿射变换。
问题#2:我的其他问题是在tform矩阵中,哪些元素是平移,旋转,缩放值?如何找到缩放比例,旋转角度和平移值?
任何人都可以帮我纠正我下面的matlab代码吗?如何解决t1,t2 and t3?
我的代码是:
A.x=[309 367 295;273 268 298;295 367 298];
A.y=[292 259 277;228 253 225;277 259 225];
Aprim.x=[267 211 265;267 261 295;259 261 211];
Aprim.y=[301 222 325;301 270 306;213 112 222];
for i=1:3
A_xprim(1:3,i)= transpose(Aprim.x(i,1:3));
A_yprim(1:3,i)=transpose(Aprim.y(i,1:3));
Ax(1:3,i)= transpose(A.x(i,1:3));
Ay(1:3,i)=transpose(A.y(i,1:3));
tform = maketform('affine',[A_xprim(1:3,i) A_yprim(1:3,i)],[ Ax(1:3,i) Ay(1:3,i)]);
end
你有一个代码,尝试其他人可以快速检查吗?如果你展示你的尝试,你会得到更快的答案。 –
我不使用Matlab,所以我不能帮助代码。这** [手册页](http://www.mathworks.com/help/images/performing-general-2-d-spatial-transformations.html#f12-33299)**可能会帮助您了解该变换矩阵问题... –