Quiz: Hough transform for circles

Short questions to test your understanding. Try each on paper first, then open the answer. A circle is (x - a)^2 + (y - b)^2 = r^2 in pixel coordinates; the accumulator holds votes per (a, b, r), shown as the fraction of 2\pi r.


Q1. With a known radius r, for which centres does a single edge point vote?

Where can the centre of a circle of radius r through the point be?

For every centre at distance r from it: a ring of radius r around the edge point. The rings of all points on a true circle of radius r pass through its centre, which collects one vote per point.


Q2. The radius is unknown, between 5 and 40 pixels. What does the accumulator look like, and what does one edge point vote for?

One slice per radius.

A 3D accumulator (a, b, r): one (a, b) slice per radius, 36 slices. An edge point votes for a ring of radius r in slice r, for every r: a cone of votes. A circle is a 3D peak at its centre and radius.


Q3. How does the gradient direction reduce the number of votes? What is “polarity” and why does it matter?

In which direction is the centre seen from an edge point of a circle?

On a circle the gradient is radial, so the centre lies on the line through the point along the gradient, at distance r: only two candidate centres per radius instead of a ring of about 2\pi r. The polarity says whether the object is brighter than its surroundings (gradient points inward: centre at \mathbf p + r\mathbf u) or darker (outward: \mathbf p - r\mathbf u). If it is known, one vote per radius suffices; if it is wrong, every vote goes to the wrong side and nothing is found.


Q4. You run the circle Hough transform with radius 15 on discs of radius 12. What do you see in the accumulator slice?

Where do rings of radius 15 around points of a circle of radius 12 overlap?

No sharp peak. The rings of radius 15 around the points of a circle of radius 12 do not share a point; they overlap most along a ring of radius 15 - 12 = 3 around the true centre (and more weakly on a ring of radius 15 + 12 = 27). The slice shows bright small rings instead of peaks, and with a sensible threshold nothing is detected.


Q5. Why does an ellipse give a weak, smeared peak, or two false circles, instead of one sharp peak?

Where are the centres of the circles that best fit the different parts of an ellipse?

Each part of the ellipse is best fitted by a circle of a different radius and centre (its centre of curvature): small circles near the pointed ends, a large circle along the flat sides. The votes spread over these centres and radii, so no bin collects the whole boundary. With a low threshold, the strongly curved ends can each produce a separate false circle.


Q6. A plate has wells of one known radius. Why is that case much cheaper than detecting cells of unknown size?

How many slices does the accumulator need?

A known radius needs only one 2D slice instead of a stack of slices: the bins and the votes shrink by the number of radii. With gradient voting and known polarity each edge point casts exactly one vote.


Q7. (math) Show that with a known radius the circle Hough accumulator is the correlation of the binary edge map with a ring-shaped kernel.

Write the vote count at a centre \mathbf c as a sum over pixels.

The centre \mathbf c gets one vote from every edge pixel \mathbf p with \|\mathbf p - \mathbf c\| \approx r: H(\mathbf c) = \sum_{\mathbf p} E(\mathbf p)\,K(\mathbf p - \mathbf c) with K(\mathbf d) = 1 if |\|\mathbf d\| - r| < \tfrac12 and 0 otherwise. That is the correlation of E with the ring K; since K(\mathbf d) = K(-\mathbf d) it is also a convolution.


Q8. (math) Why does a general ellipse have five parameters, and how large is a full ellipse accumulator with 50 steps per parameter?

A conic Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0.

Six coefficients, defined only up to a common factor: 5 degrees of freedom (centre, two semi-axes, angle). A full accumulator has 50^5 = 312.5 million bins, far too many; that is why ellipses are found centre-first or by hypothesise-and-verify.