Sejong Univ.Sejong Univ.
Edge Detection
•Introduction
•Simple Edge Detectors
•First Order Derivative based Edge Detectors
•Compass Gradient based Edge Detectors
•Second Order Derivative based Edge Detectors
•<Experiment 7>
•LoG (Laplacian of Gaussian)
•<Experiment 8>
Sejong Univ.Sejong Univ.- 2 -
Importance of edges in image: Edges provide the basic information on location, shape, and size of objects in images.
Edge business, randomness, density, directionality, etc. are used for texture features.
The simplest descriptor of an image is the edges. Normally used as the first step for Image Analysis, Segmentation, Registration, Region Adaptive Processing
Kinds of edges: Roof, Line, Step, Ramp Edges
Edge Detection : Introduction
Sejong Univ.Sejong Univ.- 3 -
Homogeneity operator: y(m,n) = max{|x(m,n)-x(m-1,n)|, |x(m,n)-x(m,n-1)|, |x(m,n)-x(m+1,n)|, |x(m,n)-x(m,n+1)|, |x(m,n)-x(m-1,n-1)|, |x(m,n)-x(m-1,n+1)|, |x(m,n)-x(m+1,n-1)|, |x(m,n)-x(m+1,n+1)|} Difference edge detector: y(m,n) = |x(m,n)-x(m-1,n)| + |x(m,n)-x(m,n-1)| + |x(m,n)-x(m+1,n)| + |x(m,n)-x(m,n+1)| Normalization or thresholding follows for complete
detection
Too many edges are detected, p84, 85 Fig. 3.14, 15 Does not provide the information on edge orientations.
Simple Edge Detectors
Sejong Univ.Sejong Univ.- 4 -
Calculate Hr & Hc by masking with Roberts, Prewitt, Sobel, Frei-Chen <p86 Fig. 3.16> masks.
SQRT(Hr2+Hc2) = edge strength, tan-1(Hr/Hc) = edge orientation <p87 Fig. 3.18>
First Order Derivative based Edge Detectors
Hr Hc
Roberts
Prewitt
Sobel
Frei-Chen
0 0 -1
0 1 0
0 0 0
-1 0 0
0 1 0
0 0 0
1 0 -1
1 0 -1
1 0 -1
-1 -1 -1
0 0 0
1 1 1
1 0 -1
2 0 -2
1 0 -1
-1 -2 -1
0 0 0
1 2 1
1 0 -1
0
1 0 -1
-1 -1
0 0 0
1 12
2
2
2
Sejong Univ.Sejong Univ.- 5 -
1. Laplacian operator: edge = zero crossing of the second derivatives
=> Masking with the following difference mask 2 times & detect zero-crossings
Second Order Derivative based Edge Detectors
0 -1 0
-1 4 -1
0 -1 0
-1 -1 -1
-1 8 -1
-1 -1 -1
Sejong Univ.Sejong Univ.- 6 -
<Experiment 7>
1.Implement Simple Edge Detector on page 3.2.Implement First Order Derivative based Edge Detectors on page 4.
3.Implement Laplacian Edge Detector on page 5.
By using one of above edge detectors, display horizontal, vertical, diagonal, & off-diagonal edge, respectively.
Sejong Univ.Sejong Univ.- 7 -
<Midterm exam, 4/22 Wed.>
Written Exam for the DIP Theory on Lecture Notes
- Closed books Program Implementation Test - Open books & source codes
Sejong Univ.Sejong Univ.- 8 -
Second Order Derivative based Edge Detectors are too much sensitive on noisy area.
Very useful concept for the most famous edge detector, Canny’s edge detector.
step 1: Remove Noise by using Gaussian filter.
LoG (Laplacian of Gaussian)
f x( ) * ( )G x ex
1
2 2
2
2
2
f x G x( ) * ( )
Sejong Univ.Sejong Univ.- 9 -
step 2: 1-st differentiation.
step 3: 2-nd differentiation.
LoG (Laplacian of Gaussian)
x
x
f x G x[ ( ) * ( ) ]f x G x( ) * ( )
x
2
2 xf x G x[ ( ) * ( ) ]
x
f x G x[ ( ) * ( ) ]
Sejong Univ.Sejong Univ.- 10 -
step 4: find zero crossing.
• For (-1)*[step 3]. No change on zero crossing. • Then,
i.e.,
LoG (Laplacian of Gaussian)
LoG xx
ex
( ) [ ]
2
2 2
21
2
2
2
LoG xxe
x
( ) ( ) 1
2
11
2 2
2
22
2
2
Sejong Univ.Sejong Univ.- 11 -
• 2-dimensional Gaussian filter is
&
• Looks like Mexican Hat (Fig. 3.21, p91). Therefore, LoG filter is also called Mexican Hat filter.
• Larger results more smoothing & less detected edges.
LoG (Laplacian of Gaussian)
G x y e ex y
( , ) 1
2
1
22
2
2
2
2
2
2
2
LoG x yx y
G x yx y
ex y
ex y x y
( , ) [ ] ( , ) [ ] [ ]
2
2
2
2
2
2
2
2 22
4
2 2
221
2
11
2
2 2
2
2 2
2
Sejong Univ.Sejong Univ.- 12 -
DoG (Difference of Gaussian):- Proposed as the simpler method resembling LoG.
- Implemented by using the following difference of two Gaussian filters with different .
Typically, is used.
LoG( =12.35) & DoG( =10, =16) are shown on p92 Fig. 3.22.
Typically, mask sizes of 7X7, 9X9, 35X35 are used for LoG & DoG as shown on p92.
LoG (Laplacian of Gaussian)
DoG x ye e
x y x y
( , )
2 2
12
2 2
222
12
2
222 2
1 2 16/ .
1 2
Sejong Univ.Sejong Univ.- 13 -
LoG (Laplacian of Gaussian)
Sejong Univ.Sejong Univ.- 14 -
<Experiment 8>
1.Implement edge detector using 9X9 LoG filter shown on Textbook p92.
2.Detect your edges by changing . - You need to change your mask. How can you do this?
- See the edge detector provided by the lecturer.
Sejong Univ.Sejong Univ.- 15 -
< HW #3 on xx/xx xxx. >
Find a paper for edge detection written in English, make your own computer program to implement it, and present the results including the paper’s advantages.