Hough Tranform - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

Hough Tranform

Description:

Given a set of collinear edge points, each of them have associated a line in parameter space. ... the count, the more edges are collinear in the image space. ... – PowerPoint PPT presentation

Number of Views:122
Avg rating:3.0/5.0
Slides: 35
Provided by: hit4
Category:

less

Transcript and Presenter's Notes

Title: Hough Tranform


1
Hough Tranform
Lecture 12
2
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

3
Line detection
  • Mathematical model of a line

Y mx n
Y1m x1n
Y2m x2n
P(x1,y1)
P(x2,y2)
YNm xNn
4
Image and Parameter Spaces
Y mx n
Image Space
Line in Img. Space Point in Param. Space
5
Image space
Fix (m,n), Vary (x,y) - Line
Y mx n
Fix (x1,y1), Vary (m,n) Lines thru a Point
Y1m x1n
P(x1,y1)
6
Parameter space
Y1m x1n
Can be re-written as
n -x1 m Y1
Fix (-x1,y1), Vary (m,n) - Line
n -x1 m Y1
7
Img-Param Spaces
  • Image Space
  • Lines
  • Points
  • Collinear points
  • Parameter Space
  • Points
  • Lines
  • Intersecting lines

8
Hough Transform Technique
  • Given an edge point, there is an infinite number
    of lines passing through it (Vary m and
    n).
  • These lines can be represented as a line in
    parameter space.

9
Hough Transform Technique
  • Given a set of collinear edge points, each of
    them have associated a line in parameter space.
  • These lines intersect at the point (m,n)
    corresponding to the parameters of the line in
    the image space.

10
n (-x1) m y1
y
n (-x2) m y2
p
q
P(x1,y1)
Q(x2,y2)
x
11
Hough Transform Technique
  • At each point of the (discrete) parameter space,
    count how many lines pass through it.
  • Use an array of counters
  • Can be thought as a parameter image
  • The higher the count, the more edges are
    collinear in the image space.
  • Find a peak in the counter array
  • This is a bright point in the parameter image
  • It can be found by thresholding

12
Practical Issues
  • The slope of the line is -?ltmlt?
  • The parameter space is INFINITE
  • The representation y mx n does not express
    lines of the form x k

13
Solution
Y mx n
? x cos?y sin?
? - Is the line orientation
? - Is the distance between the origin and the
line
?
?
14
New Parameter Space
  • Use the parameter space (?, ?)
  • The new space is FINITE
  • 0 lt ? lt D , where D is the image diagonal.
  • 0 lt ? lt ?
  • The new space can represent all lines
  • Y k is represented with ? k, ?90
  • X k is represented with ? k, ?0

15
Consequence
  • A Point in Image Space is now represented as a
    SINUSOID
  • (x,y) ? ? x cos?y sin?

16
Image space
Votes Horizontal axis is ?, vertical is ?.
17
Image space
votes
18
(No Transcript)
19
  • Basic Hough transform algorithm
  • Initialize Hd, ?0
  • For each edge point Ix,y in the image
  • for ? 0 to 180
  • Hd, ? 1
  • Find the value(s) of (d, ?) where Hd, ? is
    maximum
  • The detected line in the image is given by

20
Hough Transform Algorithm
  • Input edge image (E(i,j)1 for edgels)
  • Discretize ? and ? in increments of d? and d?.
    Let A(R,T) be an array of integer accumulators,
    initialized to 0.
  • For each pixel E(i,j)1 and h1,2,T do
  • ? i cos(h d? ) j sin(h d? )
  • Find closest integer k corresponding to r
  • Increment counter A(h,k) by one
  • Find local maxima in A(R,T)

21
Hough Transform Speed Up
  • If we know the orientation of the edge usually
    available from the edge detection step
  • We fix ? in the parameter space and increment
    only one counter!
  • For each pixel E(i,j)1 compute
  • ? i cos(? ) j sin(? )
  • Find closest integer k corresponding
    to r
  • Increment counter A(h,k) by one

22
  • Extension
  • give more votes for stronger edges

Difficulties how big should the cells be? (too
big, and we merge quite different lines too
small, and noise causes lines to be missed)
23
Image Transforms - Hough Transform
24
Real World Example
Original
Found Lines
Edge Detection
Parameter Space
25
????? ?????
????? ????? ???????
???? ?????? ?????? ?? ??????
26
Finding Circles by Hough Transform
Equation of Circle
If radius is known
(2D Hough Space)
Accumulator Array
27
Finding Circles by Hough Transform
Equation of Circle
If radius is not known 3D Hough Space! Use
Accumulator array
28
Using Gradient Information
  • Gradient information can save lot of
    computation

Edge Location Edge Direction
Assume radius is known
Need to increment only one point in Accumulator!!
29
Finding Coins
Original
Edges (note noise)
30
Finding Coins (Continued)
Penny
Quarters
31
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
32
Hough 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!

33
Generalizing the H.T.
The H.T. can be used even if the curve has not a
simple analytic form!
  1. Pick a reference point (xc,yc)
  2. For i 1,,n
  3. Draw segment to Pi on the boundary.
  4. Measure its length ri, and its orientation ai.
  5. Write the coordinates of (xc,yc) as a function of
    ri and ai
  6. Record the gradient orientation fi at Pi.
  7. Build a table with the data, indexed by fi .

xc xi ricos(ai)
yc yi risin(ai)
34
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.
Write a Comment
User Comments (0)
About PowerShow.com