Unit 2
Unit 2
IMAGE FILTERING
1
INTRODUCTION TO DIP
2
FILTERING
spatial domain
frequency domain.
3
SPATIAL DOMAIN FILTERS
4
MECHANISM OF SPATIAL FILTERING
This process shows
moving filter mask
point to point
a b
g (x, y) = w ( s,t ) f ( x + s, y +t )
s=−a t =−b
7
LINEAR SPATIAL FILTERING
For a mask of size=m × n
Assume that
m=2a+1
n=2b+1
8
CONVOLUTION
9
When interest lies on the response, R, of an m x n mask at
any point (x , y), and not on the mechanics of implementing
mask convolution
It is a simplified notation
R = w1 z1 + w 2 z 2 + . . . + w m n z m n
mn
= wi zi
i=1
10
w1 w2 W3
w4 w5 w6
w7 w8 w9
11
SMOOTHING SPATIAL FILTERS
Smoothing filters are used for blurring and for noise reduction
Blurring is used in preprocessing steps, such as removal of
small details from an image prior to (large) object extraction,
and bridging of small gaps in lines or curves.
12
Smoothing spatial filter is done in two ways
Linear filters
13
SMOOTHING LINEAR FILTERS
linear spatial filter is simply the average of the pixels
contained in the neighborhood of the filter mask.
averaging filter
weighted average
15
AVERAGING FILTER
A major use of averaging filters is in the reduction of
“Irrelevant” detail in an image
1/ m n.
16
AVERAGING FILTER
1 1 1
1
1 1 1
9 1 1 1
R =
1
9
z 1,
i=1
17
AVERAGING FILTER
18
WEIGHTED AVERAGING FILTER
19
WEIGHTED AVERAGE
1 2 1
1
2 4 2
16 1 2 1
20
The general implementation for filtering an M x N image with
a weighted averaging filter of size
a b
w( s , t) f ( x + s, y + 1)
g ( x, y) = s = − at = − b
a b
w(s, t)
s = − at = − b
21
EXAMPLE OF WEIGHTED AVERAGING
FILTER
22
ORDER STATISTICS FILTERS
23
MEDIAN FILTER
Median filters used for noise-reduction with less blurring than
linear smoothing filters of similar size.
24
EXAMPLE FOR MEDIAN FILTER
25
FREQUENCY DOMAIN FILTERS
26
SMOOTHING FREQUENCY DOMAIN FILTERS
27
SMOOTHING FREQUENCY DOMAIN FILTERS
0 if D(u , v) > D 0
29
D is a specified nonnegative quantity, and D(u, v) is the
distance from point (u, v) in the frequency domain and the
center of frequency rectangle
D (u , v ) = (u − M 2 ) 2 + (v − N 2)2
1
2
30
VISUALIZATION
32
33
APPLYING ILPF TO A IMAGE IN DIFFERENT
FREQUENCIES
34
BUTTERWORTH FILTER
The transfer function of the Butterworth low pass (BLPF) of
order n and with cutoff frequency locus at a distance Do, from
the origin is defined by the relation.
1
H (u, v) =
1 + D(u, v) / D0 2 n
BLPF transfer function does not have a sharp discontinuity
that establishes a clear cutoff between passed and filtered
frequencies
35
BUTTERWORTH LOW PASS FILTER
37
GAUSSIAN IMAGE FILTERING
38
GAUSSIAN LOW PASS FILTERS
40
SHARPENING FREQUENCY DOMAIN
FILTERS
42
Sharpening technique is reverse operation of low pass filters
When the low pass filters attenuates frequencies , the high
pass filter passes them
43
IDEAL HIGH PASS FILTER
It is defined as
0 if D(u , v) > D0
44
45
BUTTERWORTH HIGH PASS FILTER
1
H ( u, v ) = 1 −
1 + D(u, v ) / D 0
2n
46
47
GAUSSIAN HIGH PASS FILTER
2 2
(u,v)/ 2
H(u,v) = 1 − e − D
48
49
PERSPECTIVE PLOT , IMAGE REPRESENTATION
AND CROSS SECTION OF IHPF,BHPF,GHPF
50
THANK YOU
51