5.4 Generalized Hough Transform - cs.cmu.edu
Transcript of 5.4 Generalized Hough Transform - cs.cmu.edu
Generalized Hough Transform16-385 Computer Vision
Hough Circles
Finding Circles by Hough Transform
Equation of Circle:
222 )()( rbyax ii =−+−
If radius is known:
),( baAAccumulator Array
(2D Hough Space)
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
a
b
(x, y)
Image space Parameter space
(x� a)2 + (y � b)2 = r
2 (x� a)2 + (y � b)2 = r
2
parameters
variables
parameters
variables
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
a
b
(x, y)
(x� a)2 + (y � b)2 = r
2 (x� a)2 + (y � b)2 = r
2
parameters
variables
parameters
variables
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
a
b
(x� a)2 + (y � b)2 = r
2 (x� a)2 + (y � b)2 = r
2
parameters
variables
parameters
variables
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
(x� a)2 + (y � b)2 = r
2 (x� a)2 + (y � b)2 = r
2
a
b
parameters
variables
parameters
variables
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
a
b
(x� a)2 + (y � b)2 = r
2 (x� a)2 + (y � b)2 = r
2
parameters
variables
parameters
variables
Finding Circles by Hough Transform
Equation of Circle:
222 )()( rbyax ii =−+−
If radius is not known: 3D Hough Space!
Use Accumulator array ),,( rbaA
What is the surface in the hough space?
Finding Circles by Hough Transform
Equation of Circle:
222 )()( rbyax ii =−+−
If radius is not known: 3D Hough Space!
Use Accumulator array ),,( rbaA
What is the surface in the hough space?
Using Gradient InformationGradient information can save lot of computation:
Edge Location
Edge Direction
Need to increment only one point in accumulator!!
iφ),( ii yx
Assume radius is known:
φ
φ
sincosrybrxa
−=
−=
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
a
b
(x, y,�)
(x� a)2 + (y � b)2 = r
2 (x� a)2 + (y � b)2 = r
2
parameters
variables
parameters
variables
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
-5 -4 -3 -2 -1 0 1 2 3 4
-4
-3
-2
-1
1
2
3
4
a
b
(x, y,�)
(x� a)2 + (y � b)2 = r
2 (x� a)2 + (y � b)2 = r
2
parameters
variables
parameters
variables
Pennie Hough detector Quarter Hough detector
Pennie Hough detector Quarter Hough detector
Can you use Hough Transforms for other objects, beyond lines and circles?
Generalized Hough Transform
Generalized Hough TransformFind Object Center given edges
Create Accumulator Array
Initialize:
For each edge point
For each entry in table, compute:
Increment Accumulator:
Find Local Maxima in
),( cc yxA
),(0),( cccc yxyxA ∀=
),,( iii yx φ
1),(),( += cccc yxAyxA
),( cc yxA
ik
ikic
ik
ikic
ryy
rxx
α
α
sin
cos
+=
+=
),( cc yx ),,( iii yx φ
r̄ik
Do you have to use edge detectors to vote in Hough Space?
c
Template
A.Train phase:
1.Get features
2.Store all displacements of feature from center
B.Test phase:
1.Get features & lookup displacements
2.Vote for center location
Template
A.Train phase:
1.Get features
2.Store all displacements of feature from center
B.Test phase:
1.Get features & lookup displacements
2.Vote for center location
Test image
A.Train phase:
1.Get features
2.Store all displacements of feature from center
B.Test phase:
1.Get features & lookup displacements
2.Vote for center location
Application of Hough Transforms
Detecting shape features
F. Jurie and C. Schmid, Scale-invariant shape features for recognition of object categories, CVPR 2004
Original images
Laplacian circles Hough-like circles
Which feature detector is more consistent?
Robustness to scale and clutter
Object detection
training image
visual codeword withdisplacement vectors
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
Index displacements by “visual codeword”
1. get featuresTrain phase
2. store displacementsTrain phase
Test phase
The Hough transform …
Deals with occlusion well?
Detects multiple instances?
Robust to noise?
Good computational complexity?
Easy to set parameters?