0% found this document useful (0 votes)
21 views52 pages

Chapter 4 - Frequency Domain Processing

Uploaded by

melesew mossie
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)
21 views52 pages

Chapter 4 - Frequency Domain Processing

Uploaded by

melesew mossie
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/ 52

Chapter 4

FREQUENCY DOMAIN PROCESSING

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

1
The Lessons:

• Frequency Domain Processing


– Basic steps in frequency domain
– Low pass Filter (smoothing filters)
• Ideal lowpass, Butterworth lowpass, Gaussian lowpass
– High pass Filter (sharpening filters)
• Ideal highpass, Butterworth highpass , Gaussian highpass
• Learning Outcomes:
– To understand frequency filter operation.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

2
• Frequency- Number of times a periodic function repeats itself
per unit change in the independent variable.
• Periodic Function:- Function which have uniform structure
throughout.
• Fourier Series :- Any function that periodically repeats itself
can be expressed as a sum of sines and cosines of different
frequencies each multiplied by a constant factor. This sum is
known as Fourier series.
• Fourier Transform:- The function which are not periodic but
finite can be expressed as integral of sines and cosines
multiplied by weighting function. This is known as Fourier
transform.
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
• Functions expressed in either Fourier series or Fourier
transform can be reconstructed completely via inverse
process with no loss of information.

• We will deal only with functions (images) of finite duration,


so we are interested in Fourier transform. Fourier transform
provides some ways to study and implement image
enhancement techniques.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

4
1-D Fourier Transform and its Inverse

• F (u)- Fourier Transform


f (x)- single variable continuous function (image)
1-D Fourier transformation equation

+∞
F (u) = ∫ f (x) e -j 2Πux dx
-∞

Where j= √-1

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

5
1-D Inverse Fourier Transform

+∞
f (x) = ∫ F (u) e j2Πux du
-∞
 Given F (u) we can obtain f (x) by inverse Fourier transform.
These two equations is Fourier transform pair.
 It shows function (image) can be recovered from Fourier
transform.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

6
Discrete Fourier Transform

f (x) – discrete function for one variable


x = 0,1,2,…,M-1
M-1
F (u) = 1/M Σ f (x) e –j2Πux / M
x=0

u= 0,1,2,…,M-1
Inverse
M-1
f (x) = Σ F (u) e j2Πux /M
u=0

x= 0,1,2,…,M-1
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

7
Frequency Domain
 Each term of the Fourier transform is composed of sum of all values
of function f (x).
 The values f (x) are multiplied by sines and cosines of various
frequencies. The domain over which the values of F (u) lies is
known as frequency domain.
 u is frequency of all the components of transform. Each term M of F
(u) is called frequency component of transform. Fourier transform
can be compared with a glass prism. A prism separates light into
various color components each containing different wavelength and
frequency.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

8
• It is a mathematical prism which separates a function (image) into
various components each component having different frequency. This
concept will be used for filtering purpose.
• Since components of Fourier transform are complex quantities, so we
express F (u) in polar co-ordinates.
• Magnitude of Fourier transform:
• F (u) in polar co-ordinates
F (u)= I F (u) I e –jΦ(u)
where, I F (u) I = [ R2 (u) + I2 (u)]1/2
and Φ(u) = tan -1 (I (u) / R (u)) is phase angle or phase spectrum of
transform.
• P (u) = IF(u)I2 Spectral density or Power spectrum
• R (u) and I (u) are real and imaginary part of F (u) respectively.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

9
2-D DFT and its Inverse

• f (x,y) 2D function (image)


• x=0,1,…,M-1
• y=0,1,2,…,N-1
M-1 N-1
F (u,v) = 1/MN Σ Σ f (x,y) e –j2Π(ux / M + vy/N)
x=0 y=0

u=0,1,…,M-1
v=0,1,…,N-1

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

10
Inverse
M-1 N-1
f (x,y) = Σ Σ F (u,v) e j2Π(ux /M + vy/N)
u=0 v=0

u, v frequency variable of image


x,y spatial variable of image (function)

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

11
Fourier transform in 2D

• I F(u,v)I = [R2 (u,v) + I2 (u,v)]1/2

