Lec 8
Lec 8
CS 6350
CV
HOUGH TRANSFORM
The problem:
c = -x'' m + y''
This is
Thi i a straight
t i ht line
li on a graph
h off c against
i t m as shown
h in
i
Figure below:
Each different line through the point (x', y') corresponds to one
of the points on the line in (m, c) space (termed as Hough space).
Now consider two pixels p and q in (x, y) space which lie on the
same line.
• For each pixel, all of the possible lines through it are represented
by
y a single
g line in (m,
( , c)) space.
p
• Thus the single line in (x, y) space which goes through both pixels
li on th
lies the iintersection
t ti off the
th two
t li
lines representing
ti p and
d q in
i (m,
( c))
space, as illustrated by Figure
c = -x'' m + y''
where, we now consider x' and y' to be constants, and m and c as
varying.
y g
Each different line through the point (x', y') corresponds to one
of the points on the line in (m, c) space (termed as Hough space).
Taking this one step further,
All pixels
i l which
hi h lie
li on the
th same line
li ini (x,
( y)) space are
represented by lines which all pass through a single point in
((m,, c)) space.
p
The single point through which they all pass gives the values of
m and
d c in
i the
th equation
ti off the
th line:
li y = m x + c.
p to detect straight
The steps g lines in an image:
g
3. For each pixel (x', y') which lies on some edge in the image, we
add
dd 1 to
t allll elements
l t off A(m,
A( c)) whose
h indices
i di m and
d c satisfy
ti f
y' = m x' + c.
For example,
example all of the pixels lying on the two dotted lines in
Figure below, will be recognized as lying on the same straight line. This
can be very useful when trying to detect lines with short breaks in them
due to noise, or when objects are partially occluded as shown below:
Drawback: The figure above clearly demonstrates one disadvantage
of the Hough transform method
method. It gives an infinite line as expressed by
the pair of m and c values, rather than a finite line segment with two well-
defined endpoints.
x cos + y sin =
< -- Construct an
R-table from here
Presence of noise
Features Votes
• Peak
P k gets
t fuzzy
f and
d hard
h d to
t locate
l t
Random Noise
Features Votes
Parameter
Space
In the Hough transform, feature points vote for all
possibilities through that point. This can cause
unwanted
t d clutter
l tt in
i the
th accumulator
l t and
d produce
d false
f l
matches/alarms (take large gradient edges only).
?
Hough Transform for Parametric Curves
The Hough transform is not restricted to detecting
straight lines, though that is a common use. The Hough
transform can be used to detect other type of curves in an
image as well as straight lines. Other geometrical shapes
that can be described with a few parameters are also well
suited to it.
it
The Hough transform can be used to detect other type of
curves in an image as well as straight lines.
lines
For example, if we wish to find circles, with equation:
(x - a)2 + (y - b)2 = R2
Then,
A circle is specified with three parameters:
the X and Y coordinates of its centre (a & b), and R, its
radius.
radius
To find circles using a Hough transform, you need a
three-dimensional accumulator array.
array Each Point in 2-D
space yields (in 3-D Hough space) a: CONE
Each edge element votes for all the circles that it could lie on,
and the 3-D array is searched for peaks that give circle positions and
radii.
dii If you happen
h to
t know
k the
th radius
di ini advance,
d you onlyl needd a 2-D
2D
accumulator.
Then,
Every point in (x, y) space corresponds to a
s rface in (a,
surface (a b,
b r) space ((we
e can vary
ar an
any ttwo
o of the
parameters a, b and r, the third is determined by the
equation
q of the circle).
)
All p
points in it,, which satisfy
y the equation
q for a circle,, are
incremented.
Use of Gradient information at each p
pixel (edge),
( g ), converts the
problem to a 2-D problem (1-D search).
Th Conical
The C i l surface
f in
i Hough
H h space gets
t transformed
t f d to
t a:
LINE
Use of Gradient information at each pixel (edge), converts the
problem to a 2-D
2 D problem (1-D
(1 D search).
LINE
r(θ)
More complicated shapes can be found - a general ellipse, for
example needs a 5-D parameter space
example, space.
G ((X,, C)) = 0
The p
problem of finding
g the object
j (
(described with a
model) in the image can be solved by finding the model's
position in the image.
^[1]
[ ] D.H. Ballard,, "Generalizing
g the Hough
g Transform to
Detect Arbitrary Shapes", Pattern Recognition, Vol.13, No.2,
p.111-122, 1981.
Generalized
Ge e a ed Hough
oug ttransform
a s o
• We want to find a shape
p defined byy its
boundary points and a reference point
• For every boundary point p, we can compute
the displacement vector:
r = a – p as a
function of
gradient orientation θ a
θ r(θ)
( )
R-table
R table may have
p
multiple entries for each
• For model shape: construct a R-table storing displacement
vectors
t r as function
f ti off gradient di ti
di t direction
• Detection: For each edge point p with gradient orientation θ:
– Retrieve all r indexed with θ
– For each r(θ), put a vote in the Hough space at p + r(θ)
where a = (xa, ya) denotes a reference origin for the shape, the shape's
orientation, and “s” is a scalar scalingg factor.
Hough transform: +ves
• All points are processed
independently, so can cope with
occlusion
l i
• Can
C detect
d t t multiple
lti l instances
i t off a
model in a single
g p pass
Hough transform: -ves
ves
• Complexity of search time increases
p y with the number of model
exponentially
parameters