Title: Spatial Domain Filter Design and Fourier Transform
1Spatial Domain Filter Design and Fourier
Transform
SUKHROB ATOEV
2Contents
- Image Filtering structure
- Spatial Filtering Definition
- Discrete Convolution
- Smoothing Filters
- Fourier Transform
3Image Filtering structure
4Spatial Filtering Definition
- Spatial filtering term is the filtering
operations that are performed directly on the
pixels of an image. - The process consists simply of moving the filter
mask from point to point in an image. - At each point (x,y) the response of the filter at
that point is calculated using a predefined
relationship.
5Image filtering in spatial domain
Linear System
Input image
Output image
g(x,y)
f(x,y)
h(x,y)
The spatial filter design involves convolving the
input image f(m,n) with the filter function
h(m,n). This can be written as
6Discrete Convolution
The filtered image is described by a discrete
convolution. Discrete convolution is composed of
three operations shift, multiply, and summation.
For a square kernel with size MM, we can
calculate the output image with the following
formula The filter is described by a mxn
discrete convolution mask.
7Computing the filtered image
h
f(x,y)
g(x,y)
g(x,y) h(x,y) f(x,y)
Source image f
Output image g
8Smoothing 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
object extraction, and bridging of small gaps in
lines or curves. - Noise reduction can be accomplished by blurring
- Smoothing Filters
- Mean Filter
- Median Filter
- Conservative Smoothing
- Gaussian Smoothing
9Mean Filter
The mean filter is a simple sliding-window
spatial filter that replaces the center value in
the window with the average (mean) of all the
pixel values in the window.
1151191201231241251261271461125
1125/9 125
123 125 126 130 140
122 124 126 127 135
118 120 146 125 134
119 115 119 123 133
111 116 110 120 130
10Mean Filter
3 x 3 5 x 5
7 x 7
11Median Filter
- In order to perform median filtering in a
neighbourhood of a pixel i.j - Sort the pixels into ascending order by gray
level. - Select the value of the middle pixel as the new
value for pixel i.j
Neighbourhood values 115, 119, 120, 123, 124,
125, 126, 127, 146 Median value 124
123 125 126 130 140
122 124 126 127 135
118 120 146 125 134
119 115 119 123 133
111 116 110 120 130
12Median Filter
After smoothing with a 33 filter
Original Image
77 filter
13Conservative Smoothing
- Conservative smoothing operates on the assumption
that noise has a high spatial frequency. - If the central pixel intensity is greater than
the maximum value, it is set equal to the maximum
value if the central pixel intensity is less
than the minimum value, it is set equal to the
minimum value.
Neighbourhood values 115, 119, 120, 123, 124,
125, 126, 127, 146 Max 127 Min 115
123 125 126 130 140
122 124 126 127 135
118 120 146 125 134
119 115 119 123 133
111 116 110 120 130
14Comparison of results
a)
b)
c)
After mean filtering, the image is still noisy,
as shown in (a)
After median filtering, all noise is suppressed,
as shown in (b)
Conservative smoothing, some noise in places
where the pixel neighborhoods were contaminated
by more than one intensity spike. (c)
15Gaussian smoothing
- The Gaussian smoothing operator is a 2D
convolution operator that is used to blur
images and remove details and noise. - The equation of a Gaussian function in two
dimension is
where x is the distance from the origin in the
horizontal axis, y is the distance from the
origin in the vertical axis, and s is
the standard deviation of the Gaussian
distribution.
16Gaussian smoothing (contd)
17Gaussian smoothing (contd)
The effects of a small and a large Gaussian
smoothing
18Fourier Transform
- All Periodic Waves Can be Generated by Combining
Sin and Cos Waves of Different Frequencies. - Number of Frequencies may not be finite.
- Fourier Transform Decomposes a Periodic Wave into
its Component Frequencies. - A fast Fourier transform (FFT) algorithm computes
the discrete Fourier transform (DFT) of a
sequence, or its inverse. - Fourier analysis converts a signal from its
original domain (often time or space) to a
representation in the frequency domain and vice
versa.
19Fourier Transform (contd)
For an image of size M N, the two-dimensional
DFT is given by
??(??,??) 1 ???? ??0 ??-1 ??0 ??-1 ??(??,??)
?? -??2??( ???? ?? ???? ?? )
An inverse transformation is also possible and is
given by
??(??,??) 1 ???? ??0 ??-1 ??0 ??-1 ??(??,??)
?? ??2??( ???? ?? ???? ?? )
f(m,n) is the image in the spatial domain F(u,v)
is the value of each point in the Fourier
20Fourier Transform (contd)
f (?)
f?(t)
g (?)
g(t)
f?(t) - unit pulse function
f (?) - Fourier transform of f?(t)
g (?) - real and imaginary parts of the Fourier
transform
g(t) - delayed unit pulse
21Fourier Transform (contd)
In the first frames of the animation, a
function f is resolved into Fourier series.
The component frequencies are represented as
peaks in the frequency domain (shown in the last
frames of the animation).
22Fourier Transform (contd)
Fast Fourier Analysis of a Cosine Summation
Function resonating at 10, 20, 30, 40, and 50 Hz
232D FFT
Some parts of the code
24(No Transcript)
25Results
26Results
27Thank You!