• Phase angle in 2D
Φ(u,v) = tan -1 [ I (u,v) / R (u,v)]
Power Spectrum
P (u,v) = IF(u,v)I2
= R2 (u,v) + I2 (u,v)
R (u,v) –Real part of F (u,v)
I (u,v)- Imaginary part of F (u,v)

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

12
Important
 Before finding the Fourier transform, the function is multiplied by (-
1)x in case of 1D f (x) and (-1) x+y in case of 2D f (x,y).
 This is done to shift the Fourier transform at center.
 Frequency in image depends on the change in intensity.
 If in some part gray levels are almost same then frequency is less
otherwise in abrupt changes frequency is more
 Noise also have frequencies.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

13
• Fourier transform of a function f (x,y) multiplied by
(-1) x+y is given as F(u-M/2 , v-N/2)
F (0,0) = F(u-M/2 , v-N/2)
u – M/2 =0 v-N/2 =0
u = M/2 v= N/2
• If the size of the image is M x N the frequency at center will
be u,v
M-1 N-1
F (u,v) = 1/MN Σ Σ f (x,y) e –j2Π(ux / M + vy/N)
x=0 y=0

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

14
• When u=0 and v=0
M-1 N-1
F (0,0) = 1/MN Σ Σ f (x,y)
x=0 y=0

This is the average of f (x,y).


• At the center the average of image is there and as you go far it
becomes sharper.
• If f (x,y) is an image, the value of Fourier transform at the
origin is equal to average gray level of image.
• Since both the frequencies are 0 at center, f(0,0) is also known
as dc component of the spectrum.
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

15
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

16
• Image is multiplied by (-1) x+y prior to computing Fourier
transform to center the spectrum.
• The separation of spectrum zeros in u direction is twice than v
direction because of rectangle.
• Spectrum is enhanced by log function to enhance gray level
detail.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

17
Properties of Frequency Domain

1) Each term of F (u,v) contains modified form of f (x,y). The


Fourier transform is centered at the origin.
2) The frequency (0,0) corresponds to average gray level of the
image.
3) As we move away from the origin low frequencies occur.
These corresponds to slowly varying components of the
image. As we move further away the higher frequencies
occur which corresponds to faster and faster gray level
changes in the image. e.g. edges and noise.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

18
Basic steps for filtering
Images taken from Gonzalez and Woods, 2016

Frequency domain filtering

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
The Basics of Filtering
1. Fourier Spectrum
Images taken from Gonzalez and Woods, 2016

(a) Scanning electron microscopy of a damaged circuit (b)


Fourier Spectrum

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
The Basics of Filtering
2. Frequency Domain Filtering Fundamentals

Result of filtering the image


OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
DFT

The results of DFT can be visualised by showing the spectrum


Images taken from Gonzalez and Woods, 2016

signals as depicted in below:

DFT

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
DFT
Images taken from Gonzalez and Woods, 2016

DFT

Scanning electron Fourier spectrum


microscope image

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Fourier Transform Spectrum
FT Spectrum

(a) Original Image


Images taken from Gonzalez and Woods, 2016

(b) Fourier Spectrum


(c) Centered Spectrum
(d) Centered Spectrum
after log transformation

Centered
FT Spectrum
FT Spectrum (centered + log)
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Fourier Transform Spectrum

(a) Vertical rectangle image.


(b) The corresponding spectrum
Images taken from Gonzalez and Woods, 2016

of vertical rectangle image


(c) Diagonal rectangle image
(d) The corresponding spectrum
of diagonal rectangle image

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Filter Function

Low Pass Filter


Images taken from Gonzalez and Woods, 2016

High Pass Filter


OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
The Basic of Filtering
3. Steps for Filtering:

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
The Importance of Zero Padding
Images taken from Gonzalez and Woods, 2016

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
The Importance of Zero Padding

(a) An image, (b) Result of blurring without padding (c) Result of blurring
with padding

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Smoothing
Smoothing can be done by reducing high frequency values. An image
filtering can be given as:

G(u,v) = H(u,v)F(u,v)

where F(u,v) denotes as DFT function and H(u,v) represents filter


