Edge Operators
a kind of filtering that leads to
useful features
1
Lines and Arcs
Segmentation
In some image sets, lines, curves, and circular arcs
are more useful than regions or helpful in addition
to regions.
Lines and arcs are often used in
• object recognition
• stereo matching
• document analysis
2
Edge Detection
Basic idea: look for a neighborhood with strong signs
of change.
Problems: 81 82 26 24
82 33 25 25
• neighborhood size 81 82 26 24
• how to detect change
3
Differential Operators
Differential operators
• attempt to approximate the gradient at a pixel via masks
• threshold the gradient to select the edge pixels
4
Example: Sobel Operator
-1 0 1 1 2 1
Sx = -2 0 2 Sy = 0 0 0
-1 0 1 -1 -2 -1
On a pixel of the image I Then the gradient is
• let gx be the response to Sx T
∇I = [gx gy]
• let gy be the response to Sy
2 2 1/2
And g = (gx + gy ) is the gradient magnitude.
θ = atan2(gy,gx) is the gradient direction.
5
Sobel Operator on the Blocks
Image
original image gradient thresholded
magnitude gradient
magnitude
6
Common Masks for Computing
Gradient
z Sobel: -1 0 1 1 2 1
-2 0 2 0 0 0
-1 0 1 -1 -2 -1
z Prewitt: -1 0 1
-1 0 1
1 1 1
0 0 0
-1 0 1 -1 -1 -1
0 1 1 0
z Roberts -1 0 0 -1
Sx Sy
7
Zero Crossing Operators
Motivation: The zero crossings of the second derivative
of the image function are more precise than
the peaks of the first derivative.
step edge
smoothed
1st derivative
zero crossing
2nd derivative
8
How do we estimate the Second
Derivative?
∇ f = ∂ f / ∂x + ∂ f / ∂y
2 2 2 2 2
z Laplacian Filter:
0 1 0
1 -4 1 • Standard mask implementation
0 1 0
• Derivation: In 1D, the first derivative
can be computed with mask [-1 0 1]
• The 1D second derivative is [1 -2 1]*
• The Laplacian mask estimates the
2D second derivative.
9
Properties of Derivative Masks
z Coordinates of derivative masks have opposite signs in
order to obtain a high response in regions of high
contrast.
z The sum of coordinates of derivative masks is zero, so
that a zero response is obtained on constant regions.
z First derivative masks produce high absolute values at
points of high contrast.
z Second derivative masks produce zero-crossings at
points of high contrast.
10
Marr/Hildreth Operator
• First smooth the image via a Gaussian convolution.
• Apply a Laplacian filter (estimate 2nd derivative).
• Find zero crossings of the Laplacian of the Gaussian.
This can be done at multiple resolutions.
11
Haralick Operator
• Fit the gray-tone intensity surface to a piecewise
cubic polynomial approximation.
• Use the approximation to find zero crossings of the
second directional derivative in the direction that
maximizes the first directional derivative.
The derivatives here are calculated from direct
mathematical expressions wrt the cubic polynomial.
12
Canny Edge Detector
• Smooth the image with a Gaussian filter with spread σ.
• Compute gradient magnitude and direction at each pixel of
the smoothed image.
• Zero out any pixel response ≤ the two neighboring pixels
on either side of it, along the direction of the gradient.
• Track high-magnitude contours.
• Keep only pixels along these contours, so weak little
segments go away.
13
Canny Examples
Canny σ=1 Canny σ=4
Canny σ=1 Roberts 2X2
14
Canny on Kidney
15
Canny Characteristics
z The Canny operator gives single-pixel-wide
images with good continuation between adjacent
pixels
z It is the most widely used edge operator today;
no one has done better since it came out in the
late 80s. Many implementations are available.
z It is very sensitive to its parameters, which need
to be adjusted for different application domains.
16