Edge Detection - PowerPoint PPT Presentation

About This Presentation
Title:

Edge Detection

Description:

Computational Vision Edge Detection Canny Detector Line Detection Hough Transform Trucco: Chapter 4, pp. 76 80 Chapter 5, pp. 95 - 100 Computational Vision ... – PowerPoint PPT presentation

Number of Views:305
Avg rating:3.0/5.0
Slides: 83
Provided by: ioannis9
Category:

less

Transcript and Presenter's Notes

Title: Edge Detection


1
Computational Vision
  • Edge Detection
  • Canny Detector
  • Line Detection
  • Hough Transform
  • Trucco Chapter 4, pp. 76 80
  • Chapter 5, pp. 95 - 100

2
Finding Corners
3
What Is a Corner?
Large gradients in more than one direction.
4
Edges vs. Corners
  • Edges maxima in intensity gradient

5
Edges vs. Corners
  • Corners lots of variation in direction of
    gradient in a small neighborhood

6
Detecting Corners
  • How to detect this variation?

7
Detecting Corners
  • How to detect this variation?
  • Not enough to check average and

8
Detecting Corners
  • Claim the following covariance matrix summarizes
    the statistics of the gradientSummations
    over local neighborhoods

9
Detecting Corners
  • Examine behavior of C by testing its effect in
    simple cases
  • Case 1 Single edge in local neighborhood

10
Case1 Single Edge
  • Let (a,b) be gradient along edge
  • Compute C? (a,b)

11
Case 1 Single Edge
  • However, in this simple case, the only nonzero
    terms are those where ?f (a,b)
  • So, C? (a,b) is just some multiple of (a,b)

12
Case 2 Corner
  • Assume there is a corner, with perpendicular
    gradients (a,b) and (c,d)

13
Case 2 Corner
  • What is C? (a,b)?
  • Since (a,b) ? (c,d) 0, the only nonzero terms
    are those where ?f (a,b)
  • So, C? (a,b) is again just a multiple of (a,b)
  • What is C? (c,d)?
  • Since (a,b) ? (c,d) 0, the only nonzero terms
    are those where ?f (c,d)
  • So, C? (c,d) is a multiple of (c,d)

14
Corner Detection
  • Matrix times vector multiple of vector
  • Eigenvectors and eigenvalues!
  • In particular, if C has one large eigenvalue,
    theres an edge
  • If C has two large eigenvalues, have corner
  • Tomasi-Kanade corner detector

15
Corner Detection Implementation
  1. Compute image gradient
  2. For each m?m neighborhood,compute matrix C
  3. If smaller eigenvalue ?2 is larger thanthreshold
    ?, record a corner
  4. Nonmaximum suppression only keep strongest
    corner in each m?m window

16
Corner Detection Results
  • Checkerboardwith noise

Trucco Verri
17
Corner Detection Results
18
Corner Detection Results
Histogram of l2 (smaller eigenvalue)
19
A Simple Corner Detector
Find eigenvalues of C
If the smaller eigenvalue is above a threshold
then we have a corner.
20
A Simple Corner Detector
Find eigenvalues of C
If the smaller eigenvalue is above a threshold
then we have a corner.
21
A Simple Corner Detector
22
Canny Edge Detection
  • Can we derive an optimal detector?
  • Good Detection minimize false positives and
    false negatives.
  • Good Localization close as possible to the true
    edges.
  • Single Response Constraint one edge should be
    detected for each true edge

23
Comparison
Canny
Sobel
24
Canny Edge Detection
  • 3 STEPS
  • CANNY_ENHANCER
  • NONMAX_SUPPRESION
  • HYSTERESIS_THRESH

25
Localization-Detection Tradeoff
  • Filters spatial scale
  • Location
  • Detection criteria.
  • Good tradeoff 1-D step edge detector
  • (optimal)
  • Approximated by the 1st derivative of the
    Gaussian.

26
Optimal 1-D step edge detectors
Pixel (i,j)
Keep the one that gives you maximum
response. Expensive.
27
Solution
y
x
Pixel (i,j)
Compute derivatives with respect to x y
directions. Compute edge normal.
28
CANNY_ENHANCER
  • Compute Ix and Iy the gradient of the image using
    a derivative of Gaussian filter.
  • Compute the edge strength from the magnitude of
    the gradient Es
  • Compute the orientation of the edge from
    arctan(Iy / Ix ) Eo

