Search code examples
pythonopencvimage-processingcomputer-vision

Circle detection in microscopy images (noisy)


I'm working on a project where I have to develop an automated microscope. I need an algorithm to be able to identify circles. I was able to get an algorithm that can deal with noise and find circles, but if the experimental setup changes a bit it no longer works with out tweaking the parameters (not what I want).

I have experimented multiple approaches and the one that works most of the time is using CLAHE, then blurring the image. After this I run the result on Hough Circles. I will show an example. This is the raw data that doesn't work on the current algorithm:

raw data

After applying the CLAHE I get:

CLAHE image

The Hough circles can only find one circle:

circle detection

Another approach is using histogram equalization:

equilize histogram on raw data

This will give clearer circles but the Hough circles doesn't work at all. Some times I do some gainDivision to remove the background and then only apply the histogram equalization:

equilize histogram after doing gain division

The histogram equalization always improve contrast so my idea was to switch the CLAHE to this but I'm not being able to.

This site https://fiveko.com/online-tools/hough-circle-detection-demo/ works on every data after histogram equalization.

Can someone provide a way to detect circles in the equilize histogram image? With out it creating random circles in the back ground due to the noise.

Update: decided to go with AI algorithm


Solution

  • The best I could do is tweak GaussianBlur and HoughCircles to work for the one eqi-hist image you provided. Hope it is more general than it seems and will help you somehow.

    blur = cv2.GaussianBlur(gray, (11, 11), 0)
    circles = cv2.HoughCircles(blur, cv2.HOUGH_GRADIENT, 1, 20, 
                               param1=180, param2=17, minRadius=2, maxRadius=50)
    

    Result