Lect 33
Lect 33
e
processing
Lecture 33
Basic Edge Detection by Using First-Order
Derivative
f
g x x
f grad ( f )
g y f
y
The magnitude of f
M ( x, y ) mag(f ) g x 2 g y 2
The direction of f
gx
1
( x, y ) tan
g y
The direction of the edge
01/20/25
- 90 2
01/20/25 3
First derivative for edge
detection
01/20/25 4
01/20/25 5
01/20/25 6
01/20/25 7
01/20/25 8
01/20/25 9
01/20/25 10
01/20/25 11
Advanced edge detection
0 MARR – HILDRETH EDGE DETECTOR:
0 Intensity gradients are a function of image scale =>
operators of different sizes must be used.
0 Sudden intensity change will give a peak or trough in
first derivative or a zero crossing in second derivative.
01/20/25 12
Advanced Techniques for Edge Detection
0 The Marr-Hildreth edge detector
x2 y 2
G ( x, y ) e 2 2
, : space constant.
Laplacian of Gaussian (LoG)
2 2 G ( x, y ) 2 G ( x, y )
G ( x, y ) 2
x y 2
y x y2
2 2 2 2
x y
x 2
2 e 2 2 e 2
x y
x2 y 2 x2 y 2
x 2
1
2 2
y 1 2
2 2
4 2 e 4 2 e
x2 y 2
x y
2 2 2
2 2
e
01/20/25 4
13
01/20/25 14
Marr-Hildreth Algorithm
g ( x, y ) G ( x, y ) f ( x, y )
2
01/20/25 15
01/20/25 16
The Canny Edge Detector
0 The Objective
01/20/25 17
The Canny Edge Detector: Algorithm (1)
Let f ( x, y ) denote the input image and
G ( x, y ) denote the Gaussian function:
x2 y 2
2 2
G ( x, y ) e
01/20/25 18
The Canny Edge Detector: Algorithm(2)
Compute the gradient magnitude and direction (angle):
M ( x, y ) g x 2 g y 2
and
( x, y ) arctan( g y / g x )
where g x f s / x and g y f s / y
01/20/25 19
The Canny Edge Detector: Algorithm(3)
The gradient M ( x, y ) typically contains wide ridge around
local maxima. Next step is to thin those ridges.
Nonmaxima suppression:
Let d1 , d 2 , d3 , and d 4 denote the four basic edge directions for
a 3 3 region: horizontal, -45o , vertical,+45 , respectively.
1. Find the direction d k that is closest to ( x, y ).
2. If the value of M ( x, y ) is less than at least one of its two
neighbors along d k , let g N ( x, y ) 0 (suppression);
otherwise, let g N ( x, y ) M ( x, y )
01/20/25 20
01/20/25 21
The Canny Edge Detector: Algorithm(4)
The final operation is to threshold g N ( x, y) to reduce
false edge points.
Hysteresis thresholding:
g NH ( x, y ) g N ( x, y ) TH
g NL ( x, y ) g N ( x, y ) TL
and
g NL ( x, y ) g NL ( x, y ) g NH ( x, y )
01/20/25 22