Professional Documents
Culture Documents
Image Enhancement
(Spatial Filtering 2)
ANISHA M. LAL
Sharpening Spatial Filters
A B
1st Derivative
f
f ( x 1) f ( x)
x
It’s just the difference between subsequent values and
measures the rate of change of the function
Image Strip
8
7
6
5
4
1st Derivative (cont…)
3
2
1
0
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 01st0Derivative
0 1 2 -2 -1 0 0 0 7 0 0 0
8
6
4
2
0
-2
-4
-6
-8
2nd Derivative
f
2
f ( x 1) f ( x 1) 2 f ( x)
x
2
8
7
6
5
4
2nd Derivative (cont…)
3
2
1
0
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 62nd0Derivative
0 1 1 -4 1 1 0 0 7 -7 0 0
10
-5
-10
-15
Sharpening Spatial Filters
f f 2 2
f 2 2
2
x y
where the partial 1st order derivative in the x direction is defined as
follows:
f
2
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
x
2
f [ f ( x 1, y) f ( x 1, y)
2
f ( x, y 1) f ( x, y 1)]
4 f ( x, y)
0 1 0
We can easily build a filter based on this
1 -4 1
0 1 0
The Laplacian (cont…)
Applying the Laplacian to an image we get a new image
that highlights edges and other discontinuities
g ( x, y) f ( x, y) f 2
Laplacian
Filtered Image
Scaled for Display
Laplacian Image Enhancement
- =
Original Laplacian Sharpened
Image Filtered Image Image
In the final sharpened image edges and fine detail are much
more obvious.
Laplacian Image Enhancement
Simplified Image Enhancement
The entire enhancement can be combined into a single
filtering operation,
g ( x, y) f ( x, y) f 2
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)
Simplified Image Enhancement
(cont…)
This gives us a new filter which does the whole job for us in
one step,
0 -1 0
-1 5 -1
0 -1 0
Simplified Image Enhancement
(cont…)
Variants On The Simple Laplacian
There are lots of slightly different versions of the Laplacian
that can be used:
0 1 0 1 1 1
1 -4 1 Simple 1 -8 1 Variant of
Laplacian Laplacian
0 1 0 1 1 1
-1 -1 -1
-1 9 -1
-1 -1 -1
Enhanced Image using Laplacian
z1 z2 z3
z4 z5 z6
z7 z8 z9
1st Derivative Filtering
f
Gx x
f f
G y
y
1st Derivative Filtering (cont…)
f mag(f )
G G 2
x
2
y
1
2
1
f 2 f 2
2
x y
For practical reasons this can be simplified as: f Gx G y
Use of First Derivative for Edge Extraction
Gradient
First derivatives in image processing are implemented
using the magnitude of the gradient.
z1 z2 z 3
z 4 z5 z6
z7 z8 z9
Roberts operator
Gx = (z6-z5) and Gy = (z8 – z5)
Prewitt operator z1 z 2 z3
Gx = (z3+z6 +z9) - (z1+z4+z7) and z4 z5 z6
Gy = (z7+z8+z9) - (z1+z2+z3) z7 z8 z9
-1 0 1 -1 -1 -1
-1 0 1 0 0 0
-1 0 1 1 1 1
Prewitt operators
Sobel Operators
Sobel operator z1 z2 z 3
Gx = (z3+2z6 +z9) - (z1+2z4+z7) and z 4 z5 z6
Gy = (z7+2z8+z9) - (z1+2z2+z3) z7 z8 z9
To filter an image it is filtered using both operators the results
of which are added together
-1 0 1 -1 -2 -1
Sobel operators -2 0 2 0 0 0
-1 0 1 1 2 1
Sobel Example
(a)
Laplacian filter of
bone scan (a)
(b)
Sharpened version
of bone scan (c)
achieved by
subtracting (a) and Sobel filter of bone
(b) scan (a) (d)
Combining Spatial Enhancement
Methods (cont…)
Result of applying (h)
a power-law trans.
Sharpened image to (g)
which is sum of (a)
and (f) (g)
The product of (c)
and (e) which will (f)
be used as a mask
(e)