Transcript General
Hough Transform
1
Given marked edge pixels, find examples of specific
shapes
Line segments
Circles
Generalized shapes (GHT)
Basic idea - Patented 1962
Every edge pixel is a point that votes for all shapes that
pass through it.
Votes are collected in “parameter space” - look for peaks
“Parameter space” is a k-dimensional histogram!
Ellen L. Walker
Hough Transform for Lines
2
Parameter space:
(But A,B, C aren’t unique!)
Ax+By+C = 0
Divide by sqrt(A*A+B*B); first two terms are sin,cos of the
angle
Angle, distance from 0
Angle = arctan(A/B), distance = C/(A*A+B*B)
Given a point (x0,y0), find all theta, distance pairs
cos(theta)*x0 + sin(theta)*y0 + distance = 0
If theta is known (e.g. from Sobel detector), only 1
distance needs to be calculated, otherwise calculate a
distance for each theta
Ellen L. Walker
Hough Transform for Lines (cont.)
Increment all “cells” in p-space through which curve
passes
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
2
2
3
4
5 5
2
3
3
2
2
2
1
2
1
1
3
Ellen L. Walker
Hough Transform Example: Line Detecton
Image (enlarged)
4
Hough P-Space
Ellen L. Walker
Alternative Parametrization for Lines
5
Number border pixels of the image
For each line segment, store the two border pixels
where the (extended) line enters / exits the image
Why?
Values are integers in a fixed range
No trigonometry is needed to find all lines passing through
a point
Ellen L. Walker
Hough Transform for Circles
Parameter space is (centerx, centery, radius)
Update:
6
For every point, computer center, radius of all circles
passing through the point
Mark each center, radius pair
Alternative computation: for each cell, compute
distance from that cell to point - increment if close
enough.
Ellen L. Walker
GHT: Generalized Hough Transform
7
Parameters are translation, rotation & scale of a fixed
2D shape,represented as a point set
Given a point and a location in the transform space, if
the point is in (or close enough to a point in) the
transformed point set, then record a vote.
Ellen L. Walker
Hough Transform Issues
8
Space usage
Need large arrays for accurate results!
More complex objects need more parameters (fast!)
Peak detection
Large spaces take long to search - threshold unreliable
“Accidental peaks” are not unusual
Noise causes “cluster” rather than “peak” - may need to
use cluster detection (remember K-means?)
Easily parallelizable!!
Ellen L. Walker