edge detection phil mlsna, ph.d. dept. of electrical engineering northern arizona university
Post on 20-Dec-2015
218 views
TRANSCRIPT
![Page 1: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/1.jpg)
Edge Detection
Phil Mlsna, Ph.D.
Dept. of Electrical Engineering
Northern Arizona University
![Page 2: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/2.jpg)
Some Important Topics in Image Processing
• Contrast enhancement• Filtering (both spatial and frequency domains) • Restoration• Segmentation• Image Compression
etc.
EE 460/560 course, Fall 2003 (formerly CSE 432/532)
Edge Detection uses spatial filtering to extract important information from a scene.
![Page 3: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/3.jpg)
Types of Edges
• Physical Edges– Different objects in physical contact– Spatial change in material properties– Abrupt change in surface orientation
• Image Edges– In general: Boundary between contrasting regions
in image– Specifically: Abrupt local change in brightness
Image edges are important clues for identifying and interpreting physical edges in the scene.
![Page 4: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/4.jpg)
Goal: Produce an Edge Map
Original Image Edge Map
![Page 5: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/5.jpg)
Edge Detection Concepts in 1-D
)(xf
)(xf
)(xf
Edges can be characterized as either:• local extrema of • zero-crossings of
)(xf )(xf
![Page 6: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/6.jpg)
Continuous Gradient
jy
yxfi
x
yxfyxf ˆ),(ˆ),(),(
But is a vector.
We really need a scalar that gives a measure of edge “strength.”
22),(),(
),(
y
yxf
x
yxfyxf
f
This is the gradient magnitude. It’s isotropic.
![Page 7: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/7.jpg)
Classification of Points
Let points that satisfy be edge points.Tyxf ),(
PROBLEM:
Tf
Non-zero edge width
Stronger gradient magnitudes produce thicker edges.
To precisely locate the edge, we need to thin. Ideally, edges should be only one point thick.
![Page 8: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/8.jpg)
Practical Gradient Algorithm
1. Compute for all points.
2. Threshold to produce candidate edge points.
3. Thin by testing whether each candidate edge point is a local maximum of along the direction of
. Local maxima are classified as edge points.
ff
ff
![Page 9: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/9.jpg)
Cameramanimage
ThresholdedGradient
Thresholded andThinned
![Page 10: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/10.jpg)
Directional Edge Detection
Tx
yxf
),(
Ty
yxf
),(
Horizontal operator(finds vertical edges)
Vertical operator(finds horizontal edges)
Ty
yxf
x
yxf
sin),(
cos),(
finds edges perpendicular to the direction
![Page 11: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/11.jpg)
Horizontal DifferenceOperator
Vertical DifferenceOperator
Directional Examples
![Page 12: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/12.jpg)
Discrete Gradient Operators
Pixels are samples on a discrete grid.Must estimate the gradient solely from these samples.
STRATEGY: Build gradient estimation filter kernels and convolve them with the image.
Two basic filter conceptsFirst difference:
Central difference:
11
101
![Page 13: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/13.jpg)
Simple Filtering Example in 1-D
11
[ 5 5 5 8 20 25 25 22 12 4 3 3 ]
Convolving with
11
[ 0]
![Page 14: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/14.jpg)
Simple Filtering Example in 1-D
11
[ 5 5 5 8 20 25 25 22 12 4 3 3 ]
Convolving with
11
[ 0 0]
![Page 15: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/15.jpg)
Simple Filtering Example in 1-D
11
[ 5 5 5 8 20 25 25 22 12 4 3 3 ]
Convolving with
11
[ 0 0 3]
![Page 16: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/16.jpg)
Simple Filtering Example in 1-D
11
[ 5 5 5 8 20 25 25 22 12 4 3 3 ]
Convolving with
[ 0 0 3 12 5 0 -3 -13 -8 -1 0 ]produces:
11
![Page 17: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/17.jpg)
Gradient Estimation
),(),(),(ˆ21
2221
2121 nnfnnfnnf
1. Create orthogonal pair of filters,
),( 211 nnh ),( 212 nnh
2. Convolve image with each filter:
3. Estimate the gradient magnitude:
),(),(),( 21121211 nnhnnfnnf
),(),(),( 21221212 nnhnnfnnf
![Page 18: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/18.jpg)
Roberts Operator
• Small kernel, relatively little computation• First difference (diagonally)• Very sensitive to noise• Origin not at kernel center• Somewhat anisotropic
10
01),( 212 nnh
01
10),( 211 nnh
![Page 19: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/19.jpg)
Noise
• Noise is always a factor in images.• Derivative operators are high-pass filters.• High-pass filters boost noise!
• Effects of noise on edge detection:– False edges– Errors in edge position
Key concept:
Build filters to respond to edges and suppress noise.
![Page 20: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/20.jpg)
Prewitt Operator
• Larger kernel, somewhat more computation• Central difference, origin at center• Smooths (averages) along edge, less sensitive to
noise• Somewhat anisotropic
101
101
101
111
000
111
![Page 21: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/21.jpg)
• 3 x 3 kernel, same computation as Prewitt• Central difference, origin at center• Better smoothing along edge, even less sensitive to
noise• Still somewhat anisotropic
Sobel Operator
101
202
101
121
000
121
![Page 22: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/22.jpg)
Discrete Operators Compared
Original Roberts
![Page 23: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/23.jpg)
Roberts Prewitt
![Page 24: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/24.jpg)
Prewitt Sobel
![Page 25: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/25.jpg)
T = 5 T = 10
T = 20 T = 40T = 40
Roberts
![Page 26: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/26.jpg)
Continuous Laplacian
2
2
2
22 ),(),(
),(),(y
yxf
x
yxfyxfyxf
This is a scalar. It’s also isotropic.
Edge detection: Find all points for which
0),(2 yxf
No thinning is necessary.Tends to produce closed edge contours.
![Page 27: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/27.jpg)
Discrete Laplacian Operators
010
141
010
111
181
111
121
242
121
• Origin at center• Only one convolution needed, not two• Can build larger kernels by sampling Laplacian of
Gaussian
),(),(),(ˆ212121
2 nnhnnfnnf
![Page 28: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/28.jpg)
Laplacian of Gaussian(Marr-Hildreth Operator)
2
22
4
2222
2exp
2),(),(
yxyx
yxgyxh
2
22
2exp),(
yx
yxgGaussian:
),(),(),( 22 yxfyxgyxf
Let:
Then:
),(),( yxfyxh
![Page 29: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/29.jpg)
LoG Filter Impulse Response
),(2 yxg
![Page 30: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/30.jpg)
LoG Filter Frequency Response
)},({ 2 yxg
![Page 31: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/31.jpg)
Laplacian of Gaussian Examples
= 1.0 = 2.0
= 1.5
![Page 32: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/32.jpg)
LoG Properties
• One filter, one convolution needed• Zero-crossings are very sensitive to noise (2nd deriv.)• Bandpass filtering reduces noise effects• Edge map can be produced for a given scale• Scale-space or pyramid decomposition possible• Found in biological vision!!
Practical LoG Filters:• Kernel at least 3 times width of main lobe, truncate• Larger kernel more computation
![Page 33: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/33.jpg)
Summary
• Edges can be detected from the derivative:– Extrema of gradient magnitude– Zero-crossings of Laplacian
• Practical filter kernels; convolve with image• Noise effects
– False edges– Imprecise edge locations– Correct filtering attempts to control noise
• Edge map is the goal
![Page 34: Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University](https://reader035.vdocument.in/reader035/viewer/2022062421/56649d4e5503460f94a2dd54/html5/thumbnails/34.jpg)
Questions?