Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Computer Vision and Image Processing

– Fundamentals and Applications

Hough Transform

n
ay
hu
.B
.K
M

Course Instructor: Dr. M.K. Bhuyan


Professor

Department of Electronics and Electrical Engineering,


Indian Institute of Technology Guwahati, India.
M
.K
.B
hu
ay
n
Line Grouping Problem

n
ay
hu
.B
.K
M
M
.K
.B
hu
ay
n
Hough Transform

• Elegant method for direct object recognition

• Edges need not be connected

• Complete object need not be visible

n
ay
• Key Idea: Edges VOTE for the possible model

hu
.B
.K
M
Image and Parameter Spaces

y = mx + c y
Equation of Line: y = mx + c
Find: (m, c)

Consider point: ( xi , yi ) ( xi , yi )

n
ay
hu
x

.B
.K
yi = mxi + c or c = − xi m + yi Image Space

M m
Parameter space also called Hough Space

(m, c)
c
Parameter Space
• Hough transform uses parametric representation of a
straight line for line detection.

y c

n
ay
y = mx + c

hu
.B
.K
M
(m, c)

x m
M
.K
.B
hu
ay
n
Line Detection by Hough Transform
y
Algorithm:

• Quantize Parameter Space (m, c)


(m, c)
• Create Accumulator Array A(m, c)
x

n
A(m, c) = 0 m, c

ay
• Set Parameter Space

hu
.B
.K
A(m, c)
M
• For each image edge ( xi , yi ) increment: 1 1
1 1
A(m, c) = A(m, c) + 1 1 1
2
• If ( m, c ) lies on the line: 1 1
1 1
c = − xi m + yi 1 1

• Find local maxima in A(m, c)


Group the edges that belong to each line by traversing each line.
Better Parameterization
Note: m and c are, in principle, unbounded: cannot handle all situations.

−  m  
Large Accumulator
Improvement: (Finite Accumulator Array Size)

• Instead of (m, c), we can consider (  ,  ) as the parameters


with  varying between -90o and 90o and p varying from

n
ay
hu
.B
for an M  N image.
.K
0 to M 2 + N2
M



y

( xi , yi )

n
ay
hu
x

.B
.K
Hough Space is Sinusoid Image Space

M 

Hough Space

ρ

n
ay
hu
.B
.K
M

Image space Votes θ

Note that most points in the vote array are very dark, because they
get only one vote.
n
ay
hu
.B
.K
M

Image Votes
space
M
.K
.B
hu
ay
n
n
ay
hu
.B
.K
M

Lots of noise can lead to large peaks in the array


Real World Example

n
ay
hu
.B
.K
M
Original Edge Found Lines
Detection

Parameter Space
Finding Circles by Hough Transform

Equation of Circle:

( xi − a) 2 + ( yi − b) 2 = r 2

If radius is known: (2D Hough Space)

n
ay
hu
.B
Accumulator Array A(a, b)
.K
M
Finding Circles by Hough Transform

Equation of Circle:

( xi − a) 2 + ( yi − b) 2 = r 2

n
ay
hu
.B
.K
M
If radius is not known: 3D Hough Space!
Use Accumulator array A(a, b, r )
Finding Coins

n
ay
hu
.B
.K
M
Generalized Hough Transform
• Model Shape NOT described by equation

n
ay
hu
.B
.K
M
Generalized Hough Transform
• Model Shape NOT described by equation

n
ay
hu
.B
.K
M
Generalized Hough Transform
Find Object Center ( xc , yc ) given edges ( xi , yi , i )
Create Accumulator Array A( xc , yc )
Initialize: A( xc , yc ) = 0 ( xc , yc )
( xi , yi , i )

n
For each edge point

ay
hu
.B
.K
rki
M
For each entry in table, compute:

xc = xi + rki cos ki
yc = yi + rki sin  ki
Increment Accumulator: A( xc , yc ) = A( xc , yc ) + 1
Find Local Maxima in A( xc , yc )
Scale and Rotation
Use accumulator array

n
ay
hu
.B
.K
M
Hough Transform: Comments

n
ay
hu
.B
.K
M

You might also like