Document 15072442

advertisement
Mata kuliah : T0283 - Computer Vision
Tahun
: 2010
Lecture 04
Edge Detection
Learning Objectives
After carefully listening this lecture, students will be able
to do the following :
show basic principles of edge detection techniques
demonstrate various convolution-based edge detection
techniques such as LOG and Canny edge detectors
January 20, 2010
T0283 - Computer Vision
3
Edge Detection
Definition of Edges
Edges are significant local changes of intensity in an image
Typically occur on the boundary between two different regions in an
image
Goal of Edge Detection
Produce a line drawing of a scene from an image of that scene
Important features can be extracted from the edges of an image (e.g.,
corners, lines, curves)
These features are used by higher level computer vision algorithms
(e.g., recognition)
January 20, 2010
T0283 - Computer Vision
4
What causes intensity changes ?
Various physical events cause intensity changes
Geometric events
Object boundary (discontinuity in depth)
Surface boundary (discontinuity in surface orientation and/or surface
color and texture)
Non-geometric events
Specularity (direct reflection of light, such as a mirror)
Shadows (from other object or from the same object)
Inter-reflections
January 20, 2010
T0283 - Computer Vision
5
Edge Descriptors
Edge normal
Unit vector in the direction of maximum intensity change
Edge direction
Unit vector perpendicular to the edge normal
Edge position or center
The image position at which the edge is located
Edge strength
Related the local image contrast along the normal
January 20, 2010
T0283 - Computer Vision
6
The Four Steps of Edge Detection
Edge Types
Step edge (ramp)
Line edge (roof)
Searching for Edges
Filtering: Smooth image
Enhancement: Apply numerical derivative approximation
Detection: Threshold to find strong edges
Localization/analyze: Reject spurious edges, include weak but justified
edges
January 20, 2010
T0283 - Computer Vision
7
Edge Detection Using Derivatives
Calculus describe changes of continuous functions using derivatives
An image is a 2D function, so operators describing edges are
expressed using partial derivatives
Points which lie on an edge can be detected by
Detecting local maxima or minima of the 1st derivative
Detecting the zero-crossing of the 2nd derivative
1st derivative
2nd derivative
January 20, 2010
T0283 - Computer Vision
8
Computing the 1st derivative
To compute the derivative of a signal, we approximate the derivative by
finite differences :
Examples using the edge models and the mask [-1 0 1] (centered about x)
MASK M = [-1, 0, 1]
S1
S2

M
S1
S2
January 20, 2010

M
12
12
12
12
12
24
24
24
24
24
0
0
0
0
12
12
0
0
0
0
24
24
24
24
24
12
12
12
12
12
0
0
0
0
-12
-12
0
0
0
0
T0283 - Computer Vision
9
Computing the 2nd derivative
This approximation is centered about x + 1; by replacing x + 1 by x we obtain
January 20, 2010
T0283 - Computer Vision
10
Examples using edge models
MASK M = [-1, 2, -1]
S1
S2

M
S1
S2

M
S1
S2

M
S1
S2
January 20, 2010