Canny 86
n
29
Problem with detector
gradient magnitude (Es)
original image
  • Compute image derivatives
  • if gradient magnitude gt ? and the value is a
    local max. along gradient
  • direction pixel is an edge candidate
  • how to detect one pixel thin edges ?

30
NONMAX_SUPPRESSION
  • Locate local maxima from Es.
  • Find direction d that best approximates Eo(i,j)
  • If Es(i,j) is smaller than at least one neighbor
    along d In(i,j)0 else In(i,j)Es(i,j).

90
135
45
0
31
Non-Maximum Supression
Non-maximum suppression Select the single
maximum point across the width of an edge.
32
Linking to the Next Edge Point
Assume the marked point q is an edge point.
Take the normal to the gradient at that point
and use this to predict continuation points
(either r or p).
33
Thresholding
  • Edges are found by thresholding the output of
    NONMAX_SUPRESSION
  • If the threshold is too high
  • Very few (none) edges
  • High MISDETECTIONS, many gaps
  • If the threshold is too low
  • Too many (all pixels) edges
  • High FALSE POSITIVES, many extra edges

34
Edge Detection With Hysteresis
Low threshold
High threshold
Hysteresis (high and low threshold)
35
Edge Hysteresis
  • Hysteresis A lag or momentum factor
  • Idea Maintain two thresholds khigh and klow
  • Use khigh to find strong edges to start edge
    chain
  • Use klow to find weak edges which continue edge
    chain
  • Typical ratio of thresholds is roughly
  • khigh / klow 2

36
Edge Tracking
Hysteresis thresholding Canny 86
edges
Strong edges reinforce weak edges.
Weak edge removed
We call a pixel an edge if it is strong. We also
call a pixel an edge if it is weak but is
connected to an edge. A pixel is connected to an
edge if it is in a direction perpendicular to the
edge normal
37
Canny Edge Detection (Example)
Strong connected weak edges
Original image
Strong edges only
Weak edges
courtesy of G. Loy
38
HYSTERESIS_THRESH
  • Input In, Eo, high threshold, low threshold.
  • Output Lists of connected edges (contours).

39
Edge Relaxation
Parallel iterative method to adjust edge values
on the basis of neighboring edges
Crack edges
40
Edge Relaxation
Parallel iterative method to adjust edge values
on the basis of neighboring edges
Notation
Crack edges
Edge to be updated
Edge
No edge
Vertex types
(0)
(1)
(2)
(3)
41
Edge Relaxation
Parallel iterative method to adjust edge values
on the basis of neighboring edges
Notation
Crack edges
Edge to be updated
Edge
No edge
Vertex types
(0)
(1)
(2)
(3)
42
Edge Relaxation
Parallel iterative method to adjust edge values
on the basis of neighboring edges
Notation
Crack edges
Algorithm
Edge to be updated
Edge
  • 0. Compute initial confidence C0(e) of
  • each edge e
  • C0(e)
  • k 1
  • Compute edge type for all e
  • Modify Ck(e) based on Ck-1(e) and
  • edge type.
  • If all Ck(e) have converged to 1 or 0
  • else go to step 1

No edge
Vertex types
(0)
(1)
(2)
(3)
43
Canny Edge Detector
Original Lena
Edges
44
Towards Global Features
Local versus global
45
From Edges to Lines
46
Detecting Lines
  • What is the difference between line detection and
    edge detection?
  • Edges local
  • Lines nonlocal
  • Line detection usually performed on the output of
    an edge detector

From Szymon Rusinkiewicz, Princeton
47
Detecting Lines
  • Possible approaches ?

From Szymon Rusinkiewicz, Princeton
48
Detecting Lines
  • Possible approaches
  • Brute force enumerate all lines, check if
    present
  • Hough transform vote for lines to which detected
    edges might belong
  • Fitting given guess for approximate location,
    refine it
  • Second method efficient for finding unknown
    lines, but not always accurate

From Szymon Rusinkiewicz, Princeton
49
Hough Transform
  • General idea transform from image coordinates to
    parameter space of feature
  • Need parameterized model of features
  • For each pixel, determine all parameter values
    that might have given rise to that pixel vote
  • At end, look for peaks in parameter space

From Szymon Rusinkiewicz, Princeton
50
Hough Transform for Lines
  • Generic line y axb
  • Parameters a and b

From Szymon Rusinkiewicz, Princeton
51
Hough Transform for Lines
  • Initialize table of buckets, indexed bya and b,
    to zero
  • For each detected edge pixel (x,y)
  • Determine all (a,b) such that y axb
  • Increment bucket (a,b)
  • Buckets with many votes indicate probable lines

