Professional Documents
Culture Documents
Edge Detection: Prof. Fei-Fei Li, Stanford University
Edge Detection: Prof. Fei-Fei Li, Stanford University
Edge Detection: Prof. Fei-Fei Li, Stanford University
Chapter 5
Edge Detection
Contents
Edge detection
• Canny edge detector
Department of Mechatronics
5-3 Chapter 5 – Edge Detection
Department of Mechatronics
5-5 Chapter 5 – Edge Detection
Edge detection
• Goal: Identify sudden changes
(discontinuities) in an image
– Intuitively, most semantic and shape
information from the image can be
encoded in the edges
– More compact than pixels
Source: D. Lowe
Department of Mechatronics
5-7 Chapter 5 – Edge Detection
Origin of Edges
color discontinuity
illumination discontinuity
Department of Mechatronics
5-8 Chapter 5 – Edge Detection
Characterizing edges
• An edge is a place of rapid change in the image intensity
function
intensity function
image (along horizontal scanline) first derivative
edges correspond to
extrema of derivative
Department of Mechatronics
5-9 Chapter 5 – Edge Detection
Image gradient
• The gradient of an image:
The gradient points in the direction of most rapid increase in intensity. The
Source: Steve
Seitz
Department of Mechatronics
5-10 Chapter 5 – Edge Detection
∂f f ( x + ε , y ) f ( x, y ) ∂f f ( xn +1 , y ) − f ( xn , y )
lim − ≈
∂x ε →0
ε ε ∂x ∆x
1 -1 -1 1
Source: D. Forsyth, D. Lowe
Department of Mechatronics
5-11 Chapter 5 – Edge Detection
𝟏𝟏 𝟎𝟎 𝟎𝟎 𝟏𝟏
Roberts: 𝑴𝑴𝒙𝒙 =
𝟎𝟎 −𝟏𝟏
𝑴𝑴𝒚𝒚 =
−𝟏𝟏 𝟎𝟎
Department of Mechatronics
5-12 Chapter 5 – Edge Detection
Effects of noise
• Consider a single row or column of the image
– Plotting intensity as a function of position gives a signal
Effects of noise
• Finite difference filters respond strongly to noise
– Image noise results in pixels that look very different
from their neighbors
– Generally, the larger the noise the stronger the response
• What is to be done?
Department of Mechatronics
5-15 Chapter 5 – Edge Detection
Effects of noise
• Finite difference filters respond strongly to noise
– Image noise results in pixels that look very
different from their neighbors
– Generally, the larger the noise the stronger the response
• What is to be done?
– Smoothing the image should help, by forcing pixels
different to their neighbors (=noise pixels?) to look more
like neighbors
Department of Mechatronics
5-16 Chapter 5 – Edge Detection
f*g
d
( f *g)
dx
d
• To find edges, look for peaks in ( f *g)
dx Source: S. Seitz
Department of Mechatronics
5-17 Chapter 5 – Edge Detection
𝒅𝒅
𝒇𝒇 ∗ 𝒈𝒈
𝒅𝒅𝒅𝒅 Source: S. Seitz
Department of Mechatronics
19
5-18 Chapter 5 – Edge Detection
* [1 -1] =
• 1D Gaussian filter:
𝟏𝟏 𝒙𝒙𝟐𝟐 𝟏𝟏 𝒚𝒚𝟐𝟐
𝒈𝒈𝝈𝝈 𝒙𝒙 = 𝒆𝒆𝒆𝒆𝒆𝒆 − 𝟐𝟐 𝒈𝒈𝝈𝝈 𝒚𝒚 = 𝒆𝒆𝒆𝒆𝒆𝒆 − 𝟐𝟐
𝝈𝝈 𝟐𝟐𝟐𝟐 𝟐𝟐𝝈𝝈 𝝈𝝈 𝟐𝟐𝟐𝟐 𝟐𝟐𝝈𝝈
x-direction y-direction
Department of Mechatronics
5-21 Chapter 5 – Edge Detection
Implementation issues
Department of Mechatronics
5-22 Chapter 5 – Edge Detection
Department of Mechatronics
5-23 Chapter 5 – Edge Detection
Department of Mechatronics
5-24 Chapter 5 – Edge Detection
Department of Mechatronics
5-25 Chapter 5 – Edge Detection
Example
Example
Example
Thresholding
Department of Mechatronics
5-29 Chapter 5 – Edge Detection
Example
Non-Maximum Suppression
At q, we have a maximum
intensity if the value is larger
than those at both p and r.
Interpolate to get these
values.
Source: D. Forsyth
Department of Mechatronics
5-31 Chapter 5 – Edge Detection
Edge linking
Assume the marked point is
an edge point. Then we
construct the tangent to the
edge curve (which is normal
to the gradient at that point)
and use this to predict the
next points (here either r or
s).
Department of Mechatronics
5-32 Chapter 5 – Edge Detection
Hysteresis thresholding
• Check that maximum value of gradient value is
sufficiently large
– Drop-outs? use hysteresis
• Use a high threshold to start edge curves and a low
threshold to continue them.
Department of Mechatronics
5-33 Chapter 5 – Edge Detection
Hysteresis thresholding
original
image
Department of Mechatronics
5-35 Chapter 5 – Edge Detection
Department of Mechatronics