How does this function "regionprops" to find the orientation of any object?

How does this function "regionprops" to find the orientation of any object?

9 Comments

hi, I would like to ask to you what function is possible to use to find orientation in 3D. i used "regionprops "to obtain orientation in 2D. what function do you suggest? please answer it.
regionprops() is the function I would suggest also.
thanks for your answer but regionprops(orientation) is no possibile to use for orientation of blobs 3D. it is excellent for 2/d. another advice? thanks
'Orientation' — Scalar; the angle (in degrees ranging from -90 to 90 degrees) between the x-axis and the major axis of the ellipse that has the same second-moments as the region. This property is supported only for 2-D input label matrices.
do you know another property that is supported for 3D input label matrix? many thanks
Use principal components analysis, pca().
thanks. could you write how i calculate it? if is possible the matlab code because i have no idea how to calculate.
many thanks
You'd use [y, x, z] = find(binaryImage) and then pass them into pca(). I don't have a demo for exactly that, but I'm attaching a demo of using pca to determine axes for a color gamut, for whatever that's worth.
thanks for your replay. i have another question to ask you. i would like to know what is the method that regionprops label the object? because i used this function to get centroid and volume(sum voxel for each blob)but i don't understand this aspect. thank you very much

Sign in to comment.

 Accepted Answer

Hi Marian,
the code is in the regionprops function, you can access it via "edit regionprops", and checking the "ComputeEllipseParams" function.
The principle is to compute the inertia ellipse of a shape. It is obtained by computing normalised centered moments. The matrix of Inertia is obtained from the normalised moments of order 2 : Ixx, Ixy, and Iyy. By extracting eigen values and eigen vectors of the inertia matrix, it is possible to obtain the direction of the first eigen vector, that is converted into angle.

More Answers (1)

It fits the blob to an ellipse and then gets the angle of the major axis of the ellipse from the horizontal. Note: the major axis of the fitted ellipse is not the farthest distance between two points in the blob.

2 Comments

Yes, I know this, but I want to know the details of this function by using the mathematical equations,and the code

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!