0% found this document useful (0 votes)
29 views30 pages

Image Filtering: in Fourier Domain in Spatial Domain

The document discusses different types of image filtering techniques, including linear filters in the Fourier domain and spatial domain, as well as non-linear filters. It describes how linear filters like low-pass filters are implemented using 2D convolution with a filter mask in the spatial domain. Common linear filters include Gaussian and derivative filters. Non-linear filters like median filters are also covered, which replace pixel values with the median of neighboring pixels. Examples of filtering a noisy image with a median filter are shown to reduce salt-and-pepper noise while retaining edges.

Uploaded by

Select dsouza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views30 pages

Image Filtering: in Fourier Domain in Spatial Domain

The document discusses different types of image filtering techniques, including linear filters in the Fourier domain and spatial domain, as well as non-linear filters. It describes how linear filters like low-pass filters are implemented using 2D convolution with a filter mask in the spatial domain. Common linear filters include Gaussian and derivative filters. Non-linear filters like median filters are also covered, which replace pixel values with the median of neighboring pixels. Examples of filtering a noisy image with a median filter are shown to reduce salt-and-pepper noise while retaining edges.

Uploaded by

Select dsouza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Image filtering

In Fourier domain In spatial domain

Linear filters Non-linear filters


Image filtering in spatial domain

Input Output
2D convolution
image image

f(x,y) g(x,y)

h(x,y)

g(x,y) = IF{ H(u,v) F{f(x,y)} } =


IF {H(u,v)}** IF {F {f(x,y)} } =
h(x,y)**f(x,y)
Filter definition in spatial domain

(x,y)
IF{H(u,v)}=h(x,y)

F( (x,y)) = (x,y) H(x,y)


Image and the filer mask convolution

h(-1,-1) h(-1,0) h(-1,1)

I(i-1,j-1) I(i-1,j) I(i-1,j+1)


h(0,-1) h(0,0) h(0,1)

I(i,j-1) I(i,j) I(i,j+1)


h(1,-1) h(1,0) h(1,1)

I(i+1,j-1) I(i+1,j) I(i+1,j+1)

This is true for symmetric masks only !


Computing the filtered image
Boundary effects
Boundary effects – 3x3 mask

!
" #$ #$
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)

−1 −1 −1 0.17 0.67 0.17


h1 = − 1 8 −1 h2 = 0.67 − 3.33 0.67
−1 −1 −1 0.17 0.67 0.17
High-pass filtering the image

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

0.17 0.67 0.17


h2 = 0.67 − 3.33 0.67
0.17 0.67 0.17

0.17 0.67 0.17


h' 2 = 0.67 − 2.33 0.67
0.17 0.67 0.17

In order to keep the average value of the image


add 1 do the centre element of the Laplace mask
Other high-pass filters
0 −1 0 −1 −1 −1
h '3 = − 1 5 −1 h'4 = − 1 9 −1
0 −1 0 −1 −1 −1
High-pass filters

%MATLAB
out_image = filter2(filter_mask, in_image);
Nonlinear filters

The filtered image is defined by a


non-linear function of the source image

Can we compute spectral


characteristics for 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}

Sorted sequence of elements:

xs(n)={-25, -7, 0, 1, 3, 5, 7, 11, 101 }

median
Median filtering the image

, + ∈ .

;
Demo – median filter

Source image distorted by Enhanced image using


„salt and pepper noise” the median filter (3x3)”

%MATLAB
out_image = medfilt2(in_image, [m n]);
Median filter

Median filter:

1. Excellent in reducing impulsive noise (od size


smaller than half size of the filtering mask)

2. Keeps sharpness of image edges (as


opposed to linear smoothing filters)

3. Values of the output image are equal or


smaller than the values of the input image
(no rescaling)

4. Large computing cost involved


Median filter

[1 x 3] 1/3*[1 1 1]

median average
MATLAB Demo – median filter

You might also like