0

I am writing a program to analyze microscopy images. I have an edge mapping of an image that looks like this:

The program I have written draws bounding boxes around circular shapes, but when the contours are not closed (like in the image above) it struggles and the resulting bounding box can include multiple circles.

So given this image, is there a way to differentiate between the two circular (or ovular) bodies, so the bounding boxes accurately enclose each shape?

(The image is an example of a bounding box incorrectly drawn around multiple circles)

2EricH
  • 42
  • 8
  • 3
    Perhaps post the original from which you got the edge (contour) image and your processing code. That way we can see if there is any way to preprocess before getting the edges to find better results. – fmw42 Aug 28 '20 at 18:10
  • for circles it would be easy, but those are ellipses or ovals. Not sure whether you can adapt this RANSAC code to ellipses instead of circles: https://stackoverflow.com/a/20734263/2393191 – Micka Aug 29 '20 at 07:38
  • Unfortunatly this pre-processing step is necessary for other applications of the code, so this is the image that needs to be worked with. – 2EricH Sep 04 '20 at 21:11

1 Answers1

1

If all/most your error cases look like the above one, i.e. with bounding boxes that should be further subdivided, you could try to use robustified fitting of ellipses to the edge points.

Francesco Callari
  • 11,300
  • 2
  • 25
  • 40
  • Did some googling about this and yeah, this seems like a great approach, especially since most of the calculations can be done through matrices. This paper offers a guidline for the process as well. https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwj_v6LWstDrAhUTQ80KHYB-CfQQFjAAegQIARAB&url=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.193.319%26rep%3Drep1%26type%3Dpdf&usg=AOvVaw2xXiMBoEKjutDIu8G8ZzgX – 2EricH Sep 04 '20 at 21:09