Lecture-4-Edge-detection-Part-II (2)
Lecture-4-Edge-detection-Part-II (2)
Computer Vision
Yogesh S Rawat
[email protected]
HEC-241
Lecture 4
f*g
d
( f g)
dx
Source: S. Seitz
9/14/2021 Lecture 3 –Edge Detection 3
Edge detection – fewer steps
d
g
dx
d
f g
dx
Source: S. Seitz
9/14/2021 Lecture 3 –Edge Detection 4
Prewitt and Sobel Edge Detector
• Smoothing
• Compute derivatives
• In x and y directions
• Find gradient magnitude
• Threshold gradient magnitude
df
= f ( x) − f ( x − 1) = f ( x) Backward difference
dx
df
= f ( x) − f ( x + 1) = f ( x) Forward difference
dx
df
= f ( x + 1) − f ( x − 1) = f ( x) Central difference
dx
Gradient magnitude f ( x, y) = f x2 + f y2
fx
Gradient direction = tan −1
fy
average derivative
image smoothing in y blurred filtering in y edges in y
1 1 1 1 1 1 1
1 1 1 −1 0 0 0
and
− 1 − 1 − 1
average derivative
image smoothing in y blurred filtering in y edges in y
1 2 1 1 1 2 1
1 2 1 −1 0 0 0
and
− 1 − 2 − 1
1 0 − 1
2 0 − 2 d
I
1 0 − 1 dx
*
Threshold Edges
Image I d d
2
I + I
2
dx dy
1 1 d
* 2 I
0 0 0 dy
− 1 − 2 − 1
d
I
dx
d
I
dy
2
d d
2
= I + I
dx dy
Threshold = 100
1st derivative
2nd derivative
S = g * I
( )
2 S = 2 (g * I ) = 2 g * I
1 𝑥 2 +𝑦 2
−
𝑔(𝑥, 𝑦) = 𝑒 2𝜎2
2𝜋𝜎
1 𝑥2 + 𝑦2 𝑥 2 +𝑦 2
−
Δ2 𝑔 𝑥, 𝑦 = − 2− 𝑒 2𝜎2
2𝜋𝜎 3 𝜎2
2 3 2
Requires 4n multiplications
Image + 𝐼 ∗ Δ2 𝑆
gxx(x) g(y)
I I* g( ) 2
Zero crossings of 2 S
=1
=3
=6
Gradient High
magnitude
low
x x x
Sources for this lecture include materials from works by Mubarak Shah,
Abhijit Mahalanobis, and D. Lowe
Other sources from James Hays, Lana Lazebnik, Steve Seitz, David Forsyth, David Lowe, Fei-Fei Li, and Derek Hoiem