Question about regionprops3 'Orientation' angles / origin

I want to find out the spatial orientation of an object in a 3D image stack. For this, I am using regionprops3 of the Image Processing Toolbox. However the "order" of x-y-z angles confuses me, as the description sais "The angles are based on the right-hand rule. regionprops3 interprets the angles by looking at the origin along the x-, y-, and z-axis representing roll, pitch, and yaw respectively." Does this mean, the origin is at the lower front right corner of my image stack?
So my question is, can someone please help me translate the x-y-z angles into my image stack coordinate system, where the origin is at the top-left corner, y/rows goes down, x/columns to the right and z/pages "towards you"? As far as I figured, the "x" angle of regionprops seems to refer to what's my "Z"? Thanks a lot.

1 件のコメント

Hello Matlab
Hello Matlab 2018 年 7 月 6 日
編集済み: Hello Matlab 2018 年 7 月 20 日
So for anyone interested, I basically found the mapping of the axes from the regionprops3 output and my image axes.
The first angle from the vector needs to be rotated along the z/pages axis. The second along the y/rows axis and the third angle along the x/rows axis. As in my case I am doing an extrinsic rotation, the order of rotation is z-y-x. For intrinsic rotation the rotation sequence of roll-pitch-yawn is z-y'-x''.
I don't know whether this is applicable for most cases, but it is what worked for me.

サインインしてコメントする。

 採用された回答

Matt J
Matt J 2018 年 6 月 21 日
編集済み: Matt J 2018 年 6 月 21 日

0 投票

It is probably easier to use the EigenValues/EigenVectors property to determine 3D orientation. See this similar thread.

7 件のコメント

Hello Matlab
Hello Matlab 2018 年 6 月 22 日
編集済み: Hello Matlab 2018 年 6 月 22 日
That sounds interesting. I got this 3x3 array now as output from the 'EigenVector' option:
ans{1} =
-0.2043 -0.9789 0
-0.9789 0.2043 0
0 0 1.0000
How do I proceed?
It feels like I have a similar problem here, as I need to identify which eigenvector (you said in the other post, they are the rows) belongs to which axis in my 3D array.
Matt J
Matt J 2018 年 6 月 22 日
What about the eigenvalues?
Hello Matlab
Hello Matlab 2018 年 6 月 22 日
Those are
ans =
671.9095
603.7439
1.3333
Matt J
Matt J 2018 年 6 月 22 日
This tells you that the long axis of the object is pointing in the direction
-0.2043 -0.9789 0
Hello Matlab
Hello Matlab 2018 年 6 月 24 日
Thanks, I got that.
I am trying to get the orientation of two objects and calculate the angles between their axes. My thought was I just calculate the angle between the corresponding eigenvectors according to the eigenvalue with the formula
acos( dot(v1,v2) / (norm(v1) * norm(v2)) )
But it seems there is something wrong here as I don't get the angle I am expecting (78°C). What am I doing wrong?
One object is the one from above, the other one has those eigenvectors and -values:
evect{1} =
-1.0000 0.0070 0
0.0070 1.0000 0
0 0 1.0000
evalues =
673.6865
603.8868
1.3333
Matt J
Matt J 2018 年 6 月 24 日
編集済み: Matt J 2018 年 6 月 24 日
But it seems there is something wrong here as I don't get the angle I am expecting (78°C). What am I doing wrong?
You're not doing anything wrong, except maybe that you should be using acosd() if you want the angle in degrees.
Hello Matlab
Hello Matlab 2018 年 6 月 26 日
Indeed, indeed, I should do that. Thank you, Matt

サインインしてコメントする。

その他の回答 (1 件)

KARSH THARYANI
KARSH THARYANI 2018 年 6 月 21 日
編集済み: KARSH THARYANI 2018 年 6 月 21 日

0 投票

The co-ordinate system based on your description is not right handed. If your x is towards the left and increasing, the y is increasing downwards then, z must be normally-inwards to the page.
Nonetheless, when you created a 3-D array it is assumed that the origin is the top left corner, the x is increasing in the column number, and y is increasing in the row number and z is the inward dimension or the stack number increasing inwards(like I said).
The document says that the roll-pitch-yaw rotations correspond to the rotations along the x-axis, y-axis and z-axis respectively and in that order. For Euler rotations the order of rotations matters because given same rotation magnitudes two different order rotations will result in a different orientation. I hope that cleared your doubt regarding axis conventions.
Also, counter-clockwise rotations are considered to be positive according to the function.

1 件のコメント

Hello Matlab
Hello Matlab 2018 年 6 月 22 日
編集済み: Hello Matlab 2018 年 6 月 22 日
Thanks for your reply!
Yes, my 3D Array is just as you described it in the second paragraph (x increases to the right with column number) and I understand that the order of the axes is important for the rotation. But here is the problem, as the (XYZ)-axes that are returned by the 'Orientation' option don't seem to correlate to the (xyz) axes of my 3D array.
I assume this, as I know the rotation angle of my object along the z-axis/inward dimension. But exactly this angle (78°C) is returned by regionprops3 at the first position of the [xyz] output array of 'Orientation'. So I guess regionprops views as X-axis, what is the Z-axis in my 3D array.
Therefore I am unsure which of the other two angles of the 'Orientation' output corresponds to what axis in my 3D array. Or which finger in the Right-Hand rule is which axis in my 3D array :D
Thanks for helping!

サインインしてコメントする。

製品

リリース

R2017b

質問済み:

2018 年 6 月 20 日

編集済み:

2018 年 7 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by