Expand description
Hough transform: detecting lines and circles by voting.
Every edge pixel votes for all the shapes that could pass through it; shapes supported by many edge pixels collect many votes and show up as peaks in an accumulator array. This finds shapes even when the edge map has gaps or clutter.
- Lines use the normal form
ρ = x cos θ + y sin θ(withxthe column,ythe row),θ ∈ [0, π): each pixel votes for oneρperθ, tracing a sinusoid in(ρ, θ)space. All pixels of a line vote for the same(ρ, θ)cell. - Circles of a known radius: each pixel votes for every possible centre on the circle of that radius around it; a true circle’s pixels all vote for its centre.
See the book entry The Hough transform.
Structs§
- Hough
Circle - A detected circle.
- Hough
Line - A detected line: all points with
x cos θ + y sin θ = ρ. - Hough
Lines - The line-voting accumulator and its axes.
Functions§
- hough_
circles - Finds circles with the given candidate
radii(pixels). A centre is reported if its votes are at leastmin_supporttimes the circumference2πr(try 0.6), strongest first, with centres closer thanmin_distancepixels suppressed. - hough_
line_ peaks - Extracts up to
max_linespeaks with at leastmin_votesvotes, strongest first. After taking a peak, cells within±min_rho_binsand±min_theta_bins(wrapping acrossθ = 0 ≡ π, whereρchanges sign) are suppressed so one physical line gives one result. - hough_
lines - Convenience: the strongest lines in an edge map, with the default resolutions of one degree and
one pixel and mild suppression. Returns up to
max_lineslines with at leastmin_votesvotes. - hough_
transform - Builds the line accumulator for a binary edge map using
num_anglesangles over[0, π)and a distance resolution ofrho_resolutionpixels.