ImageProcessing6 SpatialFiltering2 Modi
ImageProcessing6 SpatialFiltering2 Modi
Image Enhancement
(Spatial Filtering 2)
Spatial Avg
• U(m,n) V(m,n)
3
of
30
-1 -1 -1
-1 8 -1
-1 -1 -1
8
of
30
-1 -1 -1
1/9 X -1 8 -1
-1 -1 -1
9
of
30
-1 -1 -1
1/9 x -1 w -1
-1 -1 -1
• LPF=integration
• HPF=differentiation
Derivative Filters
15
of
30
1st Derivative Filtering
Implementing 1st derivative filters is difficult in
practice
For a function f(x, y) the gradient of f at
coordinates (x, y) is given as the column
vector:
f
Gx x
f f
Gy
y
16
of
30
17
of
30
1st Derivative Filtering (cont…)
The magnitude of this vector is given by:
f mag (f )
G G2
x
2
y 1
2
1
f f
2 2 2
x y
z1 z2 z3
1 -1
0 0
z4 z5 z6
1 0
z7 z8 z9 -1 0
• Cross gradient:
f =|(z5-z9)|+|z6-z8|
Robert’s operator:
1 0 0 1
0 -1 -1 0
20
of
30
-1 -1 -1
= 0 0 0
1 1 1
21
of
30
Prewitt’s operator
-1 0 1
=
-1 0 1
-1 0 1
22
of
30
Sobel operator
-1 0 1
=
-2 0 2
-1 0 1
23
of
30
Sobel operator
-1 -2 -1
= 0 0 0
1 2 1
24
of
30
Sobel operator
-1 -2 -1
0 0 0
1 2 1
25
of
30
At 45⁰
Rotate the mask
-1 -1 0
0 1
-1
0 1 1
26
of
30
g(x,y)=max{gk(x,y) }
Where, k=0,1,…7.
28
of
30
2nd Derivative
Zero
crossing
29
of
30
1 -4 1
0 1 0
33
of
30