Professional Documents
Culture Documents
3-Filtering in The Frequency Domain
3-Filtering in The Frequency Domain
1
The Discrete Fourier Transform (DFT) of One
Variable
M 1
F ( ) f ( x)e j 2 x / M , 0,1,..., M 1
x 0
M 1
1
f ( x)
M
F
0
( ) e j 2 x / M
, x 0,1, 2,..., M 1
11/17/2023 2
2-D Impulse and Sifting Property: Continuous
if t z 0
The impulse (t , z ), (t , z )
0 otherwise
and
(t , z ) dtdz 1
11/17/2023 3
2-D Impulse and Shifting Property: Discrete
1 if x y 0
The impulse ( x, y ), ( x, y)
0 otherwise
x y
f ( x, y ) ( x, y ) f (0, 0)
and
x y
f ( x, y ) ( x x0 , y y0 ) f ( x0 , y0 )
11/17/2023 4
2-D Fourier Transform: Continuous
F ( , ) f (t , z ) e j 2 ( t z )
dtdz
and
f (t , z ) f ( , )e j 2 ( t z )
d d
11/17/2023 5
2-D Fourier Transform: Continuous
F ( , ) f (t , z )e j 2 ( t z ) dtdz
T /2 Z /2
Ae j 2 ( t z ) dtdz
T /2 Z /2
sin(T ) sin( T )
ATZ T
T
11/17/2023 6
2-D Sampling and 2-D Sampling Theorem
2 D impulse train:
sT Z (t , z ) (t mT , z nZ )
m n
11/17/2023 7
2-D Sampling and 2-D Sampling Theorem
11/17/2023 9
Aliasing in Images: Example
In an image system, the
number of samples is fixed at
96x96 pixels. If we use this
system to digitize checkerboard
patterns …
Under-sampling
11/17/2023 10
Aliasing in Images: Example
Re-sampling
11/17/2023 11
Aliasing in Images: Example
Re-sampling
11/17/2023 12
2-D Discrete Fourier Transform and Its
Inverse
DFT:
M 1 N 1 j 2 ( x / M y / N )
F ( , ) f ( x, y )e
x 0 y 0
IDFT:
M 1 N 1 j 2 ( x / M y / N )
1
f ( x, y )
MN
F ( , )e
x 0 y 0
11/17/2023 13
Properties of the 2-D DFT
relationships between spatial and frequency intervals
11/17/2023 14
Properties of the 2-D DFT
translation and rotation
f ( x, y )e j 2 ( 0 x / M 0 y / N ) F ( 0 , 0 )
and
j 2 ( x0 / M y0 / N )
f ( x - x0 , y - y0 ) F ( , )e
f ( x, y ) f ( x k1M , y ) f ( x, y k2 N ) f ( x k1M , y k2 N )
f ( x ) e j 2 ( 0 x / M ) F ( 0 )
0 M / 2, f ( x)( 1) x F ( M / 2)
f ( x, y )( 1) x y
F ( M / 2, N / 2)
11/17/2023 16
Properties of the 2-D DFT
Symmetry
11/17/2023 17
Properties of the 2-D DFT
Fourier Spectrum and Phase Angle
Power spectrum
P (u , v) | F (u, v) |2 R 2 (u, v) I 2 (u , v)
Phase angle
I (u, v)
(u,v)=arctan
R (u , v )
11/17/2023 18
11/17/2023 19
11/17/2023 20
Example: Phase Angles
11/17/2023 21
Example: Phase Angles and The Reconstruction
11/17/2023 22
2-D Convolution Theorem
1-D convolution
M 1
f ( x ) h( x ) f ( m)h( x m)
m 0
2-D convolution
M 1 N 1
f ( x, y ) h ( x, y ) f (m, n)h( x m, y n)
m 0 n 0
11/17/2023 24
Summary
11/17/2023 25
Summary
11/17/2023 26
Summary
11/17/2023 27
The Basic Filtering in the Frequency Domain
11/17/2023 28
Histogram Processing Vs Frequency
domain Analysis of Image
► Both are fundamentally different
Histogram- plots the no. of repetitions of each intensity value from the
spatial domain (statistical info)
Spectrum- Plots the magnitude of a complex quantity F(u,v) obtained
after transforming the image through Fourier Transform
► Histogram Processing gives us the pixel density or loosely speaking
probability density of each pixel and relates to the brightness/contrast of
the image
The filter is making average intensity values of the image (dc value) zero resulting
into a blackish image while keeping the edges intact (having higher intensity values)
11/17/2023 31
The Basic Filtering in the Frequency Domain
Non-zero
spectrum
11/17/2023 32
Effect of Filtering on the Phase of the
Image: Zero-Phase-Shift Filters
1
g ( x, y ) {H (u , v) F (u , v)}
F (u , v) R (u , v) jI (u , v )
1
g ( x, y ) H (u, v) R(u, v) jH (u, v) I (u, v)
Filters affect the real and imaginary parts equally,
and thus no effect on the phase.
These filters are called zero-phase-shift filters
11/17/2023 33
Examples: Nonzero-Phase-Shift Filters
Even small
Phasechanges
angle is in the phase angle can ishave
Phase angle
dramaticmultiplied
(usually by undesirable) effects on the
multiplied by filtered
output 0.5 0.25
11/17/2023 34
The Effect of Zero-padding in Basic Filtering in
the Frequency Domain
Reason?
11/17/2023 Zero padding->Circular convolution->DFT?? 35
(Wraparound error)
Summary:
Steps for Filtering in the Frequency Domain
1. Given an input image f(x,y) of size MxN, obtain the
padding parameters P and Q. Typically, P = 2M and Q = 2N.
g p ( x, y ) real 1 G (u, v) ( 1) x y
11/17/2023 37
An Example:
Steps for Filtering in the Frequency Domain
11/17/2023 38
Correspondence Between Filtering in the
Spatial and Frequency Domains (1)
11/17/2023 40
Correspondence Between Filtering in the
Spatial and Frequency Domains (3)
The masks shown are the standard 2D masks used for LPF and HPF of images
11/17/2023 41 in
spatial domain. They are generated by sampling the Gaussian curve
Correspondence Between Filtering in the
Spatial and Frequency Domains: Example
600x600
11/17/2023 42
Correspondence Between Filtering in the
Spatial and Frequency Domains: Example
H(x,y)
H(u,v)
11/17/2023 43
Generate H(u,v) from h(x,y)
h ( x, y ) 0 x 2 and 0 y 2
h p ( x, y )
0 3 x 602 or 3 y 602
11/17/2023 44
Image Smoothing Using Frequency Domain Filters
• Ideal LPF
• Butterworth LPF
• Gaussian LPF
• Ideal HPF
• Butterworth HPF
• Gaussian HPF
11/17/2023 45
Image Smoothing Using Filter Domain Filters:
Ideal LPF
11/17/2023 46
Image Smoothing Using Frequency Domain
Filters: ILPF
11/17/2023 47
ILPF
Filtering
Example
with
different
cut-off
frequencies
11/17/2023 48
The Spatial Representation of ILPF
Observation-Ringing effect in the intensity image and the corresponding side lobes in Sinc
function. It arises due to sharp transition in frequency domain and the corresponding side
lobes in spatial domain
11/17/2023 49
Image Smoothing Using Frequency Domain
Filters: BLPF
Butterworth Lowpass Filters (BLPF) of order n and
with cutoff frequency D0
1
H (u , v )
1 D(u , v) / D0
2n
11/17/2023 50
Observation- Sharp and smooth transition in case of ILPF and BLPF
11/17/2023 51
The Spatial Representation of BLPF
11/17/2023
Observation-Ringing effect as order increases. Side lobes of the Sinc 52
function responsible for generating ringing effect
Image Smoothing Using Frequency Domain
Filters: GLPF
By letting D0
D 2 ( u ,v )/2 D0 2
H (u , v ) e
11/17/2023 54
11/17/2023 55
Examples of smoothing by GLPF (1)
11/17/2023 56
Examples of smoothing by GLPF (2)
11/17/2023 57
Image Smoothing Using Frequency Domain Filters
• Ideal LPF
• Butterworth LPF
• Gaussian LPF
• Ideal LPF
• Butterworth LPF
• Gaussian LPF
11/17/2023 58
Image Sharpening Using Frequency Domain
Filters
H HP (u , v) 1 H LP (u, v)
11/17/2023 59
Image Sharpening Using Frequency Domain
Filters
11/17/2023 60
11/17/2023 61
The Spatial Representation of Highpass Filters
Observation-Ringing effect in the intensity image and the corresponding side lobes in
Sinc function.
No ringing effect in Butterworth filter at lower order but present at higher order as it
tends to ideal HPF when order increases
11/17/2023 62
Ringing
effect
11/17/2023 63
Filtering Results by BHPF
11/17/2023 64
Filtering Results by GHPF
11/17/2023 65
Using Highpass Filtering and Threshold for
Image Enhancement
BHPF
(order 4 with a cutoff
frequency 50)
11/17/2023 66
The Laplacian in the Frequency Domain
Enhancement is obtained
g ( x, y ) f ( x, y ) c 2 f ( x, y ) c -1
11/17/2023 67
The Laplacian in the Frequency Domain
1 1 4 2 D 2 (u , v) F (u , v)
11/17/2023 68
The Laplacian in the Frequency Domain
11/17/2023 69
Unsharp Masking, Highboost Filtering and
High-Frequency-Emphasis Fitering
Unsharp masking
fUM ( x, y ) f ( x, y ) f LP ( x, y )
f LP ( x, y ) 1 H LP (u , v) F (u , v)
highboost filtering
f hb ( x, y ) Af ( x, y ) f LP ( x, y )
=( A 1) f ( x, y ) f HP ( x, y )
H hb (u , v) ( A 1) H HP (u, v)
11/17/2023 f hb ( x, y ) 1 H hb (u , v) F (u , v) 70
Gaussian Filter
D0=40
High-Frequency-Emphasis Filtering
Gaussian Filter
K1=0.5, k2=0.75
11/17/2023 71
Homomorphic Filtering
f ( x , y ) i ( x, y ) r ( x , y )
f ( x, y )
= i ( x, y ) r ( x, y ) ?
z ( x, y ) ln f ( x, y ) ln i ( x, y ) ln r ( x, y )
Z (u , v) Fi (u , v) Fr (u , v)
11/17/2023 72
Homomorphic Filtering
S (u , v) H (u, v) Z (u , v)
H (u, v) Fi (u, v) H (u, v) Fr (u, v)
s ( x, y ) 1 S (u , v)
1 H (u, v) Fi (u, v) H (u, v) Fr (u, v)
1 H (u, v) Fi (u, v) 1 H (u, v) Fr (u, v)
i '( x, y ) r '( x, y )
11/17/2023 73
Homomorphic Filtering
H (u , v) ( H L ) 1 e
c D 2 ( u ,v )/ D02
L
11/17/2023 75
L 0.25
Homomorphic
H 2
Filtering
c 1
D0 80
11/17/2023 76
Homomorphic Filtering
11/17/2023 77
Selective Filtering
Non-Selective Filters:
operate over the entire frequency rectangle
Selective Filters
operate over some part, not entire frequency rectangle
• bandreject or bandpass: process specific bands
• notch filters: process small regions of the frequency
rectangle
11/17/2023 78
Selective Filtering:
Bandreject and Bandpass Filters
H BP (u , v) 1 H BR (u, v)
11/17/2023 79
Selective Filtering:
Bandreject and Bandpass Filters
11/17/2023 80
Selective Filtering:
Notch Filters
Zero-phase-shift filters must be symmetric about the origin.
A notch with center at (u0, v0) must have a corresponding
notch at location (-u0,-v0).
where H k (u, v) and H - k (u, v) are highpass filters whose centers are
at (uk , vk ) and (-uk , -vk ), respectively.
11/17/2023 81
Selective Filtering:
Notch Filters
Q
H NR (u , v) H k (u , v) H k (u , v)
k 1
2 1/2
D k (u , v) (u M / 2 uk ) (v N / 2 vk )
2
11/17/2023 82
Examples:
Notch
Filters (1)
A Butterworth notch
reject filter D0 =3
and n=4 for all
notch pairs
11/17/2023 83
Examples:
Notch Filters
(2)
11/17/2023 84
11/17/2023 85