circle detection opencv android

asked 2013-12-04 04:44:24 -0600

droidCV gravatar image

updated 2013-12-05 00:51:46 -0600

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 : coin over hand

Image 2 : circle drawn on paper


edit :

Image 3 : Image 3 with circle detected

Image4 : Image 4 with circle detected

edit retag flag offensive close merge delete


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?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-04 06:26:13 -0600 )edit

I will post images in which there is detection. In above images there is no detection . That's the main problem.

droidCV gravatar imagedroidCV ( 2013-12-05 00:48:09 -0600 )edit

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.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-06 02:36:50 -0600 )edit

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 ?

droidCV gravatar imagedroidCV ( 2013-12-06 03:32:21 -0600 )edit

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.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-09 03:18:08 -0600 )edit