Linear Systems: - Many Image Processing (Filtering) Operations Are Modeled As A Linear System
Linear Systems: - Many Image Processing (Filtering) Operations Are Modeled As A Linear System
g ( x , y ) f ( x, y ) h ( x , y )
f ( x, y)h( x x, y y)dxdy
δ(x,y)
0 t
f (k , l )h(i k , j l )
k 1 l 1
x 0 y 0
– t(x,y): template
– M,N size of the template
E.G.M. Petrakis Filtering 8
D x, y
2
M N
M N
t x x, y y
x 1 y 1
2
correlation:
convolution of
M N f(x,y) with t(-x,-y)
2 f x, y t x x, y y
x
E.G.M. Petrakis
1 y 1 Filtering 9
true best match
1 1 1 1 1 0 0 0 4 5 3
1 1 1 1 1 1 0 0 5 7 3
1 1 1 1 0 1 0 0 3 5 8 7
0 0 0 5 0 6 6
0 0 0 0 0
– E : expected value
p
i 1
i q1 pi
i 1
– all pixels with values z1,z2,…,zk-1 become z1
E.G.M. Petrakis Filtering 17
Algorithm (conted)
2. Scan the input histogram from k1 and to the right to
find k2:
k2 1 k2
p
i 1
i q1 q2 pi
i 1
a. Original image
b. Original image
c. Salt and pepper noise
d. Impulse noise
e. Gaussian noise
E.G.M. Petrakis Filtering 21
Noise Filtering
• Basic Idea: replace each pixel intensity value with
an new value taken over a neighborhood of fixed
size
– Mean filter
– Median filter
• The size of the filter controls degree of smoothing
– large filter large neighborhood intensive
smoothing
1
hi, j f k , l
mn km ln
– the normalization factor mn preserves the range
of values of the original image
E.G.M. Petrakis Filtering 23
Mean Filtering as Convolution
• Compute the convolution of the original
image with
1 1 1
1
g i, j 1 1 1
3 3
1 1 1
h x, y f x , y g x , y
hx, y f x, y g x, y g x, y
E.G.M. Petrakis Filtering 34
2
2
x 2
g x g x e 2
e 2 2
d
2 2
x x
2 2
e
2 2
e 2 2
d
2 x2
2
2 x2
d e 2
e
2
2 2 2
m n
k 2
l 2
e 2 2
f i k , j l
k 1 l 1
1-D Gaussian
vertically
• The order of convolutions can be reversed
E.G.M. Petrakis Filtering 38
• An example of the separability of Gaussian
convolution
– left: convolution with vertical mask
– right: convolution with horizontal mask
E.G.M. Petrakis Filtering 39
Gaussian Separability
• Filtering with a 2D Gaussian can be
implemented using two 1D Gaussian
horizontal filters as follows:
– first filter with an 1D Gaussian
– take the transpose of the result
– convolve again with the same filter
– transpose the result
• Filtering with two 1D Gausians is faster !!
E.G.M. Petrakis Filtering 40
a. Noisy image
b. Convolution with
1D horizontal
mask
c. Transposition
d. Convolution with
same 1D mask
e. Transposition
smoothed image