affine transform matrix from given point set

조회 수: 8 (최근 30일)
Yong Guk Kang
Yong Guk Kang 2019년 11월 5일
댓글: Bela Zold 2021년 1월 28일
** same questionswere uploaded in researchgate
I am trying to make general affine 3d transform matrix from 4 point set to another 4-point pointset (actually, it is rigid transformation- rotation + translation) for using with 'imwarp'
e.g pointset (x1 y1 z1)->(X1 Y1 Z1), (x2 y2 z2)->(X2 Y2 Z2),(x3 y3 z3)->(X3 Y3 Z3), (x4 y4 z4)->(X4 Y4 Z4)
However, I found some nice tutorial about affine transform.
From this workbook, the SAM (Simplex Affine Map) is the general affine mapping function from one point to another. In addition, they showed the way to convert this SAM form to canonical form;
where A: rotation matrix, T: translation matrix
I think I can modify this matrix 'A' and 'T' to an affine matrix that compatible with ‘imwarp’in MATLAB.
However, I could not find a nice way to express this Matrix expression in MATLAB unless expand all this cofactor with hand. Can someone suggest an efficient way of expressing this matrix in MATLAB style? or even without this method, could you suggest the way how to generate the transform matrix from give 4 point set?
Regards,
ps. all pictures were from the workbook

답변 (1개)

Yong Guk Kang
Yong Guk Kang 2019년 11월 5일
I just found the answer on my own. It's so funny that I didn't think this way.
I will leave an answer here for people like me 4 hours ago...
%R=A*T where R= reference points, T= target points
% 4 pointset of reference
r1 =[1 0 0]
r2 =[1 1 0]
r3 =[2 0 0]
r4 =[1 0 1]
% 4 pointset of target
t1 =[0 0 0]
t2 =[0 2 0]
t3 =[2 0 0]
t4 =[0 0 2]
%homogenous coordinate
R=[r1,1; r2,1; r3,1; r4,1]';
T=[t1,1; t2,1; t3,1; t4,1]';
%since R=A*T, A= R*inv(T) or just A=R/T (in MATLAB)
A=R/T
% Result :
% A =
%
% 0.5000 0 0 1.0000
% 0 0.5000 0 0
% 0 0 0.5000 0
% 0 0 0 1.0000
% computes twofold scaled, translated matrix well
  댓글 수: 1
Bela Zold
Bela Zold 2021년 1월 28일
I have been looking for this solution for a while. Thank you.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Agriculture에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by