circle detection opencv android
I am trying to detect circles using Opencv for android. So far I have tried using JavaCvCamera and custom android camera app , In both scenarios circle detection is not efficient. Also even when I set the minRadius, maxRadius parameters to 0 so that all possible circles will be detected , its not happening. Circles are hardly detected and also when they are considerably big enough like when they cover 1/8 of the screen. Following code snippets shows the procedures I am using
1 . Straight forward houghCircle
2 . Sobel derivative and houghCircle
3.Sobel derivative and houghCircle using JavaCvCamera
I am using both these procesure with JavaCvCamera provided in opencv library and Custom camera using Camera API. Only difference being conversion form bitmap to mat while using Custom camera as captured image is firstly converted to Bitmap and then to Mat for opencv processing.
Can anyone tell reason why I am not able to find out the small circles ?
Following are some demo images I am using among which I get better results on
Image 1 :
Image 2 :
Thanks
edit :
Image 3 :
Image4 :
What are you passing as iMinRadius, iMaxRadius parameters. They define how large or small your detected circles can be. In the pictures, there is no detection? Could you post a detection result on those images?
I will post images in which there is detection. In above images there is no detection . That's the main problem.
That is indeed weird. I do not see a big difference between both except that the second one is much more blurry. It is possible that the other images are to sharp. Try smoothing them first with a Gaussian operator.
Check the code links which I have provided above. I am smoothing these images with Gaussian blur. Am I missing any step in between or is it the standard procedure for circle detection. 1 . convert to grayscale , 2 . Gaussian blue 3 . HoughCircle . is it the correct method or not ?
You are smoothing, but try to smooth the non detections even more.... It is possible that you didn't smooth enough. Use a larger smoothing kernel for example.