Leonid Shusharin Leonid Shusharin - 1 year ago 205
Python Question

Detect different kinds of circles and ovals on the image using OpenCV and Python

I need to detect the different shapes on the image such as ellipses and circles with a dashed-border.

Using OpenCV causes some troubles, for e.g. openCV detects not a contour but an amount of small separated lines(contours).
In case of ellipse with a "dashed-border" I need it to be as single contour, not a separated objects.

What would you suggest to solve this problem?

I also need to recognize the ellipses(or circles) with solid border and ellipses(circles) with a dashed-border

Ellipse with solid border

enter image description here

Ellipse with dashed border:

enter image description here

Answer Source

The Hough transform should not have any troubles with either dashed or solid borders, or a mix thereof. I have used it to detect dashed lines in one of my project and ellipses should not be much harder.

OpenCV by default only implements the Hough transform for circles and straight lines but there is a blog entry with code on how to adapt it for elliptical shapes.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download