0% found this document useful (0 votes)
15 views79 pages

Lect09 HoughTransform

The document discusses the Hough Transform, a method for detecting curves in images by utilizing a voting scheme in parameter space. It covers various aspects including line and circle detection, the impact of noise, and the generalized Hough Transform for arbitrary shapes. Additionally, it touches on homography and its applications in image stitching and panorama recognition.

Uploaded by

saadgondal203
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views79 pages

Lect09 HoughTransform

The document discusses the Hough Transform, a method for detecting curves in images by utilizing a voting scheme in parameter space. It covers various aspects including line and circle detection, the impact of noise, and the generalized Hough Transform for arbitrary shapes. Additionally, it touches on homography and its applications in image stitching and panorama recognition.

Uploaded by

saadgondal203
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

Hough Transform

Outline
• Hough transform
• RANSAC - Random Sample Consensus
• Homography

Some slides from Lazebnik


Voting schemes
• Let each feature vote for all the models that
are compatible with it
• Hopefully the noise features will not vote
consistently for any single model
• Missing data doesn’t matter as long as there
are enough features remaining to agree on a
good model
The Hough Transform
• A powerful method for detecting curves from
boundary information.
• Exploits the duality between points on a curve
and parameters of the curve.
• Can detect analytic as well as non-analytic
curves
Hough transform
• An early type of voting scheme
• General outline:
– Discretize parameter space into bins
– For each feature point in the image, put a vote in every bin in
the parameter space that could have generated this point
– Find bins that have the most votes

Image space Hough parameter space

P.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf.
High Energy Accelerators and Instrumentation, 1959
Parameter space representation
• A line in the image corresponds to a point in
Hough space
Image space Hough parameter space

c
Parameter space representation
• What does a point (x0, y0) in the image space
map to in the Hough space?

Image space Hough parameter space


c
Parameter space representation
• What does a point (x0, y0) in the image space
map to in the Hough space?
– Answer: the solutions of c = –x0m + y0
– This is a line in Hough space
Image space Hough parameter space
c

c
Parameter space representation
• Where is the line that contains both (x0, y0)
and (x1, y1)?

Image space Hough parameter space

c
(x1, y1)

(x0, y0)

b = –x1m + y1
Parameter space representation
• Where is the line that contains both (x0, y0)
and (x1, y1)?
– It is the intersection of the lines c = –x0m + y0 and
c= –x1m + y1

Image space Hough parameter space

c
(x1, y1)
c
(x0, y0)

cb = –x m + y
1 1
Parameter space representation
• Problems with the (m,c) space:
– Unbounded parameter domain
– Vertical lines require infinite m
• Alternative: polar representation

Each point will add a sinusoid in the (,) parameter space


Hough Transform for Line Detection
• Pseudocode
Hough Transform for Line Detection
(detailed Pseudocode)
Hough Transform for Line Detection
(detailed Pseudocode)
Improvement
Extension: Incorporating image gradients

• Recall: when we detect an


edge point, we also know its
gradient direction
• But this means that the line
is uniquely determined!

• Modified Hough transform:

• For each edge point (x,y)


θ = gradient orientation at (x,y)
r = x cos θ + y sin θ
H(θ, r) = H(θ, r) + 1
end
Basic illustration

features votes
Other shapes
Square Circle
Several lines
Effect of noise

features votes
Effect of noise

features votes

• Peak gets fuzzy and hard to locate


Effect of noise
• Number of votes for a line of 20 points with
increasing noise:
Random points

features votes

• Uniform noise can lead to spurious peaks in the


