1

I have an image obtained by phone camera and I need to find regions, where balls are. An image can for example look like this:

Image example

I tried segmentation, but results are not as good as I would like.

My current idea is:

In 1D, when i have ball, I can use continuous wavelet transform with Morlet wavelet to find it. There are images of 1D CWT of ball signal: 1D signal of ball

And this signal CWT with Morlet wavelet looks like this: CWT of 1D ball signal (Note: image is stretched in Y direction)

Can I use something simillar in image? Does something like 2D CWT exists? If it does, is it somewhere implemented (C++)? Or is there better solution?

Thanks for your time


EDIT (comment reply to YvesDaoust):

Here you can see result of OpenCV HoughCircles. As you can see, result completely doesn't fit balls.

OpenCV HoughCircles result


EDIT 2 (comment reply to YvesDaoust):

I have modified Canny threshold parameter and set center threshold value (param2 in OpenCV implementation) to 1. These are first 300 circles. Still too many false positives.

OpenCV HoughCircles result 2

google2
  • 315
  • 3
  • 8
  • What about a Hough transform ? –  Mar 05 '18 at 10:50
  • @YvesDaoust It's useless. Unless the one implemented in OpenCV. It founds too much false positives and takes too much time. – google2 Mar 05 '18 at 10:57
  • 1
    Tune the radius parameter. –  Mar 05 '18 at 11:10
  • @YvesDaoust which operation apply on image before HoughCircles? – google2 Mar 05 '18 at 12:12
  • None, there is a built-in gradient. –  Mar 05 '18 at 12:41
  • @YvesDaoust see edit. Any suggestions to improve? – google2 Mar 05 '18 at 16:32
  • This result is quite abnormal. Are you somehow transforming the image ? –  Mar 05 '18 at 16:35
  • @YvesDaoust i have changed param1 and param2 (were default before). See edit 2 for result. Still too many false positives and it's slow. But already makes sense. – google2 Mar 05 '18 at 19:09
  • I can't understand those false positives vs. so many false negatives... –  Mar 05 '18 at 20:14
  • @YvesDaoust what do you mean you don't understand? Why are they there? Why not all balls are identified? – google2 Mar 05 '18 at 20:30
  • Inappropriate parameter settings or some bug in your code. Why do the images appear in pseudocolors ? –  Mar 05 '18 at 20:34
  • @YvesDaoust it's colormap: matplotlib.pyplot.imshow default colormap (viridis). No image filtering, nothing like this, just loading as greyscale. Python code enclosed: cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, dp=1, minDist=int(round(5*pxPerMm)), param1=50, param2=1, minRadius=int(round(2.5*pxPerMm)), maxRadius=int(round(10*pxPerMm))). Minimal diameter of balls is 5mm, maximal is 20. – google2 Mar 05 '18 at 22:06
  • Try to tune param1, param2. –  Mar 05 '18 at 22:14
  • @YvesDaoust thank you. I had to use CLAHE and tune param1 and it workes. But please, do you know some way, how automatically set param1 based on input image? – google2 Mar 06 '18 at 07:25
  • This is very difficult as the image has other content than what you are looking at so it should be adaptive. You can try some multiple of the average gradient intensity. –  Mar 06 '18 at 07:35

0 Answers0