Home > Software design >  How to improve accuracy of CV2's HoughCircles
How to improve accuracy of CV2's HoughCircles

Time:01-12

I've been dabbling into OpenCV for the sake of learning something new and one of the projects I proposed myself to do (as suggested by a friend) was determining the diameter of the circles generated by the pills in an antibiogram sensitivity test. Which gives this as a result

A couple of suggestions I can think of to help improve or find better params:

  1. Pass in the blurred image to the HoughCircles function. Currently, you're passing in the grayscale version of the image, not the blurred one.

  2. Blur size and type. Blurrier images can help downstream algorithms. For the kernel, the size also tends to be the same shape eg (20,20), and using (20,30) might give different results.

  3. Consider contrast correction like an equalizeHist or CLAHE - it can help with edge-detection for images where you have low contrast or faded edges.

  4. Magic numbers.According to the docs, param2 can be made larger to remove false positives, so experiment with that. As for param1 and dp, you might have to permute some combinations and see what works best. And if you're getting into the world of comparing multiple image sets with different lighting conditions, you might have to consider normalising the images first. Magic numbers seem to be part and parcel with out of the box algorithms, so the best way to find what works is to permute the inputs and output the images all at once to see what works, then fine tune.

Best of luck in your biology-related OpenCV journey :)

  •  Tags:  
  • Related