Is the Matrix for 3-D affine geometric transformation (affine3d) equal to deformation gradient ?
2 views (last 30 days)
Show older comments
According to the explonation on https://de.mathworks.com/help/images/matrix-representation-of-geometric-transformations.html describes for 2d transormation matrix [ sx shy 0;shx sy 0; tx ty 1].
To my Knowledge you calculate deformed point p'(x y )' with deformation gradient : p'=F*p. In this case F should be [sx shx; shy sy] which is a transposed 2d affine transformation matrix(1:2,1:2) according to above mentioned link.
Well when i look into the example with following code:
I = imread('cameraman.tif');
tform = affine2d([1 0 0; 0.5 1 0; 0 0 1]);
J = imwarp(I,tform);
Then the image is sheared in x direction. if use the F=[1 0 ; 0.5 1] and calculate according to the books and matrix calculation rules, then i should get a shear in y- direction : [x';y'] =[1 0 ; 0.5 1]*[x;y] = [x; x*0.5+y].
For my task i want rotate and apply shear, strain/scale to a volume. Therefore i have as input rotation angles along x,y,z and deformation gradient. First i calculate with eul2rotm the rotation matrix and multiply it with the deformation Gradient, after that i use the result matrix A for the tform.
So my question is: Does eul2rotm calculate tranposed rotation matrix or normal one? And am i supposed always to transpose the deformation Gradient to use affine3d?
0 Comments
Answers (1)
Kartik
on 11 Sep 2023
Hi,
When using the 'eul2rotm' function in MATLAB, it returns the rotation matrix in the normal form, not the transposed form. The rotation matrix returned by 'eul2rotm' represents a rotation in 3D space and is defined as:
R = eul2rotm([phi, theta, psi])
where 'phi', 'theta', and 'psi' are the rotation angles around the X, Y, and Z axes, respectively. The resulting rotation matrix 'R' represents the rotation transformation from the original coordinate system to the rotated coordinate system.
Regarding the deformation gradient and the 'affine3d' function, it expects the deformation gradient matrix to be in the transposed form. The deformation gradient matrix represents a linear transformation that combines rotation, scaling, shearing, and translation. The 'affine3d' function expects a 4x4 transformation matrix in the form:
T = [sx shx shy 0;
shx sy shxy 0;
shx shxy sz 0;
tx ty tz 1]
In this matrix, sx, sy, and sz represent the scaling factors along the X, Y, and Z axes, respectively. 'shx', 'shy', and 'shxy' represent the shearing factors, and 'tx', 'ty', and 'tz' represent the translation values.
To use the deformation gradient with 'affine3d', you need to transpose the deformation gradient matrix before passing it to the function. The resulting matrix will have the correct form for 'affine3d' to apply the desired transformation to a volume.
In summary, 'eul2rotm' returns the rotation matrix in the normal form, while the deformation gradient matrix should be transposed before using it with 'affine3d'.
Refer to the following MathWorks documentation for more information about 'eul2rotm':
0 Comments
See Also
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!