1

I want to find circular objects in an image like enter image description here

In this image there are six different dishes that I want to recognize.

To do this, first I detect the edges with:

edges = cv2.Canny(img2, 150, 130)

enter image description here

Then I find circular patterns in this new image with the HoughCircles function of OpenCV:

circles = cv2.HoughCircles(edges, cv2.cv.CV_HOUGH_GRADIENT, 1, minDist,
          param1=80,
          param2=30,
          minRadius=minR,
          maxRadius=maxR)

where the parameters are set according to the image's size (473x355pixels). In particular I set minRadius = 50, maxRadius = 120 and minDist = 90.

However the result is:

enter image description here

How can I recognize correctly the dishes in this image? Why doesn't HoughCircles find evident circular patterns?

beaker
  • 16,331
  • 3
  • 32
  • 49
Davide Biraghi
  • 626
  • 1
  • 7
  • 17
  • circular objects are ellipses on perspective disortion. Maybe you'll need higher thresholds to not let the noise influence your circle, but then you might miss your plates because they are no perfect circles. – Micka Dec 19 '16 at 15:27
  • So I must have perfect circles? – Davide Biraghi Dec 19 '16 at 15:35
  • 1
    better would be to detect ellipses, but afaik openCV has no ellipse detection method. I would adjust my RANSAC version of circle detection, but it's c++ ... http://stackoverflow.com/a/20734263/2393191 I guess you would have to find 4 random samples in each iteration an fit an ellipse to them (cv::fitEllipse might work). – Micka Dec 19 '16 at 15:41
  • I think that set an higher thresholds should not be a solution. With higher thresholds I can only discard circles with "low-confidence" level, not find others.. – Davide Biraghi Dec 19 '16 at 16:05
  • right, but it could help to place the detections better at the actual plates. – Micka Dec 19 '16 at 16:12
  • 2
    You might try using perspectiveTransform() or something similar to warp the original image before using HoughCircles()... especially if all of the circles can be assumed to be in the same plane. – pjheink Dec 19 '16 at 19:43

0 Answers0