Line orientation in 3D from centroid and Euler angles

I used the regionprops3 function to detect centroid and Euler angles of cylinders of the same size in 3D space. Now I want to obtain the 3D coordinates of a line (of given length, representing the axis of the cylinders) passing through the centroid and oriented according to the three Euler angles. What kind of coordinate transformation should I consider?

 採用された回答

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

0 投票

I think you'd be better off using regionprops3 to extract the Eigenvalues and Eigenvectors properties of the cylinders, instead of the Orientation property (which I assume you are using now). The eigenvector corresponding to the largest eigenvalue should give you the direction vector of the long axis of the cylinder directly.

5 件のコメント

matnewbie
matnewbie 2018 年 6 月 19 日
Thanks for you answer. In theory I have also the BoundingBox, but it is not so trivial to obtain the orientation from it.
How could I transform the largest eigenvalue in the 3D coordinates of two points at equal distance from the centroid (knowing the length of the cylinder axis)?
Matt J
Matt J 2018 年 6 月 19 日
編集済み: Matt J 2018 年 6 月 19 日
I think you've got it backwards. Once you have the centroid of the cylinder and the direction vector of its axis (per my suggestion above), you can find the end points according to,
Endpoints= Centroid +/- (Length/2)*DirectionVector
matnewbie
matnewbie 2018 年 6 月 19 日
編集済み: matnewbie 2018 年 6 月 19 日
It's just the DirectionVector that I am trying to determine from the results. Eigenvalues determine the PrincipalAxes lengths, according to the documentation of regionprops3 (and, indeed, two of them are equal in magnitude).
Matt J
Matt J 2018 年 6 月 19 日
編集済み: Matt J 2018 年 6 月 19 日
Well, as I said, the eigenvector corresponding to the largest eigenvalue is the direction vector. So, you have it already from
regionprops3(yourImage, 'Centroid','EigenVectors','EigenValues')
One thing to note. I believe the EigenVectors are the rows of the matrix given in the output of regionprops3, not the columns.
Saurabh Patel
Saurabh Patel 2018 年 9 月 20 日
I think eigenvectors are still the columns of eigenvector matrix but they are in image coordinates i.e. (row,col,page) and not in (x,y,z).
For (x,y,z) space, I think we need to represent it as {eigenvector(2,1), eigenvector(1,1), eigenvector(3,1)} for the major principal direction.

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

その他の回答 (0 件)

カテゴリ

製品

リリース

R2017b

質問済み:

2018 年 6 月 19 日

コメント済み:

2018 年 9 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by