Computer Vision

Document Sample

Digital Image Processing

Hough Transform for Object Recognition
Hough Transform
• Elegant method for direct object recognition

• Edges need not be connected

• Complete object need not be visible

• Key Idea: Edges VOTE for the possible model
Image and Parameter Spaces
y  mx  c          y
Equation of Line:                                       y  mx  c
Find:   (m, c)

Consider point:   ( xi , yi )                     ( xi , yi )
x
yi  mx i  c or c   xi m  yi               Image Space

m
Parameter space also called Hough Space

(m, c)
c
Parameter Space
Line Detection by Hough Transform
y
Algorithm:

• Quantize Parameter Space       (m, c)
(m, c)
• Create Accumulator Array      A(m, c)
x
• Set   A(m, c)  0 m, c                                Parameter Space
A(m, c)
• 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)
Better Parameterization
NOTE:       m                                       y
Large Accumulator                                   ( xi , yi )
More memory and computations

Improvement: (Finite Accumulator Array Size)
x
Line equation: w           x cos  y sin           Image Space

Here         0    2                         w
0  w  wm ax
Given points   ( xi , yi )   find   ( w, )                           ?

Hough Space Sinusoid
Hough Space

The basic idea
Each straight line in this
image can be described by
an equation

Each white point if
considered in isolation
could lie on an infinite
number of straight lines
The basic idea
Each straight line in this image
can be described by an equation

Each white point if considered in
isolation could lie on an infinite
number of straight lines

In the Hough transform each
point votes for every line it could
be on

The lines with the most votes win
How do we represent lines?
Any line can be represented by
two numbers
f

Here we will represent the       w
yellow line by (w,f)

In other words we define it
using
- a line from an agreed origin
- of length w
- at angle f to the horizontal
f
Hough space                            w

Since we can use (w,f) to
represent any line in the
image space

We can represent any line     f0
in the image space as a
point in the plane defined
by (w,f)

This is called Hough space
f180
w=0   w=100
How does a point in image space vote?

w  x cos(f ) y sin(f )

f                          f0

w

f180
w=0   w=100
How do multiple points prefer one line?
 One point in image space
corresponds to a sinusoidal
curve in image space

 Two points correspond to
two curves in Hough space

 The intersection of those two
curves has “two votes”.

 This intersection represents
the straight line in image
space that passes through
both points
Hough Transform
Create fand w for all possible lines
Create an array A indexed by fand w
for each point (x,y)
for each angle f
w = x*cos(f)+ y*sin(f)
A[f,w] = A[f,w]+1
end
end

where A > Threshold return a line
Image space
Votes

Horizontal axis is θ,
vertical is rho.
Image   votes
space
Mechanics of the Hough transform

 Difficulties                   How many lines?
 how big should the            Count the peaks in
cells be? (too big, and       the Hough array
we merge quite
 Treat adjacent peaks
different lines; too
as a single peak
small, and noise
causes lines to be         Which points belong
missed)                     to each line?
 Search for points
close to the line
 Solve again for line
and iterate
Real World Example

Original   Edge              Found Lines
Detection

Parameter Space
Another example

f

w
Finding Circles by Hough Transform
Equation of Circle:

( xi  a ) 2  ( yi  b) 2  r 2

If radius is known: (2D Hough Space)

Accumulator Array      A(a, b)
b

a
Hough Space
Finding Circles by Hough Transform

Equation of Circle:

( xi  a ) 2  ( yi  b) 2  r 2

If radius is not known: 3D Hough Space!
Use Accumulator array A(a, b, r )
Real World Circle Examples
Finding Coins
Original   Edges (note noise)
Finding Coins (Continued)

Penn           Quarters
y
Finding Coins (Continued)

Note that because
the quarters and
penny are different
sizes, a different
Hough transform
(with separate
accumulators) was
used for each circle
size.

Coin finding sample images
from: Vivek Kwatra
Hough Transform: Comments

• Works on Disconnected Edges

• Relatively insensitive to occlusion

• Effective for simple shapes (lines, circles, etc)

• Trade-off between work in Image Space and
Parameter Space

DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 7 posted: 3/24/2011 language: English pages: 25