0% found this document useful (0 votes)
33 views30 pages

Computer Vision - Edge Detection

The document discusses edge detection in computer vision. It covers the goals of edge detection, different types of edges, methods for detecting edges like gradient and Laplacian operators, and the Canny edge detector algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views30 pages

Computer Vision - Edge Detection

The document discusses edge detection in computer vision. It covers the goals of edge detection, different types of edges, methods for detecting edges like gradient and Laplacian operators, and the Canny edge detector algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

COMPUTER VISION

Le Thanh Ha, Ph.D


Assoc. Prof. at University of Engineering and Technology,
Vietnam National University
[email protected]; [email protected]; 0983 692 592
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

• Ideal: artist’s line drawing (but artist


is also using object-level knowledge)

Source: D. Lowe
Origin of Edges
surface normal discontinuity

depth discontinuity

surface color discontinuity

illumination discontinuity

• Edges are caused by a variety of factors

Source: Steve Seitz


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
Image gradient
• The gradient of an image:

The gradient points in the direction of most rapid increase


in intensity
The gradient direction is given by
• how does this relate to the direction of the edge?

The edge strength is given by the gradient magnitude

Source: Steve Seitz


Differentiation and convolution
•Recall, for 2D function, f(x,y): •We could approximate
this as
f  f (x +  , y) f (x, y ) f f (xn+1 , y )− f (xn , y)
= lim  −  
x  →0     x x

•This is linear and shift invariant, so


must be the result of a convolution. •(which is obviously a
convolution)

-1 1

Source: D. Forsyth, D. Lowe


Finite difference filters
• Other approximations of derivative filters exist:

Source: K. Grauman
Finite differences: example

• Which one is the gradient in the x-direction (resp. y-direction)?


Effects of noise

• Consider a single row or


column of the image
– Plotting intensity as a
function of position gives a
signal

Where is the edge?


Source: S. Seitz
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?

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

• Which one finds horizontal/vertical edges?


Tradeoff between smoothing and localization

1 pixel 3 pixels 7 pixels


• Smoothed derivative removes noise, but blurs
edge. Also finds edges at different “scales”.
Source: D. Forsyth
Implementation issues
• The gradient magnitude is large
along a thick “trail” or “ridge,” so
how do we identify the actual
edge points?
• How do we link the edge points
to form curves?

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

• MATLAB: edge(image, ‘canny’)

Source: D. Lowe, L. Fei-Fei


Example

• original image (Lena)


Example

norm of the gradient


Example

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

high threshold low threshold hysteresis threshold


(strong edges) (weak edges)
Source: L. Fei-Fei
Effect of  (Gaussian kernel spread/size)

original Canny with Canny with

The choice of  depends on desired behavior


• large  detects large scale edges
• small  detects fine features
Source: S. Seitz
Edge detection is just the beginning…
image human segmentation gradient magnitude

• Berkeley segmentation database:


http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/segbench/

You might also like