array
Random points
• As the level of uniform noise increases, the
maximum number of votes increases too:
Hough transform: Pros
• Can deal with non-locality and occlusion
• Can detect multiple instances of a model in a
single pass
• Some robustness to noise: noise points
unlikely to contribute consistently to any
single bin
Hough transform: Cons
• Complexity of search time increases
exponentially with the number of model
parameters
• Non-target shapes can produce spurious
peaks in parameter space
• It’s hard to pick a good grid size
Results
Results
Results
Hough transform for circles
• How many dimensions will the parameter
space have?
• Given an oriented edge point, what are all
possible bins that it can vote for?
Hough Transform for Circle Detection
Questions
Generalized Hough transform
• We want to find a shape defined by its boundary
points and a reference point

D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern


Recognition 13(2), 1981, pp. 111-122.
Generalized Hough transform
• We want to find a shape defined by 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 θ

θ r(θ)
p

D. Ballard, Generalizing the Hough Transform to Detect Arbitrary Shapes, Pattern


Recognition 13(2), 1981, pp. 111-122.
Generalized Hough transform
• For model shape: construct a table indexed by
θ storing displacement vectors r as function of
gradient 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(θ)
• Peak in this Hough space is reference point
with most supporting edges
• Assumption: translation is the only
transformation here, i.e., orientation and scale
are fixed

Source: K. Grauman
Example

model shape
Example

displacement vectors for model points


Example

range of voting locations for test point


Example

range of voting locations for test point


Example

votes for points with θ =


Example

displacement vectors for model points


Example

range of voting locations for test point


Example

votes for points with θ =


Application in recognition
• Instead of indexing displacements by gradient
orientation, index by “visual codeword”

visual codeword with


displacement vectors
training image

B. Leibe, A. Leonardis, and B. Schiele, Combined Object Categorization and Segmentation


with an Implicit Shape Model, ECCV Workshop on Statistical Learning in Computer Vision
2004
Application in recognition
• Instead of indexing displacements by gradient
orientation, index by “visual codeword”

test image

B. Leibe, A. Leonardis, and B. Schiele, Combined Object Categorization and Segmentation


with an Implicit Shape Model, ECCV Workshop on Statistical Learning in Computer Vision
2004
Questions
Questions
Homography
• The transformation between two views of a planar
surface

The transformation between images from two cameras


that share the same center
Fitting a homography
• Recall: homogenenous coordinates

Converting to homogenenous Converting from homogenenous


image coordinates image coordinates
Fitting a homography
• Recall: homogenenous coordinates

Converting to homogenenous Converting from homogenenous


image coordinates image coordinates

• Equation for homography:


 x   h11 h12 h13   x 
   
  y   h21 h22  
h23   y  
 1  h31 h32 h33   1 
Fitting a homography
• Equation for homography:
 xi   h11 h12 h13   xi  h1T 
 T
  yi   h21 h22 h23   yi   xi  H x i  h 2  x i
 1  h31 h32 h33   1  hT3 
 
9 entries, 8 degrees of freedom
(scale is arbitrary)  yi hT3 x i  hT2 x i 
 T 
xi  H xi  0 xi  H x i   h1 x i  xi h 3 x i 
T

 xi hT2 x i  yi h1T x i 


 
 0T  xTi yi xTi  h1 
 T T
 
 xi 0T  xi x i  h 2   0 3 equations, only 2 linearly
 yi xTi xi xTi 0T  h 3 
independent

Direct linear transform
0T x1T  y1 x1T 
 T T 
x1 0T
 x1 x1  h1 
 
    h 2   0 Ah  0
 T T 
0 x n  yn x n  h 3 
T

 xT 0T  xn xTn 
 n
• H has 8 degrees of freedom (9 parameters, but scale is
arbitrary)
• One match gives us two linearly independent equations
• Four matches needed for a minimal solution (null space of
8x9 matrix)
• More than four: homogeneous least squares
Application: Panorama stitching
Recognizing panoramas
• Given contents of a camera memory card, automatically figure
out which pictures go together and stitch them together into
panoramas

M. Brown and D. Lowe, “Recognizing Panoramas,” ICCV 2003.


http://www.cs.ubc.ca/~mbrown/panorama/panorama.html

You might also like