function.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
ILF

Ideal lowpass filter (ILF) is defined by:

where D0 >0 and D(u,v) denotes the distance between a point (u,v)
and the frequency center. D(u,v) can be defined as:

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
ILF

H(u,v)=1

(a) an ideal low-pass filter (b) Filter (c) Filter radial

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
ILF

Example:
Images taken from Gonzalez and Woods, 2016

Sample Image Fourier spectrum

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
ILF

(b)

(a)
(a) Representation of an ideal lowpass, radius 5 (b) Intensity profile

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
BLF

Butterworth lowpass filter (BLF) of order n with cut-off frequency at


Images taken from Gonzalez and Woods, 2016

distance D0 is defined as:

(a)Perspective plot of a BLF (b) Filter (c) Filter radial of order 1 through 4
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
BLF
Images taken from Gonzalez and Woods, 2016

Spatial representation of Butterworth lowpass filter of order 1, 2, 5, and 20


and the corresponding intensity
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
BLF

Example:

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
BLF

Original image BLPF n=2, D0=5

BLPF n=2, D0=15 BLPF n=2, D0=30

BLPF n=2, D0=80


Less ringing than ILPF BLPF n=2, D0=230
due to smoother
transition
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
GLF
• Gaussian lowpass filter (GLPF) can be defined as:
 D 2 ( u , v ) / 2 D0 2
H (u , v)  e

(a) GLPF function (b) filter function (c) Filter radial

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
GLF

Gaussian D0=5
Original image

Gaussian D0=15 Gaussian D0=30

Gaussian D0=85
Less ringing than BLPF Gaussian D0=230
but also less smoothing

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Lowpass Filters Comparison

ILPF D0=15 BLPF n=2,


D0=15

Gaussian D0=15

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Lowpass Filtering Examples
Gaussian lowpass filter can be used to connect broken text from
scanning image.

Blurring can help reading broken characters


OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Lowpass Filtering Examples
• Lowpass filtering can be used for publishing industry and printing.
and. “cosmetic” processing

Image
GLPF with
Do=100 GLPF with
Do=80
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Sharpening (Highpass filter)
High frequency coefficients contribute significantly in edges and fine
detail of images. Highpass filter is a reverse of lowpass filter:

HPF(u, v) = 1 – LPF(u, v)

D0 represents a cut-off frequency and n denotes the order of


Butterworth filter.
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Ideal Highpass Filters

• An ideal highpass filter is defined by:

• D0 denotes a cut off distance.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Ideal Highpass Filters

Image Sharpening
(Highpass filter)

IHPF D0 = 15 IHPF D0 = 30 IHPF D0 = 80


OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Butterworth Highpass Filters
• Butterworth highpass filter is defined as:
1
H (u , v) 
1  [ D0 / D(u , v)]2 n
• n represents the order and D0 denotes a cut off distance.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Butterworth Highpass Filters

Image Sharpening
(Highpass filter)

BHPF n=2, BHPF n=2, BHPF n=2,


D0 =15 D0 =30 D0 =80
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Gaussian Highpass Filters
• Gaussian highpass filter is defined as:
 D 2 ( u ,v ) / 2 D0 2
H (u, v)  1  e
• D0 represents a cut off distance.

OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Gaussian High-pass Filters

Image Sharpening
(Highpass filter)

Gaussian HPF Gaussian HPF Gaussian HPF


n=2, D0 =15 n=2, D0 =30 n=2, D0 =80
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Gaussian High-pass Filters

Image Sharpening
(Highpass filter)

Gaussian HPF BHPF n=2, Gaussian HPF


n=2, D0 =15 D0 =15 n=2, D0 =15
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.
Highpass filtering Examples
Example: using high pass filtering and thresholding for image
enhancement
Highpass filtering Thresholding

Image Sharpening
(Highpass filter)

(a) Thumb print (b) Result obtained from highpass filter


(b) Thresholding result
Images taken from US National Institute of standards
OER Digital Image Processing by Ferda Ernawan (editor) work is under licensed Creative Commons Attribution-
NonCommercial-NoDerivatives 4.0 International License.

You might also like