Image Processing 6-SpatialFiltering2
Image Processing 6-SpatialFiltering2
Image Enhancement
(Spatial Filtering 2)
2
of
30
Contents
In this lecture we will look at more spatial
filtering techniques
Spatial filtering refresher
Sharpening filters
1st derivative filters
2nd derivative filters
3
of
30
Origin
Simple 3*3
Neighbourhood
3*3 Filter
Image f (x, y)
Original Image
Pixels
Filter
eprocessed = v*e +
r*a + s*b + t*c +
u*d + w*f +
x*g + y*h + z*i
4
of
30
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
5
of
30
Spatial Differentiation
Differentiation measures the rate of change of
a function
Lets consider a simple 1 dimensional
example
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
6
of
30
Spatial Differentiation
A
B
7
of
30
1st Derivative
The formula for the 1st derivative of a
function is as follows:
f
f ( x 1) f ( x)
x
8
of
30
5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
0 -1 -1 -1 -1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0
9
of
30
2nd Derivative
The formula for the 2nd derivative of a
function is as follows:
f
f ( x 1) f ( x 1) 2 f ( x)
2
x
2
10
of
30
5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
-1 0 0 0 0 1 0 6
-12
6 0 0 1 1 -4 1 1 0 0 7 -7 0 0
11
of
30
12
of
30
The Laplacian
The Laplacian is defined as follows:
f f
f 2 2
x y
where the partial 1st order derivative in the x
direction is defined as follows:
2
f
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
2
x
and in the y direction as follows:
2
f
f ( x, y 1) f ( x, y 1) 2 f ( x, y )
2
y
2
13
of
30
f [ f ( x 1, y ) f ( x 1, y )
f ( x, y 1) f ( x, y 1)]
4 f ( x, y )
2
-4
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
14
of
30
Original
Image
Laplacian
Filtered Image
Laplacian
Filtered Image
Scaled for Display
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
15
of
30
g ( x, y ) f ( x, y ) f
2
Laplacian
Filtered Image
Scaled for Display
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
16
of
30
Original
Image
=
Laplacian
Filtered Image
Sharpened
Image
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
17
of
30
18
of
30
g ( x, y ) f ( x, y ) f
f ( x, y ) [ f ( x 1, y ) f ( x 1, y )
f ( x, y 1) f ( x, y 1)
4 f ( x, y )]
5 f ( x, y ) f ( x 1, y ) f ( x 1, y )
f ( x, y 1) f ( x, y 1)
2
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
19
of
30
-1
-1
-1
-1
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
20
of
30
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
21
of
30
-4
Simple
Laplacian
-8
-1
-1
-1
-1
-1
-1
-1
-1
Variant of
Laplacian
22
of
30
23
of
30
Gy
24
of
30
G G
2
x
2
y
f
f
x
y
2
25
of
30
z3 2 z6 z9 z1 2 z 4 z7
z2
z3
z4
z5
z6
z7
z8
z9
26
of
30
Sobel Operators
Based on the previous equations we can
derive the Sobel Operators
-1
-2
-1
-1
-2
-1
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
27
of
30
Sobel Example
An image of a
contact lens which
is enhanced in
order to make
defects (at four
and five oclock in
the image) more
obvious
28
of
30
29
of
30
Summary
In this lecture we looked at:
Sharpening filters
1st derivative filters
2nd derivative filters
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
30
of
30
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
31
of
30
(a)
Laplacian filter
bone scan (a)
of
(b)
Sharpened version of
bone scan achieved
(c)
by subtracting (a)
Sobel filter of bone
and (b)
scan (a)
(d)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
32
of
30
Result of applying a
power-law trans. to
Sharpened image (g)
which is sum of (a)
(g)
and (f)
(f)
(h)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
33
of
30