Exam card
- Problem: edges are local. They don’t say which pixels belong to the same line, or whether a line exists despite gaps, noise or occlusion.
- y = mx + c fails for vertical lines (infinite slope). Use polar form x cosθ + y sinθ = d: d = perpendicular distance from the origin, θ = angle of that perpendicular to the x-axis.
- Core idea: image space → parameter space. One point → one sinusoid. Points on the same line → curves that intersect at that line’s (d, θ).
- Accumulator A(d, θ): a 2-D array of vote counts. Each edge pixel votes for every (d, θ) line through it; a peak = a likely line.
- Steps: edge pixels → coordinates → sinusoids → vote → peak → (d, θ) → draw the line. Real images: use a threshold A ≥ T (not universal).
- Extensions: circles (a, b, r: a 3-D accumulator) · probabilistic Hough (random subset, faster, gives segments).
Key diagram
Key terms
What this topic covers
- The problem
- Why polar form instead of y = mx + c
- The Hough accumulator and voting
- Finding peaks in real images
- Extensions
Deep summary
Everything here follows the Topic 6 slides; each part shows its slide numbers. Parts marked added are study aids we wrote, not lecture content.
1 · The problem: local edges, global shapes Topic 6 · slides 3–6
An edge detector tells us where significant intensity changes occur, which pixels probably belong to object boundaries, and where the image has local structure (slide 3; slide 4 shows a car and its edge map).
What edges don’t say (slide 5): whether several edge pixels belong to the same line; whether a set of them forms a common geometric structure; whether a line is present despite gaps, noise or partial occlusion; whether an incomplete boundary belongs to a circle.
So the question of the topic (slide 6): “How can we identify a global geometric structure from a collection of local edge points?”
2 · Three points, and why y = mx + c breaks Topic 6 · slides 7–9
Slide 7 gives three edge pixels P1 (1, 2), P2 (2, 3), P3 (3, 4). Step by step (slide 8): 1. slope m = (3 − 2)/(2 − 1) = 1. 2. intercept c = y − mx = 2 − 1 = 1. 3. check P3: 3 + 1 = 4 ✓. So all three lie on y = x + 1. Observation: they share one line. But through any single point, infinitely many lines pass (the grey dashed ones).
y = mx + c has two degrees of freedom (m and c); two points pin them down (slide 9). Now take x = 1: it is vertical, so the slope is infinite and there is no y-intercept. Slope–intercept form cannot write this line, and m has no upper limit. That is the “infinite slope problem” that slide 10 sets out to avoid.
3 · Polar form: d and θ, worked for two lines Topic 6 · slides 10–12
To avoid the infinite slope, describe a line by its perpendicular distance d from the origin and the angle θ that perpendicular makes with the x-axis (slide 10): x cosθ + y sinθ = d. Both stay finite for every line, vertical ones included.
x = 3 (slide 12): the perpendicular from O runs along the x-axis, so θ = 0° and d = 3. Check: x·cos0° + y·sin0° = x = 3 ✓.
y = x + 1: 1. move everything to one side: −x + y = 1. 2. divide by √((−1)² + 1²) = √2: −0.707x + 0.707y = 0.707. 3. match cosθ = −0.707, sinθ = 0.707 → θ = 135°, d = 1/√2 ≈ 0.71. The perpendicular points up-left to (−0.5, 0.5), which is 0.71 from O.
Slide 11 writes the form as x cosθ − y sinθ = d (image rows grow downwards in its picture); slides 13 and 21 use + y sinθ, which we follow here.
4 · Image space → parameter space: one point, one sinusoid Topic 6 · slides 13–16
The core idea (slide 13): convert image space into parameter space (d, θ). For a fixed point (x0, y0), every line through it satisfies x0 cosθ + y0 sinθ = d. Letting θ run gives one curve, a sinusoid (slides 14–15).
Worked for slide 7’s points at θ = 0°, 45°, 90°, 135°: P1 (1, 2) → d = 1, 2.12, 2, 0.71. P2 (2, 3) → 2, 3.54, 3, 0.71. P3 (3, 4) → 3, 4.95, 4, 0.71. At θ = 0°–90° the three values differ; at θ = 135° they agree.
So the three curves intersect at (d, θ) = (0.71, 135°), which is exactly the polar form of y = x + 1 from part 3. That is slide 16: points on the same straight line give curves that meet at a common location in parameter space.
5 · The accumulator: counting votes instead of finding curves Topic 6 · slides 17–19
We know one point gives a sine curve and points on a line give curves that intersect, but it is infeasible to draw infinitely many curves and look for exact intersections (slide 17).
Instead keep an accumulator: a 2-D array A(d, θ) that records how many edge points support each (d, θ) combination, the number of votes it has received (slide 18). Voting (slide 19): each edge pixel casts votes; each vote stands for one line through that pixel; combinations with many votes are likely real lines.
Worked with P1–P3 and 4 angles: 3 points × 4 angles = 12 votes. Nine (d, θ) cells get 1 vote each; the cell (0.71, 135°) gets 3. The peak is the line y = x + 1.
added In practice d is also cut into bins (e.g. whole numbers), so near-equal d values share a cell.
6 · The slide example, step by step Topic 6 · slides 20–24
Slide 20: a 5 × 5 binary edge image, 1 = edge pixel, 0 = background, with edges at (1,1), (2,2), (3,3), (4,4). Use x cosθ + y sinθ = d with θ = 0°, 45°, 90°, 135° (slide 21; real systems use a much finer angle step).
Step by step (slides 22–24): 1. take the edge pixels and their coordinates. 2. for each pixel and each θ compute d: (2,2) at 45° → 2(0.707) + 2(0.707) = 2.83; (2,2) at 135° → 2(−0.707) + 2(0.707) = 0. 3. vote: 16 votes in all. 4. find the peak: d = 0 at 135° for all four pixels, so A(0, 135°) = 4; every other cell has 1. 5. retrieve (d, θ) = (0, 135°). 6. rebuild the line (slide 23): −0.707x + 0.707y = 0 → y = x, the diagonal through every edge pixel.
Slide 24 lists the same seven steps: edge pixels → coordinates → sinusoids → vote → peak → (d, θ) → line in image space.
7 · Reading peaks: max(A) and the threshold T Topic 6 · slides 25–28
The accumulator is a matrix of vote counts and max(A) is the strongest line candidate (slide 25). In slide 25’s A, the single 3 (row 3, column 4) wins; every other cell holds 0 or 1.
Real images are not that clean: noise, multiple lines, broken edges, nearby lines and false edges all add or split votes (slide 26). So set a minimum threshold T and keep every cell with A(d, θ) ≥ T as a candidate line (slide 27). On slide 25’s A: T = 1 keeps 5 cells, T = 2 keeps only the 3, T = 4 keeps nothing. T is not universally appropriate: too low gives false lines, too high misses real ones.
Extensions (slide 28): extending the transformation to circles, and the Probabilistic Hough Transformation. The slides only name these.
8 · Exam traps Topic 6 · slides 9–13, 16, 18, 25, 27 added
- Why polar? Because y = mx + c cannot hold a vertical line (infinite slope), not because polar is “more accurate” (slides 9–10).
- d and θ are about the perpendicular from the origin to the line, not the line’s own slope angle (slide 10). x = 3 has θ = 0°, not 90°.
- Sign convention: slide 11 has x cosθ − y sinθ = d; slides 13 and 21 use + y sinθ. Pick one and keep it for the whole answer.
- One point → one curve (all lines through it); one line → one point (d, θ) where the curves meet (slides 13, 16).
- A(d, θ) holds vote counts, not pixel intensities (slide 18). The answer is the (d, θ) of the peak, then turned back into a line.
- Threshold T is a minimum vote count, A ≥ T, and no single T suits every image (slide 27).
9 · Quick check Topic 6 · slides 12–13, 21, 25 added
Q1. Give θ and d for the line y = 4.
Q2. Point (3, 3): what is d at θ = 45°?
Q3. An accumulator has values 0, 2, 5, 1, 4, 2. With T = 3, how many candidate lines?
Exam questions · 15 Practise these 15
Q1What problem does the Hough transform solve that an edge detector does not?
Q2Why does the Hough transform use the polar representation of a line? Give the polar form of x = 3 and y = x + 1.
Q3Explain the mapping from image space to parameter space and why points on a line meet at one point.
Q4Given edge pixels (1,1), (2,2), (3,3), (4,4) and θ ∈ {0°, 45°, 90°, 135°}, use a Hough accumulator to find the line.
Q5What is the Hough accumulator? How are peaks chosen in real images, and what extensions exist?
Q6Calculate · For the edge point (2, 1), compute d = x cosθ + y sinθ at θ = 0°, 45°, 90° and 135°.
Q7Apply · Rebuild the image-space line from each accumulator peak: (a) θ = 0°, d = 4 (b) θ = 90°, d = 2 (c) θ = 45°, d = 1.41.
Q8Calculate · Edge pixels (2, 0), (2, 1) and (2, 3). Using θ = 0°, 45°, 90°, 135°, fill the d table, find the accumulator peak and the line.
Q9Explain · Explain the problem with slope–intercept form for the line x = 1, and how the polar representation removes it.
Q10Classify · Image space or parameter space? (a) an edge pixel (x, y) (b) the sinusoid traced by one point (c) the line y = x (d) a peak in the accumulator (e) a (d, θ) pair (f) the gaps in a broken edge.
Q11Outline · These steps are shuffled: find the peak; transform each coordinate into a sinusoid; obtain edge pixels; reconstruct the line; extract coordinates; retrieve (d, θ); let the curves vote. Put them in order.
Q12Calculate · An accumulator is A = (0, 2, 1 / 4, 0, 3 / 1, 5, 0). What is the strongest candidate? How many candidate lines are there with T = 3, and with T = 5?
Q13Explain · Explain why the Hough transform uses an accumulator of votes rather than searching for the exact intersections of the curves, and what the angle step on slide 21 has to do with it.
Q14Describe · Describe why picking just max(A) is not enough on real images, and how the threshold T is used.
Q15Compare · Compare what an edge detector gives you with what the Hough transform gives you. Why do you need both?
Quick MCQs · 14 MCQs in Practise
Not the exam format: quick checks that you understood the topic. Choose 1 or all that apply, then Check.