0% found this document useful (0 votes)
10 views10 pages

DFT With Its Applications

Uploaded by

user.xyzbd
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)
10 views10 pages

DFT With Its Applications

Uploaded by

user.xyzbd
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/ 10

Discrete Fourier Transform & Its Applications

Math IV, Spring 2023-2024

Contents
1 Introduction 1

2 Digital Signal & Image 2


2.1 1-D Digital Signal (Audio) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 2-D Digital Signal (Image) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 Discrete Fourier Transform (DFT) 5


3.1 1-D DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 2-D DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4 Exercise 3.7 9
4.1 1-D Digital Signal (Audio) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 2-D Digital Signal (Image) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3 1-D DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.4 2-D DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1 Introduction
The knowledge of the acquisition and inspection of one-dimensional and two-dimensional
signals, namely audio and images, has been made feasible due to the emergence of a number
of orthogonal transforms. The Fourier transform is a highly significant tool that has been
frequently used for the analysis and processing of one-dimensional and two-dimensional
signals, as well as for gaining insights into their characteristics and origins.
The process of decomposing a one-dimensional or two-dimensional signal, such as audio
or image data, involves utilizing the Fourier transform to identify the constituent sinusoids
with varying periods that represent the temporal or spatial frequencies within the signal.
The magnitudes of these frequencies collectively form the frequency spectrum of the signal.
The inverse Fourier transform incorporates the synthesis of the signal by aggregating its
constituent frequencies.

[email protected]
2 DIGITAL SIGNAL & IMAGE AIUB (Spring 2023-24, Midterm)

In this chapter, fortunately, we will learn:


• What is signal
• What is digital signal
• What is image
• What is digital image
• 1-D DFT & its implementation in DSP (basic)
• 2-D DFT & its implementation in DIP (basic)

2 Digital Signal & Image


A signal is any physical process that varies over time. Analog signals are waveforms that
exhibit continuity in the temporal domain and possess the ability to assume a continuous
spectrum of amplitude values. One example of an analog signal is a voltage that may be ad-
ministered to an oscilloscope, leading to a continuous representation in relation to time. On
the other hand, a digital signal is characterized by the quantization of its independent time
variable, resulting in knowing the signal’s value only at discrete time intervals. Therefore,
a digital signal is characterized by a sequence of values rather than a continuous waveform.
The concept of the analog and digital signal is depicted in Fig. 1.

Figure 1: An analog signal and its digital version.

Next, an analog image is a two-dimensional waveform. Unlike an analog signal, it is a func-


tion of two variables in space (length). For example, the two-dimensional projection of the

Page 2 of 10
2 DIGITAL SIGNAL & IMAGE AIUB (Spring 2023-24, Midterm)

three-dimensional scene around us. Mathematically, a digital image is a function I(m, n) of


independent spatial variables m and n quantized so that we know only the value of I(m, n)
at discrete length in space.

2.1 1-D Digital Signal (Audio)


