Ask Your Question

Program that check for the roundness of ellipse?

asked 2015-04-16 06:55:08 -0500

215 gravatar image

In my program i am creating a ellipse which bounds some points. When the points are normal distributed, the ellipse turns into a circle, which means a mask has to be increased. But how do i check for the roundness of the bounding ellipse?

edit retag flag offensive close merge delete



Have you tried the ratio between the 2 axes? If it is 1 (or very close to 1) than it is (may be) a circle

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-04-16 07:43:39 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-04-16 16:54:09 -0500

theodore gravatar image

updated 2015-04-16 16:57:16 -0500

In order to obtain the roundness of an object, you either extract the roundness k or the eccentricity e of the object. With eccentricity being a better measure because it has a clearly defined range of values and therefore it can be compared much better.

The roundness k can easily be calculated by dividing the square of the perimeter p with the area A:

image description

However, because a circle has a maximal Area A within a given perimeter p, a scaling of roundness k is performed:

image description

Therefore, k for a circle is equal 1, while for other objects > 1. On the other hand eccentricity e can derived from the semi-major and semi-minor axes a and b of an object:

image description image description

Moreover, eccentricity can be calculated from the central moments of second order:

image description

The eccentricity can have values from 0 to 1. 0 corresponds to a perfectly round object while 1 to a line shaped object. Therefore using the moments class I guess you can achieve your task. Furthermore, here there is an sort of example where it computes some of the above properties. it is in old C api but I do not think that it would be that hard to port it to the new C++ api.


edit flag offensive delete link more

Question Tools



Asked: 2015-04-16 06:55:08 -0500

Seen: 3,798 times

Last updated: Apr 16 '15