What do the elements of the affine3d 4x4 matrix mean?

2 views (last 30 days)
I am trying to use affine3d objects in the Image Processing Toolbox, but I have a question that cannot be answered by the help function or the website. When performing an image volume registration using imregtform.m, the result is an affine3d object that contains a 4x4 matrix. Can you tell me exactly what each element of the matrix means? I've been able to decipher that row 4, column 1 is the shift in the x-direction, row 4, column 2 is the shift in the y-direction, and row 4, column 3 is the shift in the z-direction. The upper left 3x3 matrix contains information regarding rotations, but it's unclear to me how to extract the rotation angles.
Being able to extract the rotation angles from an affine3d object would be very useful for examining registrations of 3D image volumes.
Thank you.

Answers (1)

Matt J
Matt J on 1 Jun 2016
Edited: Matt J on 1 Jun 2016
If your affine transform is a rigid transform representable as y=R*x+t, then the matrix you are looking at is
T=[R,t;0 0 0 1].';
So, doing R=T(1:3,1:3).' will recover the rotational part, R, from T. As for how to obtain rotation angles from R, that decomposition is not unique. You can read about various choice here.
  2 Comments
David Soltysik
David Soltysik on 1 Jun 2016
Thanks for the reference to the Euler angles. It looks like it will be non-trivial to determine the rotation angles.
Matt J
Matt J on 1 Jun 2016
There are decomposition tools on the file Exchange which might save you some work.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!