Now, we will learn how to discretize an analog signal. Let us consider the analog signal f (t)
on the time interval 0 ≤ t ≤ b. Say, the digital representation of f (t) is F (n), where n is the
integer index belongs to {0} ∪ N. First, we have to fix the sample size in the digital signal
F (n), which is N . Thus, the n varies from 0 to N − 1. Then, the time interval ts between
two successive samples can be determined as ts = N b−1 . The mth sample of the digital
signal F (n), therefore, can be computed following F (n) = f (n × ts ), where n = m − 1.
Now, the digital signal F (n) can be computed by computing its samples as:
The first sample (n = 0) is F (n) = f (n × ts ) ⇒ F (0) = f (0 × ts ).
The second sample (n = 1) is F (n) = f (n × ts ) ⇒ F (1) = f (1 × ts ).
The third sample (n = 2) is F (n) = f (n × ts ) ⇒ F (2) = f (2 × ts ).
..
.
The N th sample (n = N − 1) is F (n) = f (n × ts ) ⇒ F (N − 1) = f ((N − 1) × ts ).
Hence, the digital signal is F (n) = {F (0), F (1), F (2), . . . , F (N − 1)}.
Note: In a digital signal, the values of the samples are also quantized. It is skipped here.
Example ( 1. Find the digital signal F (n) with 6 samples of the unit ramp signal
0 for t < 0
f (t) = .
t for 0 ≤ t ≤ 2
Solution: Here, N = 6 and b = 2.
Thus, ts = N b−1 = 25 = 0.4, and n = 0, 1, 2, . . . , 5.
For n = 0, F (0) = f (0 × 0.4) = 0.
For n = 1, F (1) = f (1 × 0.4) = 0.4.
For n = 2, F (2) = f (2 × 0.4) = 0.8.
For n = 3, F (3) = f (3 × 0.4) = 1.2.
For n = 4, F (4) = f (4 × 0.4) = 1.6.
For n = 5, F (5) = f (5 × 0.4) = 2.
The digital unit ramp function is F (n) = {F (0), F (1), F (2), F (3), F (4), F (5)} = {0, 0.4,
0.8, 1.2, 1.6, 2}.
Example( 2. Find the sixth sample of the digital signal F (n) of the unit step signal
0 for t < 0
f (t) = with the time interval ts = 0.5 if it exists. Also, find the
1 for 0 ≤ t ≤ 3
eighth sample if it exists.

Page 3 of 10
2 DIGITAL SIGNAL & IMAGE AIUB (Spring 2023-24, Midterm)

Solution: Here, the time period is ts = 0.5 and b = 3.


Thus, the number of samples N = tbs + 1 = 0.5 3
+ 1 = 6 + 1 = 7.
So, the sixth sample exists.
For the sixth sample n = 5, and F (5) = f (5 × ts ) = f (5 × 0.5) = f (2.5) = 1.
Since the total number of samples is 7, the eighth sample of F (n) does not exist.

2.2 2-D Digital Signal (Image)


At this time, we will learn how to form a digital image from an analog one. Say, we have
the analog image f (x, y) on the spatial intervals 0 ≤ x ≤ a and 0 ≤ y ≤ b. Let the dig-
ital representation of f (x, y) is I(m, n), where m and n are the integer indices belong to
{0} ∪ N. First, we have to fix the sample size in the digital image I(m, n), which is M × N .
Thus, m and n vary from 0 to M − 1 and N − 1, respectively. Then the spatial interval
xs (and ys ) between two successive samples can be determined by xs = Ma−1 ys = N b−1 .


It is noted here that x − s = ys , and a sample of a digital image is known as a pixel.


Therefore, the pixel at the position (m, n) of the digital image I(m, n) can be computed as
I(m, n) = f (m × xs , n × ys ). Consider a digital image I(m, n) of size (M − 1) × (N − 1).
So, I(m, n) can be computed by computing its all the nine pixels as:
At the position (m, n) = (0, 0), I(m, n) = f (m × xs , n × ys ) ⇒ I(0, 0) = f (0 × xs , 0 ×
ys ).
At the position (m, n) = (0, 1), I(m, n) = f (m × xs , n × ys ) ⇒ I(0, 1) = f (0 × xs , 1 ×
ys ).
... ... ... ...
At the position (m, n) = (0, N − 1), I(m, n) = f (m × xs , n × ys ) ⇒ I(0, N − 1) =
f (0 × xs , N − 1 × ys ).
At the position (m, n) = (1, 0), I(m, n) = f (m × xs , n × ys ) ⇒ I(1, 0) = f (1 × xs , 0 ×
ys ).
At the position (m, n) = (1, 1), I(m, n) = f (m × xs , n × ys ) ⇒ I(1, 1) = f (1 × xs , 1 ×
ys ).
... ... ... ...
At the position (m, n) = (1, N − 1), I(m, n) = f (m × xs , n × ys ) ⇒ I(1, N − 1) =
f (1 × xs , N − 1 × ys ).
..
.
..
.
At the position (m, n) = (M − 1, 0), I(m, n) = f (m × xs , n × ys ) ⇒ I(M − 1, 0) =
f (M − 1 × xs , 0 × ys ).
At the position (m, n) = (M − 1, 1), I(m, n) = f (m × xs , n × ys ) ⇒ I(M − 1, 1) =
f (M − 1 × xs , 1 × ys ).
... ... ... ...

Page 4 of 10
3 DISCRETE FOURIER TRANSFORM (DFT) AIUB (Spring 2023-24, Midterm)

At the position (m, n) = (M − 1, N − 1), I(m, n) = f (m × xs , n × ys ) ⇒ I(M −


1, N − 1) = f (M − 1 × xs , N − 1 × ys ). 


 {I(0, 0), I(0, 1), ..., I(0, N − 1)} 



 

 {I(1, 0),

I(1, 1), ..., I(1, N − 1)} 

Hence, the digital image is I(m, n) = .

 . . . 


 


 
{I(M − 1, 0), I(M − 1, 1), . . . , I(M − 1, N − 1)}

Note: In a digital image, the values of the pixels are also quantized. It is skipped here.
Example 3. Find the digital image I(m, n) with 3 × 2 pixel size of the analog image
f (x, y) = x2 + y 2 , where 0 ≤ x ≤ 1 and 0 ≤ y ≤ 0.5.
Solution: Here, M = 3, N = 2, a = 1 and b = 0.5.
Thus, xs = Ma−1 = 3−1 1
= 12 = 0.5 and ys = N b−1 = 2−1
0.5
= 0.5
1 = 0.5.
I(0, 0) = f (0 × xs , 0 × ys ) = f (0 × 0.5, 0 × 0.5) = f (0, 0) = 02 + 02 = 0.
I(0, 1) = f (0 × xs , 1 × ys ) = f (0 × 0.5, 1 × 0.5) = f (0, 0.5) = 02 + 0.52 = 0.25.
I(1, 0) = f (1 × xs , 0 × ys ) = f (1 × 0.5, 0 × 0.5) = f (0.5, 0) = 0.52 + 02 = 0.25.
I(1, 1) = f (1 × xs , 1 × ys ) = f (1 × 0.5, 1 × 0.5) = f (0.5, 0.5) = 0.52 + 0.52 = 0.5.
I(2, 0) = f (2 × xs , 0 × ys ) = f (2 × 0.5, 0 × 0.5) = f (1, 0) = 12 + 02 = 1.
I(2, 1) = f (2 × xs , 1 × ys ) = f (2 ×
0.5, 1 × 0.5) = f (1, 0.5) = 0.52 + 0.52 = 1.25.


 I(0, 0) I(0, 1)

 0 0.25
 
Hence, the digital image is I(m, n) = I(1, 0) I(1, 1) = 0.25 0.5

 

I(2, 0) I(2, 1)
  1 1.25

Example 4. Find the pixel value I(2, 2) of the digital image I(m, n) with spatial intervals
3
xs = 0.1 and ys = 0.1 of the analog image f (x, y) = xy2 , where 0 ≤ x ≤ 2 and 0 ≤ y ≤ 2.
Also, find the pixel size of I(m, n).
Solution: Here, a = 2, b = 2, and xs = ys = 0.1.
Thus, M = xas + 1 = 0.1 2
+ 1 = 20 + 1 = 21 and N = ybs + 1 = 0.1 2
+ 1 = 20 + 1 = 21.
So, the pixel size of I(m, n) is M × N = 21 × 21.
3
Also, I(2, 2) = f (2 × xs , 2 × ys ) = f (2 × 0.1, 2 × 0.1) = f (0.2, 0.2) = 0.2
0.2 = 0.2.
2

Note: The real-time image formulation is not an easy task. For simplicity, in this text, an
analog image is described in terms of a mathematical (algebraic) function.

3 Discrete Fourier Transform (DFT)


The digital signals converted from analog signals are either in temporal or spatial domain.
The frequency domain representation of the signals is required for many important signal

Page 5 of 10
3 DISCRETE FOURIER TRANSFORM (DFT) AIUB (Spring 2023-24, Midterm)

processing tasks, such as signal reconstruction, noise reduction. The DFT is one of the
sophisticated procedures to transform the spatial and temporal domain signals into the fre-
quency domain.

3.1 1-D DFT


1-D DFT is used to transform a digital signal in the temporal domain to the frequency
domain. Let F (n) = {F (0), F (1), F (2), . . . , F (N − 1), } presents a digital signal with
sample size N , which needs to be transformed into the frequency domain. The 1-D DFT of
F (n) is F(u) which can be given by
N −1
1 X 2πnu
F(u) = F (n) × e−i N ,
N n=0

where i = −1 and u is the frequency domain index running from 0 to N − 1. Each F(u)
for u = 0, 1, 2, . . . , N − 1 represents a frequency component of the digital signal F (n).
Example 5. Transform the digital signal F (n) = {0, 0.4, 0.8, 1.2, 1.6, 2} in the temporal
domain into the frequency domain.
Solution: Here, the sample size of F (n) is N = 6.
Thus, the frequency index u varies from 0 to 5.
And, F (0) = P 0, F (1) = 0.4, F (2) = 0.8, F (3) P= 1.2, F (4) = 1.6, and F P(5) = 2.
1 N −1 −i 2πn0 1 6−1 0 1 5
F(0) = N n=0 F (n) × e N = 6 n=0 F (n) × e = 6 n=0 F (n) × 1
= F (0)+F (1)+F (2)+F
6
(3)+F (4)+F (5)
= 0+0.4+0.8+1.2+1.6+2
6 = 66 = 1.
−1 −i 2πn1 −i 2πn −i 2πn
F(1) = N1 N 6−1
P 1
P 1
P5
n=0 F (n) × e N = 6 n=0 F (n) × e 6 = 6 n=0 F (n) × e
6
2π0 2π1 2π2 2π3
= 61 × {(F (0) × e−i 6 ) + (F (1) × e−i 6 ) + (F (2) × e−i 6 ) + (F (3) × e−i 6 ) +
2π4 2π5
(F (4) × e−i 6 ) + (F (5) × e−i 6 )} = 61 .
= 61 × {(0 × (0 + 0i)) + (0.4 × (0.2 − 0.34641i)) + (0.8 × (−0.4 − 0.69282i))+
(1.2 × (−1.2 − 1.4696e − 16i)) + (1.6 × (−0.8 + 1.3856i)) + (2 × (1 + 1.7321i))}
= −1.2000+2.0785i
6 = −0.2000 + 0.3464i.
Similarly, we get (The students should work out the following concise answers.)
F(2) = −0.2000 + 0.1155i.
F(3) = −0.2000 − 0.0000i = −0.2.
F(4) = −0.2000 − 0.1155i.
F(5) = −0.2000 − 0.3464i.
Hence, the frequency domain representation of F (n) is F(u) =
{1, −0.2000 + 0.3464i, −0.2000 + 0.1155i, −0.2, −0.2000 − 0.1155i, −0.2000 − 0.3464i}.
Example 6. For a given digital signal F (n) = {0, 0.95, 0.59, −0.59, −0.95}, find the fifth
frequency domain component if it exists. Does the sixth frequency domain component exist?

Page 6 of 10
3 DISCRETE FOURIER TRANSFORM (DFT) AIUB (Spring 2023-24, Midterm)

Solution: Here, the sample size of F (n) is N = 5.


Thus, the frequency index u varies from 0 to 4.
And, F (0) = 0, F (1) = 0.95, F (2) = 0.59, F (3) = −0.59, and F (4) = −0.95.
So, the fifth
1
Pfrequency
N −1 −i 2πn4 1
P4 of F (n) is −i 8πn
domain component
F(4) = N n=0 F (n) × e N = 5 n=0 F (n) × e 5
8π0 8π1 8π2 8π3
= 15 × {(F (0) × e−i 5 ) + (F (1) × e−i 5 ) + (F (2) × e−i 5 ) + (F (3) × e−i 5 )+
8π4
(F (4) × e−i 5 )}
= 15 × {(0 × (1 + 0i)) + (0.95 × (0.30902 + 0.95106i))+
(0.59 × (−0.80902 + 0.58779i)) + (−0.59 × (−0.80902 − 0.58779i))+
(−0.95 × (0.30902 − 0.95106i))}
= 15 × {(0 + 0i) + (0.29357 + 0.9035i) + (−0.47732 + 0.34679i)+
(0.47732 + 0.34679i) + (−0.29357 + 0.9035i)}
= 0+2.5006i
5 = 0 + 0.50012i = 0.5i.
Since N = 5, the sixth frequency domain component of F (n) does not exit.

3.2 2-D DFT


2-D DFT is used
to transform a digital image in the spatial domain tothe frequency domain.


 I(0, 0) I(0, 1) ... I(0, N − 1)  


 

 I(1, 0) I(1, 1) ... I(1, N − 1) 
 
Let I(m, n) = presents a digital im-

 . . . 


 


 
I(M − 1, 0) I(M − 1, 1) . . . I(M − 1, N − 1) 
age with pixel size M × N , which needs to be transformed into the frequency domain. The
2-D DFT of I(m, n) is I(u, v) which can be given by
M −1 N −1
1 XX
F (m, n) × e−2πi( M + N ) ,
mu nv
I(u, v) =
M N m=0 n=0

where i = −1, and u and v are the frequency domain indices running from 0 to M − 1
and N − 1, respectively.

0 127
Example 7. Transform the digital image I(m, n) = in the spatial domain into
128 255
the frequency domain.
Solution: Here, the pixel size of I(m, n) is M × N = 2 × 2.
Thus, the frequency indices u and v varies from 0 to 1 and 0 to 1, respectively.
And, I(0, 0) = 0, I(0, 1) = 127, I(1, 0) = 128, and I(1, 1) = 255.

Page 7 of 10
3 DISCRETE FOURIER TRANSFORM (DFT) AIUB (Spring 2023-24, Midterm)

P −1 PN −1 −2πi( m0
M +N ) =
n0
I(0, 0) = M1N M 1
P2−1 P2−1 0
m=0 n=0 I(m, n) × e 2×2 m=0 n=0 I(m, n) × e
= 14 1m=0 1n=0 I(m, n) × 1 = 14 1m=0 (I(m, 0) + I(m, 1))
P P P

= I(0,0)+I(0,1)+I(1,0)+I(1,1)
4 = 0+127+128+255
4 = 5104 = 127.5
−1 N −1 −2πi( M + N )
m0 n1
I(0, 1) = M1N M
P P
m=0 n=0 I(m, n) × e
I(m, n) × e−2πi(0+ N ) = 41 1m=0 1n=0 I(m, n) × e−2πi 2
P2−1 P2−1 n n
1
P P
= 2×2 m=0 n=0
1
P1  −2πi 20 −2πi 12

= 4 m=0 I(m, 0) × e + I(m, 1) × e
= 41 1m=0 I(m, 0) × e0 + I(m, 1) × e−πi
P 

= 14 1m=0 I(m, 0) × 1 + I(m, 1) × e−πi


P 

= 14 1m=0 I(m, 0) + I(m, 1) × e−πi


P 
−πi −πi −πi −πi
= I(0,0)+I(0,1)×e +I(1,0)+I(1,1)×e
4 = 0+127×e +128+255×e
4
= 0+127×(−1)+128+255×(−1)
4 = 0−127+128−255
4 = −2544 = −63.5
Similarly, we get (The students should work out the following concise answers.)
I(1, 0) = −64 − 0i = −64
I(1, 1) = 0 + 0i = 0
127.5 -63.5
Hence, the frequency domain representation of I(m, n) is I(u, v) = .
-64 0

0 100
Example 8. For a given digital image I(m, n) = , find the frequency domain
200 255
component I(0, 1) of I(m, n).
Solution: Here, the pixel size of I(m, n) is M × N = 2 × 2.
Thus, the frequency indices u and v varies from 0 to 1 and 0 to 1, respectively.
And, I(0, 0) = 0, I(0, 1) = 100, I(1, 0) = 200, and I(1, 1) = 255.
So, the required frequency domain component is
P −1 PN −1 −2πi( m0
M +N )
n1
I(0, 1) = M1N M m=0 n=0 I(m, n) × e
1
P2−1 P2−1 −2πi(0+ n1
2 ) = 1
P1 P1 −2πi n2
= 2×2 m=0 n=0 I(m, n) × e 4 m=0 n=0 I(m, n) × e
= 14 1m=0 1n=0 I(m, n)×e−πin = 14 1m=0 I(m, 0) × e−πi0 + I(m, 1) × e−πi1
P P P 

= 41 1m=0 I(m, 0) × e−0 + I(m, 1) × e−πi


P 

= 14 1m=0 I(m, 0) × 1 + I(m, 1) × e−πi = 14 1m=0 I(m, 0) + I(m, 1) × e−πi


P  P 
−πi −πi
0+100×e−πi +200+255×e−πi
= I(0,0)+I(0,1)×e +I(1,0)+I(1,1)×e
4 = 4
0+100×(−1)+200+255×(−1) 0−100+200−255 −155
= 4 = 4 = 4 = −38.75.

Page 8 of 10
4 EXERCISE 3.7 AIUB (Spring 2023-24, Midterm)

4 Exercise 3.7
4.1 1-D Digital Signal (Audio)
Exercise( 1. Find the digital signal F (n) with 5 samples of the unit step signal
0 for t < 0
f (t) = .
1 for 0 ≤ t ≤ 1

Exercise 2. Find the digital signal F (n) with 11 samples of the wave signal f (t) = sin(2πf0 t),
where f0 = 0.1 and 0 ≤ t ≤ 10.

Exercise(3. Find the third sample of the digital signal F (n) of the unit ramp signal
0 for t < 0
f (t) = with the time interval ts = 0.4 if it exists. Also, find the
t for 0 ≤ t ≤ 2
ninth sample if it exists.

Exercise 4. Find the twelfth sample of the digital signal F (n) of the wave signal f (t) =
cos(2πf0 t), where f0 = 0.2 and 0 ≤ t ≤ 5, with the time interval ts = 0.25 if it exists. Also,
find the ninth sample if it exists.

4.2 2-D Digital Signal (Image)


Exercise 5. Find the digital image I(m, n) with 3 × 3 pixel size of the analog image
f (x, y) = x+y
y , where 0 ≤ x ≤ 0.4 and 0 ≤ y ≤ 0.4.

Exercise 6. Find the pixel value I(3, 4) of the digital p


image I(m, n) with spatial intervals
xs = 1 and ys = 1 of the analog image f (x, y) = (x2 + y 2 ), where 0 ≤ x ≤ 5 and
0 ≤ y ≤ 6. Also, find the pixel size of I(m, n).

4.3 1-D DFT


Exercise 7. Transform the digital signal F (n) = {1, 0.31, −0.81, −0.81, 0.31} in the tem-
poral domain into the frequency domain.

Exercise 8. For a given digital signal F (n) = {1, 1, 1, 1, 1}, find the third frequency domain
component if it exists. Does the ninth frequency domain component exist?

Page 9 of 10
4 EXERCISE 3.7 AIUB (Spring 2023-24, Midterm)

4.4 2-D DFT

0 0
Exercise 9. Transform the digital image I(m, n) = in the spatial domain into the
0 0
frequency domain.

255 255
Exercise 10. For a given digital image I(m, n) = , find the frequency domain
255 255
component I(1, 1) of I(m, n).

References
1. Tinku Acharya and Ajoy K Ray, “Image Processing: Principles and Applications”, 1st
Edition, Wiley-Interscience (2005)

Page 10 of 10

You might also like