Ask Your Question

bounding ellipse needed

asked 2013-09-30 23:16:18 -0600

leafjungle gravatar image

updated 2020-11-05 23:38:00 -0600

Is there a method to get the bounding ellipse of a contour. I mean all the points should be inside the ellipse. fitEllipse get the best fitting ellipse,not the bounding ellipse.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-10-01 01:23:33 -0600

Michael Burdinov gravatar image

No, OpenCV don't have method that finds bounding ellipse. But it has function called minAreaRect that finds bounding rotated rectangle of the minimum area. It may give you results that are pretty close to bounding ellipse. Or you may use minEnclosingCircle function if your ellipse is close enough to circle.

edit flag offensive delete link more


Thank you very much~~I have a problem that need to describe the degree of ellipse of a contour. and I want to extract the bounding ellipse, then compare the contour's area and its bounding ellipse area. minAreaRect is not suitable. And I think I can judge by each pixel inside the contour, But I can not get all the points inside the contour.

leafjungle gravatar imageleafjungle ( 2013-10-01 08:43:35 -0600 )edit

Ellipse and rotated rectangle have same degrees of freedom: center, width, height and angle. minAreaRect will give you results that are pretty close to bounding ellipse. Actually, if your points really form an ellipse then results of bounding ellipse and minAreaRect will be identical.

Michael Burdinov gravatar imageMichael Burdinov ( 2013-10-01 13:34:11 -0600 )edit

I know you point. hope opencv will have a bounding ellipse api in the future.

leafjungle gravatar imageleafjungle ( 2013-10-09 03:39:17 -0600 )edit

Question Tools


Asked: 2013-09-30 23:16:18 -0600

Seen: 594 times

Last updated: Oct 01 '13