Professional Documents
Culture Documents
Sharpening filter
Types of filters
• A filter that attenuates high frequencies while passing
low frequencies is called low pass filter. Low pass
filter are usually used for smoothing.
• Whereas, a filter that do not affect high frequencies is
called high pass filter. High pass filters are usually
used for sharpening.
Sharpening Spatial Filters
A B
1st Derivative
The formula for the 1st derivative of a function is as follows:
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 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0
1st Derivative
8
6
4
2
0
-2
-4
-6
-8
2nd Derivative
The formula for the 2nd derivative of a function is as follows:
f2
f ( x 1) f ( x 1) 2 f ( x)
x
2
Simply takes into account the values both before and after the
current value
Image Strip
8
7
6
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
-1 0 0 0 0 1 0 6 -12 6 0 0 1 1 -4 1 1 0 0 7 -7 0 0
2nd Derivative
10
-5
-10
-15
Sharpening Spatial Filters
f f 2 2
f 2 2
2
x y
where the partial 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
(
x1
,2
y
)
f
(
x1
,y
)
f
(
x,
y
1
)f
(
x,
y
1)]
4f(
x,y
)
We can easily build a filter based on this 0 1 0
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
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
1st Derivative Filtering
f
Gx x
f f
G y
y
1st Derivative Filtering (cont…)
1
2
f f
2 2
x y
For practical reasons this can be simplified as:
f G x 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 z3
z4 z5 z6
z7 z8 z9
Roberts operator
Gx = (z6-z5) and Gy = (z8 – z5)
Prewitt operator z1 z2 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 z3
Gx = (z3+2z6 +z9) - (z1+2z4+z7) and z4 z5 z6
Gy = (z7+2z8+z9) - (z1+2z2+z3) z7 z8 z 9
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 achieved by (c)
subtracting (a) and (b)
Sobel filter of bone
scan (a) (d)
Combining Spatial Enhancement Methods
(cont…)
Result of applying a (h)
power-law trans. to
Sharpened image (g)
which is sum of (a)
and (f) (g)
The product of (c) and
(e) which will be used (f)
as a mask
(e)