From Szymon Rusinkiewicz, Princeton
52
Hough Transform for Lines
a
b
From Szymon Rusinkiewicz, Princeton
53
Hough Transform for Lines
a
b
From Szymon Rusinkiewicz, Princeton
54
Difficulties withHough Transform for Lines
  • Slope / intercept parameterization not ideal
  • Non-uniform sampling of directions
  • Cant represent vertical lines
  • Angle / distance parameterization
  • Line represented as (r,q) wherex cos q y sin q
    r

r
q
From Szymon Rusinkiewicz, Princeton
55
Finding Lines Using the Hough Transform
56
Algorithm
  • Discretize the parameter spaces ? and ?.
  • Create Accumulator array A(1..R,1..T).
  • Set A(k,h)0 for all k and h.
  • For each image edge E(i,j)1
  • For h1T
  • ? i cos?d(h)j sin?d (h)
  • Find index k ?d is closest to ?
  • Increment A(h,k) by one.
  • Find all local maxima (kp, hp) such that A (kp,
    hp)gtt

57
Hough Transform Results
Forsyth Ponce
58
Hough Transform Results
Forsyth Ponce
59
Finding Lines Using the Hough Transform
Strong local peaks correspond to lines.
60
Finding Lines Using the Hough Transform
Resolution Issues

61
Bucket Selection
  • How to select bucket size?

From Szymon Rusinkiewicz, Princeton
62
Bucket Selection
  • How to select bucket size?
  • Too small poor performance on noisy data, long
    running times
  • Too large poor accuracy, possibility of false
    positives
  • Large buckets verification and refinement
  • Problems distinguishing nearby lines
  • Be smarter at selecting buckets
  • Use gradient information to select subset of
    buckets
  • More sensitive to noise

From Szymon Rusinkiewicz, Princeton
63
Hough Transform Results
Hough Transform
Image
Edge detection
64
Summary Hough Transform
  • Smart counting
  • Local evidence for global features
  • Organized in a table
  • Careful with parameterization!
  • Problem Curse of dimensionality
  • Works great for simple features with 3 unknowns
  • Will fail for complex objects
  • Problem Not a local algorithm

65
Hough Transform
  • What else can be detected usingHough transform?

66
Hough Transform
  • What else can be detected usingHough transform?
  • Anything, but dimensionality is key

67
Finding Circles by Hough Transform
y
r
b0
(xi,yi)
x
a0
Equation of Circle
68
Finding Circles by Hough Transform
y
r
b0
(xi,yi)
x
a0
Equation of Circle
Circles!
If radius r is known
b
y
(xi,yi)
x
a
Accumulator array A(a,b)
69
Finding Circles by Hough Transform
y
r
b0
(xi,yi)
x
a0
If r is not known Use accumulator array
A(a,b,r) For each (xi,yi) increment A(a,b,r)
such that
70
Using Gradient Information
Can save lot of computations!
Given location (xi,yi) Edge direction fi
y
x
71
Using Gradient Information
Can save lot of computations!
Given location (xi,yi) Edge direction fi
y
x
Assume r is known
ax-rcosf by-rsinf Need to increment only one
point in Accumulator Array.
(xi,yi)
y
fi
(a,b)
x
72
Hough Transform for Curves
  • Curve yf(x,a)
  • aa1, , ap the parameters of the curve.
  • Limitation size of parameter space wrt of
    parameters.
  • Solution variable-resolution parameter space.

73
Hough Transform
  • Pattern Matching.
  • More efficient than template matching.
  • Handles occlusion.
  • Finds all instances of pattern.
  • Handling inaccurate edge locations?
  • Drawbacks?

74
Fitting
  • Output of Hough transform often not accurate
    enough
  • Use as initial guess for fitting

75
Fitting Lines
76
Fitting Lines
Least-squares minimization
77
Fitting Lines
78
Finding Lines
  • Assume edge detection
  • Each pixel is either edge or not
  • How do we find the line?

79
Finding Lines
  • Assume edge detection
  • Each pixel is either edge or not
  • How do we find the line?

80
Least Squares Fitting of Lines
Minimize E
81
Least Squares Fitting of Lines
Minimize E
Problem E must be formulated carefully!
82
Least Squares Fitting of Lines
Minimize E
Write a Comment
User Comments (0)
About PowerShow.com