4
votes

I am trying to detect images of CDs from a database of images. I figured that I would be able to use a Circle Hough Transform on each image, and select ones which contain concentric circles with a similar centre.

I have tried using the HoughCircles method in EMGU, which works fine if the circles are not in the centre of the outer circle, but does not work if they are. Is this a limitation of the Hough Transform itself, or is it just a problem with the minDist limit of the implementation?

Using the following parameters (I have fiddled extensively) on the following 2 images:

Gray cannyThresh = new Gray(180);
Gray accumulatorThresh = new Gray(300);
int dp = 3;
double minDist = 0.0000001 //Ideally higher, but ok for illustrating this point

CircleF[] circles = gray.HoughCircles(cannyThresh, accumulatorThresh, dp, minDist, 0, 0)[0]

Offset inner circle (works fine):

offset inner circle

Central inner circle (fails to detect outer circle properly, presumably because of the closeness of the centre to the inner circle?)

central inner circle

Is there anything I can do to detect circles whether or not they share a similar centre?

4

4 Answers

3
votes

For others coming here via Google to find a way to detect concentric circles with OpenCV: It seems that the OpenCV Hough Circle detection isn't able to do this. At least according to a passage in the book "Learning OpenCV: Computer Vision with the OpenCV Library"

Finally, because centers are considered in ascending order of their associated accumulator value and because new centers are not kept if they are too close to previously accepted centers, there is a bias to keeping the larger circles when multiple circles are concentric or approximately concentric.

This implementation details seems to be have been chosen for performance reasons.

1
votes

You should do edge detection first. Then you will end up with two thin circles, instead of a big black tube. These circles will be found easily.

1
votes

Okay this could be a rough and ready way to make this work (then figure out the 'why' later on).

Assuming the circles are not touching:

  1. Perform edge detection on them. (if you already have, then just check the edgemap image once, to ascertain that circles are not touching)

  2. Perform the Hough Circle detection. Store the centers and radii of detected circles

  3. Do Connected Component (CoCo) finding on the edge image.

  4. For each such component detected, check if its center is close to one of the detected Hough circles. Basically check if the component has a corresponding detected Hough Circle. It need not match exactly.

    So we can basically avoid parameter-fiddling with the Hough transform. Obviously, the connected component will correspond to the exact location of the CD.

0
votes

An algorithm for the detection of multiple concentric circles proposes a method.

My free interpretation is the following:

  • Get a binary image of edges, probably Canny is good enough
  • Find connected components
  • Within each connected components, select 3 points randomly (but put some constraints on the minimum distance between these points) and use them to generate a circle. Compute several circle, by going through all the connected components and, within each connected component, selecting randomly several sets of 3 points.
  • Additionally, you can discard connected components that do not give consistent radii
  • All these circles will vote for a center, those votes should be concentrated in the effective center of the image.
  • Go back to the circles generated by the connected components, and validate the connected components that generate circles consistent with the found circle center. Merge validated connected components that have generated circles with the same radius.