Computer Vision - Edge Detection
Computer Vision - Edge Detection
Source: D. Lowe
Origin of Edges
surface normal discontinuity
depth discontinuity
illumination discontinuity
edges correspond to
extrema of derivative
Image gradient
• The gradient of an image:
-1 1
Source: K. Grauman
Finite differences: example
Source: D. Forsyth
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
Source: D. Forsyth
Solution: smooth first
f
f*g
d
( f g)
dx
d
• To find edges, look for peaks in ( f g)
dx Source: S. Seitz
Derivative theorem of convolution
d d
• Differentiation is convolution, and convolution is associative: ( f g) = f g
dx dx
• This saves us one operation:
d
g
dx
d
f g
dx
Source: S. Seitz
Derivative of Gaussian filter
* [1 -1] =
• Is this filter
separable?
Derivative of Gaussian filter
x-direction y-direction
Source: D. Forsyth
Designing an edge detector
• Criteria for an “optimal” edge
detector:
– Good detection: the optimal detector
must minimize the probability of false
positives (detecting spurious edges
caused by noise), as well as that of
false negatives (missing real edges)
– Good localization: the edges detected
must be as close as possible to the true
edges
– Single response: the detector must
return one point only for each true
edge point; that is, minimize the
number of local maxima around the
true edge
Source: L. Fei-Fei
Canny edge detector
• This is probably the most widely used edge detector in
computer vision
• Theoretical model: step-edges corrupted by additive Gaussian
noise
• Canny has shown that the first derivative of the Gaussian
closely approximates the operator that optimizes the product
of signal-to-noise ratio and localization
J. Canny, A Computational Approach To Edge Detection, IEEE
Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986.
Source: L. Fei-Fei
Canny edge detector
1. Filter image with derivative of Gaussian
2. Find magnitude and orientation of gradient
3. Non-maximum suppression:
– Thin multi-pixel wide “ridges” down to single pixel width
4. Linking and thresholding (hysteresis):
– Define two thresholds: low and high
– Use the high threshold to start edge curves and the low threshold to continue
them
thresholding
Example
thinning
(non-maximum suppression)
Non-maximum suppression
At q, we have a
maximum if the
value is larger
than those at
both p and at r.
Interpolate to
get these
values.
Source: D. Forsyth
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).
Source: D. Forsyth
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.
Source: S. Seitz
Hysteresis thresholding
original image