2
votes

Is there any way to accurately detect circles in opencv? I was using hough transform which give me good result but most of the time, shadow of the object and surrounding,light etc gives bad results, so am looking for options other than hough circles, accurate detection is very important for my project.

My basic approach so far is to find some spheres in the image taken in realtime. I am using houghcircle to find the spheres and base later calculations on the radius I am getting from that.

If the background is plain and nothing the sphere detect without problem, however if I am taking that image in my room where the background will have other objects it's often difficult to detect. So am looking for some other approach.

2
We will links to images to help you (examples of the difficulties you have). In addition, you do not tell us what you specifically try... I presume the preprocessing will be crucial in your case. - Quentin Geissmann
@QuentinGeissmann ok, basic approch is to find some spheres in the image, so am using houghcircle to find them and later calculations are the value am getting from that, i mean the radius. if the background is plain and nothing the sphere detect without problem, suppose am taking that image in my room where the background will what ever things in my room, in that case its often difficult to detect. so am looking for some other approch - N.J
@QuentinGeissmann also my project based on i have to take the image in real time surrondings. - N.J
You are going to have to sacrifice efficacy if you want it done in real time. - Bill
of course it is difficult to detect something on a cluttered background. You have to rely on other kind of information: is your spherical object of a specific color? Concerning shadows, there is litterature on shadow detection - remi

2 Answers

3
votes

i had the similar need to find circle acuratly and hough do only a very little job regarding acurate detection. Try using.

  1. contour detection, once you have your contour draw the contour.
  2. use minEnclosingCircle to draw a circle over the detected contour.
  3. from the contour you can get the radius and x,y points

Edit: also object in the surrounding and smaller object can be filtered using ContourArea(). check for smaller contour and eliminate

this should work better than hough circle detection. best of luck

1
votes

As Junxx mention illumination invarient will work with most of the problem i have. like shadow,light etc. this may be useful for some one who look for this answer.