73 views (last 30 days)

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

David Legland
on 22 Oct 2013

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.

Image Analyst
on 22 Oct 2013

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 9 Comments

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480141

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480141

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480143

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480143

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480324

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480324

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480331

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480331

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480333

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480333

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480406

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480406

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480436

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480436

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480482

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_480482

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_481061

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/91053-how-does-this-function-regionprops-to-find-the-orientation-of-any-object#comment_481061

Sign in to comment.