MATLAB: Get transformation matrix from 3D points

matrixtransoformations

I have two plots of 3D reconstruction of a cup from 2 points of view. I need to find the transformation matrix that rotates the cup from the position of plot1 to the position of plot2. I fixed 3 point in plot1 (p1,p2,p3) with their respective coordinates and manually found the same point in plot2 (t1,t2,t3) with the transformed coordinate. I collected p1,p2,p3 in matrix P and t1,t2,t3 in matrix T, then I simply divided T/P=M. To check if I did good I tried to do p1*M hoping to find t1, but unfortunately I didn't succeed.
What should I do? Thanks

Best Answer

You should use more than 3 points to get better noise/error-resistance. Also, if your transformation is a rotation/translation, you need to constrain M to be of this form. This can be done with ABSOR ( Download ),
reg=absor(P,T)