Quiz: the generalised Hough transform

Short questions to test your understanding. Try each on paper first, then open the answer. The R-table stores, for each gradient-direction bin, the vectors from the template’s edge points to its reference point.


Q1. What is stored in the R-table, and why is it indexed by the edge direction?

What does an edge point in a new image know about itself?

For each edge point of the template, the vector from the point to the reference point, filed under the point’s gradient direction. In a new image an edge point knows only its position and its direction; the direction narrows down where on the shape it can be, and so which vectors can lead to the reference point.


Q2. A direction bin of the R-table holds 20 vectors. An edge point of the scene falls into that bin. How many votes does it cast, and how many of them can be correct?

The point lies at one place on the shape.

20 votes, one per vector. If the point belongs to a copy of the shape, at most one of them (the vector of its own position on the boundary, or a few if several template points are very close) lands on the reference point; the others land elsewhere. Only the correct votes of many points pile up; the wrong ones spread out.


Q3. Why is the circle Hough transform with gradient voting and a known radius a special case of the generalised Hough transform?

Build the R-table of a disc with its centre as the reference point.

On a disc each gradient direction occurs at one point of the boundary, and from there the centre is at distance r along the gradient. So the R-table has one vector per direction, of length r along the direction; voting with it puts one vote at \mathbf p + r\mathbf u, which is exactly circle voting with a known radius and polarity.


Q4. The template is a key; in the scene the key is rotated by 60°. Without a rotation search it is not found. Why not?

Two things change under a rotation.

The gradient directions of the rotated key are all 60° larger, so its edge points look up the wrong bins; and even with the right bin, the stored vectors point in the unrotated directions. Its votes scatter instead of meeting. A rotation search shifts the bin index and rotates the vectors for each tried angle.


Q5. Searching 36 rotations and 5 scales: how much more work and memory than translation only?

One accumulator slice per pose.

36 \times 5 = 180 poses: 180 lookups per edge point instead of 1, and 180 accumulator slices instead of 1. That is why the search is done coarse to fine: all poses on a small image, then only the best ones at full resolution.


Q6. A third of a copy is hidden behind another object. Is it still found?

Which votes are lost?

Usually yes: the visible two thirds still vote for the same reference point, giving about two thirds of the full peak. It is found if that is above the threshold; the threshold works as a minimum visible fraction of the boundary.


Q7. Why can a shape that is merely similar to the template (say, a key with a longer shaft) be reported as a detection?

How many of its edge points vote correctly?

Large parts of its boundary coincide with the template’s after a shift: those points vote for (nearly) the same reference point and produce a peak that may reach a third or more of a full match. With a low threshold it is accepted. A higher threshold, or checking the whole outline afterwards, rejects it.


Q8. (math) Show that with a single direction bin the generalised Hough transform is the correlation of the scene’s edge map with the template’s edge map.

Write the votes at \mathbf c as a double sum and substitute \mathbf q = -\mathbf v.

With one bin, every edge point votes with every vector: H(\mathbf c) = \sum_{\mathbf x}\sum_{\mathbf v \in T} E(\mathbf x)[\mathbf x + \mathbf v = \mathbf c] = \sum_{\mathbf v \in T} E(\mathbf c - \mathbf v). With \mathbf q = -\mathbf v, the template edge points relative to the reference point: H(\mathbf c) = \sum_{\mathbf q} E(\mathbf c + \mathbf q)E_T(\mathbf q), the correlation of E with E_T. The direction bins restrict each sum to points of the same direction, which makes the match selective.