Image Filtering: in Fourier Domain in Spatial Domain
Image Filtering: in Fourier Domain in Spatial Domain
Input Output
2D convolution
image image
f(x,y) g(x,y)
h(x,y)
(x,y)
IF{H(u,v)}=h(x,y)
!
" #$ #$
Image filtering – the algorithm
%&'' #( &'' #( ) * +
, " $ - " .
%# " $ '' " $ # " $ '' " $ ) +
'''
( #$ / ( #$
*
% /) &+
# " $ " $ # " $ " $
% /) % /) 0 % 0 /0 ) % 0 /0 )+
+
'''
1 % /) 222
Low pass filter
1 1 1 1 1
1 1 1 1 1 1 1 1
1 1
h1 = 1 1 1 h2 = 1 1 1 1 1
9 25
1 1 1 1 1 1 1 1
1 1 1 1 1
3 4 "
Frequency characteristics of low pass filters
H=freqz(h,m,n)
Low-pass filtering the image
5
Gaussian filter
1 2 1 0.0113
h= h= 2 4 2
1 2 1
− π( x 2 + y 2 )
d02
h( x, y ) = e
− πd 0 2 (u 2 + v 2 )
H (u , v) =e N
Image filtering using the Gaussian filter
Image low-pass filters - examples
6 * 8 !
7 & &'&(
7 ! 9& &
Image low-pass filters - examples
6 *
7 & &'&(
! #
7 ! 9& &
Image low-pass filters - examples
6 * 8 !
7 & &'&&$
7 ! 9& &
High-pass filters (derivative filters)
mask h1 mask h2
The „high boost” filter
f ( x, y ) = f L ( x , y ) + f H ( x , y )
f HB ( x, y ) = Af ( x, y ) − f L ( x, y ) =
= ( A − 1) f ( x, y ) + f ( x, y ) − f L ( x, y ) =
= ( A − 1) f ( x, y ) + f H ( x, y ), A ≥1
−1 −1 −1
A=? hHB = − 1 9 A − 1 − 1
−1 −1 −1
High boost filter - example
: ( '( : ('
A modified Laplace filter
%MATLAB
out_image = filter2(filter_mask, in_image);
Nonlinear filters
NO
Because transfer characteristics of nonlinear
filters depend on image content itself!
Median filter (order statistic filter)
m m.
x(n)={1, 5, -7, 101, -25, 3, 0, 11, 7}
median
Median filtering the image
, + ∈ .
;
Demo – median filter
%MATLAB
out_image = medfilt2(in_image, [m n]);
Median filter
Median filter:
[1 x 3] 1/3*[1 1 1]
median average
MATLAB Demo – median filter