M
12
12
12
12
12
24
24
24
24
24
0
0
0
0
-12
12
0
0
0
0
24
24
24
24
24
12
12
12
12
12
0
0
0
0
12
-12
0
0
0
0
12
12
12
12
15
18
21
24
24
24
0
0
0
-3
0
0
0
3
0
0
12
12
12
12
24
12
12
12
12
12
0
0
0
-12
24
-12
0
0
0
0
T0283 - Computer Vision
11
Edge Detection Using The Gradient
The gradient of an image:
The gradient points in the direction of most rapid change
in intensity
The gradient direction is given by:
The edge strength is given by the gradient magnitude
January 20, 2010
T0283 - Computer Vision
12
Estimating Gradient with Finite Differences
The gradient can be approximated by finite differences
MASK Mx dan My
-1
January 20, 2010
T0283 - Computer Vision
1
1
-1
13
Robert Edge Detector
This approximation can be implemented by the following mask
January 20, 2010
T0283 - Computer Vision
14
Prewitt & Sobel Edge Detector
Consider the arrangement of pixels about the pixel (i, j)
a0
a1
a2
a7
[i,j]
a3
a6
a5
a4
The partial derivatives can be computed by
Mx = (a2 + ca3 + a4) - (a0 + ca7 + a6)
My = (a6 + ca5 + a4) - (a0 + ca1 + a2)
The constant c implies the emphasis given to the pixels closer the center of
the mask
January 20, 2010
T0283 - Computer Vision
15
Prewitt & Sobel Edge Detector (cont’d)
Setting c = 1, we get the Prewitt operator
Setting c = 2, we get the Sobel operator
January 20, 2010
T0283 - Computer Vision
16
Main Steps in Edge Detection using Mask
January 20, 2010
T0283 - Computer Vision
17
Main Steps in Edge Detection using Mask
January 20, 2010
T0283 - Computer Vision
18
A Comparison of Various Edge Detector
(A) Original & smoothed image
(B) Robert Cross operator, T = 64
(C) Prewitt operator, T = 225
January 20, 2010
(D) Sobel operator, T = 225
T0283 - Computer Vision
19
Criteria for Optimal Edge Detection
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 constraint
The detector must return one point only for each true edge point, that
is, minimize the number of local maxima around the true edge (created
by noise)
January 20, 2010
T0283 - Computer Vision
20
Canny Edge Detector
This is probably the most widely used edge detector in Computer Vision
Algorithm
Compute f x and f y :
Compute the gradient magnitude :
Apply non-maxima suppression
Apply hysteresis thresholding/edge linking
January 20, 2010
T0283 - Computer Vision
21
Non Maxima Suppression
To find the edge points, we need to find the local maxima of the gradient magnitude
Broad ridges must be thinned so that only the magnitudes at the points of greatest
local change remain
All values along the direction of gradient that are not peak values of a ridge are
suppressed
January 20, 2010
T0283 - Computer Vision
22
Hysteresis thresholding/Edge linking
The output of non-maxima suppression still contains the local
maxima created by noise
Can we get rid of them just by using a single threshold ?
If we set a low threshold some noisy maxima will be accepted too
If we set a high threshold, true maxima might be missed (the value of
true maxima will fluctuate above and below the threshold, fragmenting
the edge)
A more effective scheme is to use two thresholds
A low threshold t L
A high threshold t H, usually t
January 20, 2010
H
=2t
L
T0283 - Computer Vision
23
A Comparison of Various Edge Detector
January 20, 2010
T0283 - Computer Vision
24
Edge Detection using 2nd Derivatives
Edge points can be detected by finding the zero-crossing of the second
derivative
There are two operators in 2D that correspond to the 2nd derivative :
Laplacian and Second directional derivative
January 20, 2010
T0283 - Computer Vision
25
The Laplacian
January 20, 2010
T0283 - Computer Vision
26
Example of Laplacian Mask
January 20, 2010
T0283 - Computer Vision
27
Laplacian of Gaussian (LOG)
To reduce the noise effect, the images is first smoothed with a LPF
In case of LOG, the LPF is chosen to be a Gaussian
It can be shown that :
January 20, 2010
T0283 - Computer Vision
28
Gradient VS LOG : A Comparison
Gradient works well when the image contains sharp intensity transitions
and low noise
Zero-crossing of LOG offer better localization, especially when the edges
are not very sharp
January 20, 2010
2
2
2
2
2
5
8
8
8
8
2
2
2
2
2
5
8
8
8
8
2
2
2
2
2
5
8
8
8
8
2
2
2
2
2
5
8
8
8
8
2
2
2
2
2
5
8
8
8
8
2
2
2
2
2
5
8
8
8
8
0
0
0
3
0
-3
0
0
0
0
0
3
0
-3
0
0
0
0
0
3
0
-3
0
0
0
0
0
3
0
-3
0
0
T0283 - Computer Vision
29
Download