I am working on a project to detect the size and number of bubbles on a surface. My current algorithm works okay, except on images that have dark blotches on them. These blotches are mistakenly selected as bubbles.
My current approach uses adaptive binary thresholding and canny edge detection to find the shadows of bubbles, then I find the minimum enclosing circle of each contour of the shadows. Here is an example of what the output looks like on an image without blotches:
I had tried using the cv2.circle method and cv2.SimpleBlobDetector with less desirable results. Does anyone know a better way to find these bubbles... perhaps a way to detect a gradual change in the gradient rather than the sharp edges of the blotches?
Let me know if I need to clarify anything! Thank you for your advice! :)
Okay, I think I figured out a way.
I found the contours that were both darker (blue) and lighter (red) than the surrounding background. Then I looped through the contours to combine red and blue contours that were close and stacked on top of each other.