Generaliz Generaliz ed Hough ed Hough Transform Transform
Jan 13, 2016
Generalized Generalized Hough Hough
TransformTransform
The Generalized Hough Transform
From Standard to Generalized From Standard to Generalized HTHT
1.1.Standard Hough Transform Standard Hough Transform requires parametric requires parametric representation for desired representation for desired curvecurve
2.2.This idea is generalized in This idea is generalized in the Generalized Hough the Generalized Hough TransformTransform
Example: Human Face Example: Human Face recognitionrecognition
• Is there some attribute of the structure of the head that we can exploit to help estimate pose estimation?
• Is this attribute invariant under change in pose?
– Or • “Can we model how this attribute varies with
pose?”
Hough Transform in General1. Technique to isolate curves of a
given shape in an image
2. Standard Hough Transform (HT) uses parametric formulation of curves
3. Generalized Hough Transform (GHT) extends for arbitrary curves
1. When we compute the correlation by voting, we spend most of the time casting bad votes.
2. Idea is to use extra shape information (e.g. gradientsgradients) to cast fewer votes:1. O(n) complexity: For each of O(n) points on the
boundary, cast O(1) votes.
Key Idea to improve Key Idea to improve correlation by votingcorrelation by voting
General Hough Algorithm IdeaGeneral Hough Algorithm Idea
• 1. explicitly list points on shape• 2. make table for all edge pixels for target• 3. for each pixel store its position relative to some
reference point on the shape– ‘if I’m pixel i on the boundary, the reference point is at ref[i]’
The Generalized Hough TransformThe Generalized Hough Transform
1.Technique to find arbitrary curves in a given image
2.Parametric equation no longer required
3.Look-up table used as transform mechanism
4.Two phases:
1.R-Table Generation phase
2.Object Detection phase
1. Standard Techniques allow for invariance to scale and rotation in the plane
2. In general, objects in the real world are 3-dimensional
3. Hence a single silhouette provides no invariance to pose (i.e. rotation out of the plane).
4. No pose estimation.
5. This is generalized to Surface Normal Hough Transform
The Generalized Hough TransformThe Generalized Hough Transform
Building the Building the R-Table R-Table in GHTin GHT
GHT: Building the R-TableGHT: Building the R-Table1. We are given the shape we want to localize
2. We build a lookup table for this shape, called R-Table
It will replace the need for a parametric equation in the transform stage
GHT: Building the R-TableGHT: Building the R-Table
GHT: Building the R-TableGHT: Building the R-Table
GHT: Building the R-TableGHT: Building the R-TableGHT: Building the R-TableGHT: Building the R-Table
Object Object Localization in Localization in
the R-Table the R-Table in GHTin GHT
GHT: Object GHT: Object LocalizationLocalization
GHT: Object GHT: Object LocalizationLocalization
GHT: Object GHT: Object LocalizationLocalization
Conclusions on GHT1. Standard Techniques allow for
invariance to scale and rotation in the plane
2. In general, objects in the real world are 3-dimensional
3. Hence a single silhuette provides no invariance to pose (i.e. rotation out of the plane).
4. No pose estimation.
5. Now show more details
Conclusions on GHTConclusions on GHT
Generalized Generalized Hough Hough Transform Transform AlgorithmAlgorithm
Algorithm of the General Algorithm of the General Hough TransformHough Transform
Hough Transform for CurvesHough Transform for Curves
• The H.T. can be generalized to detect any curve that can be expressed in parametric form:– Y = f(x, a1,a2,…ap)– a1, a2, … ap are the parameters– The parameter space is p-dimensional– The accumulating array is LARGE!
Generalized Hough Generalized Hough TransformTransform
• Find all desired points in image• For each feature point
– for each pixel i on target boundary• get relative position of reference point from i
• add this offset to position of i
• increment that position in accumulator
• Find local maxima in accumulator• Map maxima back to image to view
algorithm
Generalizing the H.T.The H.T. can be used The H.T. can be used even if the curve has even if the curve has not a simple analytic form!not a simple analytic form!
1.1. Pick a reference point Pick a reference point (x(xcc,y,ycc))2.2. For i = 1,…,n :For i = 1,…,n :
1.1. Draw segment to PDraw segment to Pii on the on the boundary.boundary.
2.2. Measure its length rMeasure its length rii, and its , and its orientation orientation ii..
3.3. Write the coordinates of (xWrite the coordinates of (xcc,y,ycc) as a ) as a function of rfunction of rii and and ii
4.4. Record the gradient orientation Record the gradient orientation ii at at PPi.i.
3.3. Build a table with the data, Build a table with the data, indexed by indexed by ii . .
(x(xcc,y,ycc))
iirrii
PPii
ii
xxcc = x = xii + r + riicos(cos(ii))
yycc = y = yii + r + riisin(sin(ii))
Generalizing the H.T.
(x(xcc,y,ycc))
PPii
iirrii ii
xxcc = x = xii + r + riicos(cos(ii))
yycc = y = yii + r + riisin(sin(ii))
Suppose, there were m Suppose, there were m differentdifferent gradient orientations: gradient orientations:(m <= n)(m <= n)
11
22
..
..
..
mm
(r(r1111,,11
11),(r),(r1122,,11
22),…,(r),…,(r11n1n1,,11
n1n1))
(r(r2211,,22
11),(r),(r2222,,11
22),…,(r),…,(r22n2n2,,11
n2n2))
..
..
..
(r(rmm11,,mm
11),(r),(rmm22,,mm
22),…,),…,(r(rmm
nmnm,,mmnmnm))
jj
rrjj
jj
H.T. tableH.T. table
Generalized H.T. Algorithm:
xxcc = x = xii + r + riicos(cos(ii))
yycc = y = yii + r + riisin(sin(ii))
Finds a Finds a rotated, scaled, and translatedrotated, scaled, and translated version of the curve: version of the curve:
(x(x cc,y,y cc
))PP ii
ii
SrSr ii ii
PP jj
jj
SrSr jj jj
PP kk
ii
SrSr kk kk
1.1. Form an Form an A accumulator arrayA accumulator array of of
possible reference points (xpossible reference points (xcc,y,ycc), ),
scaling factor S and Rotation angle scaling factor S and Rotation angle ..
2.2. For each edge (x,y) in the image:For each edge (x,y) in the image:
1.1. Compute Compute (x,y)(x,y)
2.2. For each (r,For each (r,) corresponding to ) corresponding to
(x,y) do:(x,y) do:
1.1. For each S and For each S and ::
1.1. xxcc = x = xii + r( + r() S cos[) S cos[(() + ) +
]]
2.2. yycc = y = yii + r( + r() S sin[) S sin[(() + ) +
]]
3.3. A(xA(xcc,y,ycc,S,,S,) = ) = A(xc,yc,S,q) + 1A(xc,yc,S,q) + 1
3.3. Find maxima of A.Find maxima of A.
Another variant of the Generalized Another variant of the Generalized Hough TransformHough Transform
Find 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
ikr
),( cc yx ),,( iii yx
Generalize HT applied for circuits
Properties of Generalized Hough Transform
• What can we do when the curve we want to detect is not easily described parametrically?
1. ~ By this, we mean, it cannot be captured in a relatively small number of parameters.
2. ~ Recall, the dimensionality of the Hough space equal the number of parameters!
• The GHT constructs a parametric description of an arbitrary shape based on a learning process.
• This parametric description is not, in general, compact.
• We will begin by assuming the size, shape, and rotation (orientation) of the region is known a priori. (Or that we want only to detect instances of a given size and orientation.
1. ~ The voting space is (equivalent to) image space, 2D, in the case of known size and rotation.
2. ~ We will see how to deal with unknown orientation and size shortly -- with a 4D Hough space.
The list of ( , ) pairs, for a given and constitutesa partial characterization of the shape.
X1
X2
XR
1 2
3 4 5
r 1r 4r 5
XR
r j
j
: An arbitrary reference point inside the shape.
: The length of the j-th line from the reference point to the shape perimeter, intersecting at a point of tangent angle ø.: The angle of the (current) tangent(s) to the perimeter.
: The orientation of the j-th line segment.
jr j XR
• By sweeping the tangent angle (ø) over the range (0,2π) in some reasonable quantization (!), we build what is called the R-table (reference table) description of the shape.
1 :
2 :
k :
(r11,1
1 ); (r12 ,1
2 ); .... (r1n1 ,1
n1 );
(r21, 2
1 ); (r22 , 2
2 ); .... (r2n2 , 2
n2 );
(rk1, k
1 ); (rk2 , k
2 ); .... (rknk , k
nk );
• Each pixel x (say, a detected edge point) with local orientation ø provides evidence (votes for) reference points at the set of locations indicated by the list in the R-table for that tangent direction...
{ x1 r ( ) cos[ ( )], x 2 r ( ) sin[ ( )]}
• A vote is cast for each (r , ) pair in the list for that ø value.
The voting space is isomorphic to image space.
• Again, this assumes known size and orientation for all appearances of the shape.
• After all the edge points have voted for all of their possible reference points, we interrogate the voting space for significant local maxima. These suggest possible detections of the shape of interest.
• If we have not prenormalized for size (S) and rotation ( )
then our voting space is four dimensional and the reference location
receiving the vote(s) for a given edge point and R-table entry is:
x1R x1 r()Scos[ ( ) ]
x2R x2 r()Ssin[() ]
• Now, we interrogate the 4D accumulator array to recover likely locations,
scale, and orientation for appearances of the shape.
• This is really a fancy form of a template match -- but one that is far more
robust than a straightforward template matching algorithm.
• Selecting among multiple possible shapes requires multiple R-tables,
multiple voting spaces.
• But, so does looking for lines and circles in the same image....
Generalized HT in biologically Generalized HT in biologically motivated roboticsmotivated robotics
Bimodal Active Stereo
Many simultaneous problems in robotics
Research Philosophy
The main concept of Radon Transform
The main concept of Radon Transform
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
• Handling inaccurate edge locations:
• Increment Patch in Accumulator rather than a single point
H.T. Summary• H.T. is a “voting” scheme
– points vote for a set of parameters describing a line or curve.
• The more votes for a particular set– the more evidence that the corresponding curve is present
in the image.
• Can detect MULTIPLE curves in one shot.
• Computational cost increases with the number of parameters describing the curve.
end