DouglasAdams
DouglasAdams

Reputation: 490

Detect border of partially hidden ellipse with known center (OpenCV)

I have to detect the border of ellipses in gray images. These images contains a lot of stuff, but there is always a (partially hidden) ellipse. I know where is the center of this ellipse in the image.

Advantages:

  1. Ellipse is always visible

  2. Point near the center of the ellipse is known

  3. Ellipse is always black (value = [0, 50] on 8bits)

Troubles:

  1. White blobs (value = [220, 255]) can appears into the ellipse (not outside)

  2. Black artefacts (value = [0, 80]) can hide 0% to 50% of the ellipse and white blobs (but the center is still known)

Here are 4 examples images which represent the different situations that can appear :

Diagrams

I've tried severals algo (Hough circle, ellipse detection, ..) but none of them managed all the different situations. Moreover, they don't benefit of the known center. All suggestions are welcome !

Upvotes: 0

Views: 624

Answers (1)

Andrey  Smorodov
Andrey Smorodov

Reputation: 10852

Try RANSAC method, it will allow you avoid noise edges and fit ellipce accurate. Ellipse have 2 focuses, you can find them, knowing your ellipse equation, and then find middle between them. It will be you ellipse center of mass.

Example of code for RANSAC ellipse fitting: https://github.com/seisgo/EllipseFit

Upvotes: 1

Related Questions