N.J
N.J

Reputation: 1230

How to detect circles accurately

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.

Upvotes: 2

Views: 3213

Answers (2)

user1823858
user1823858

Reputation: 71

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

Upvotes: 3

N.J
N.J

Reputation: 1230

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.

Upvotes: 1

Related Questions