Asked by marian wagdy
on 22 Oct 2013

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

Answer by David Legland
on 22 Oct 2013

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.

Image Analyst
on 22 Oct 2013

Please mark as Accepted if it answers your question.

marian wagdy
on 28 Oct 2013

OK, thanks.

Sign in to comment.

Answer by Image Analyst
on 22 Oct 2013

marian wagdy
on 22 Oct 2013

marian wagdy
on 22 Oct 2013

thanks for reply

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 9 Comments

## Simone conigliaro (view profile)

## 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

## Image Analyst (view profile)

## 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

## Simone conigliaro (view profile)

## 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

## Simone conigliaro (view profile)

## 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

## Simone conigliaro (view profile)

## 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

## Image Analyst (view profile)

## 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

## Simone conigliaro (view profile)

## 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

## Image Analyst (view profile)

## 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

## Simone conigliaro (view profile)

## 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.