0% found this document useful (0 votes)
7 views125 pages

Digital Image Processing_Chapter 4

Chapter 4 of the document discusses image enhancement in the frequency domain using Fourier Transform techniques. It covers the application of Fourier Transform in digital image processing, including the Fast Fourier Transform (FFT) algorithm, and the relationship between spatial and frequency resolutions. Additionally, it explains various filtering methods, such as lowpass and highpass filters, and their effects on image quality.
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)
7 views125 pages

Digital Image Processing_Chapter 4

Chapter 4 of the document discusses image enhancement in the frequency domain using Fourier Transform techniques. It covers the application of Fourier Transform in digital image processing, including the Fast Fourier Transform (FFT) algorithm, and the relationship between spatial and frequency resolutions. Additionally, it explains various filtering methods, such as lowpass and highpass filters, and their effects on image quality.
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/ 125

Digital Image Processing

Chapter 4:
Image Enhancement in the
Frequency Domain
Outline

❖ Introduction to the Fourier Transform

❖ Application of Fourier Transform in DIP

o Image Enhancement in the Frequency Domain

❖ Fast Fourier Transform (FFT algorithm)


In 1672, Newton demonstrated that the
sunlight can be broken by a prism into 7
constituent colors of the rainbow.
Assuming roughly the same intensity of
each color, therefore, a prism is a tool that
tells us the intensity of each color present
in the white light.
Background: Fourier Series

Fourier series:
Any periodic signals can be
viewed as weighted sum
of sinusoidal signals with
different frequencies

Frequency Domain:
view frequency as an
independent variable
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Fourier Tr. and Frequency Domain

Fourier Tr.
Time, spatial Frequency
Domain Domain
Signals Signals
Inv Fourier Tr.

1-D, Continuous case

from space domain to frequency


domain (Fourier Domain)

from frequency domain (Fourier


Domain) to space domain
Fourier Tr. and Frequency Domain (cont.)

1-D, Discrete case DFT (discrete Fourier transform

from space domain to frequency


domain (Fourier Domain)

from frequency domain (Fourier


Domain) to space domain M: Number of frequencies that we want to
decompose f(x) into them
u: index of decomposed frequencies,

Magnitude spectrum: display the magnitude of Fourier coefficients among frequency components.
This spectrum can tell how much a frequency contribute to the input signal.
Phase spectrum: display the phase of Fourier coefficients among frequency components, tells
"where" the frequency component is in the input signal.
Fourier Tr. and Frequency Domain (cont.)
Fourier Tr. and Frequency Domain (cont.)
Fourier Tr. and Frequency Domain (cont.)
Fourier transform’s meaning
Consider a sinusoidal signal x that is a function of time t with frequency components of 15 Hz
and 20 Hz. Use a time vector sampled in increments of 1/50 seconds over a period of 10
seconds
n = length(x);
Ts = 1/50;
fshift = (-n/2:n/2-1)*(fs/n);
t = 0:Ts:10-Ts;
yshift = fftshift(y);
x = sin(2*pi*15*t) + sin(2*pi*20*t);
plot(fshift,abs(yshift))
plot(t,x)
xlabel('Frequency (Hz)')
xlabel('Time (seconds)')
ylabel('Magnitude')
ylabel('Amplitude')
Fourier Tr. and Frequency Domain (cont.)

Fourier spectrum or the frequency spectrum:


Example of 1-D Fourier Transforms

Notice that the longer


the time domain signal,
The shorter its Fourier
transform

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Relation Between x and u
For a signal f(x) with M points, let spatial resolution x be space
between samples in f(x) and let frequency resolution u be space
between frequencies components in F(u), we have

Example: for a signal f(x) with sampling period 0.5 sec, 100 point,
we will get frequency resolution equal to

This means that in F(u) we can distinguish 2 frequencies that are


apart by 0.02 Hertz or more.
Example of 1-D Fourier Transforms

Matrix form
2-Dimensional Discrete Fourier Transform

For an image of size MxN pixels


2-D DFT
M −1N −1
1
F (u, v) =
MN
 f (x, y)e
x=0 y=0
− j2 (ux / M +vy / N )

u = frequency in x direction, u = 0 ,…, M-1


v = frequency in y direction, v = 0 ,…, N-1

2-D IDFT

x = 0 ,…, M-1
y = 0 ,…, N-1
2-Dimensional Discrete Fourier Transform (cont.)

For the purpose of viewing, we usually display only the


Magnitude part of F(u,v)
Relation Between Spatial and Frequency Resolutions

1 1
u = v =
Mx Ny

where
x = spatial resolution in x direction
y = spatial resolution in y direction

( x and y are pixel width and height. )


u = frequency resolution in x direction
v = frequency resolution in y direction
N,M = image width and height
How to Perform 2-D DFT by Using 1-D DFT
How to Perform 2-D DFT by Using 1-D DFT

1-D
DFT
f(x,y) by row F(u,y)
1-D DFT
by column

F(u,v)
How to Perform 2-D DFT by Using 1-D DFT (cont.)

Alternative method

f(x,y)
1-D DFT
by column

1-D
DFT
F(x,v) by row F(u,v)
Periodicity of 1-D DFT

From DFT:

-N 0 N 2N

We display only in this range

DFT repeats itself every N points (Period = N) but we usually


display it for n = 0 ,…, N-1
Conventional Display for 1-D DFT

F(u)
f(x)
DFT

0 N-1 0 N-1

Time Domain Signal


High frequency
area
Low frequency
area

The graph F(u) is not


easy to understand !
Conventional Display for DFT : FFT Shift
F(u)
FFT Shift: Shift center of the
graph F(u) to 0 to get better
Display which is easier to
understand.

0 N-1

High frequency area

Low frequency area


-N/2 0 N/2-1
Periodicity of 2-D DFT
M −1N −1
1
2-D DFT: F(u, v) =
MN

x=0 y=0
f (x, y)e − j2 (ux / M +vy / N )

-M

For an image of size NxM


pixels, its 2-D DFT repeats
0 itself every N points in x-
direction and every M points
in y-direction.
M

We display only
2M in this range
-N 0 N 2N (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Conventional Display for 2-D DFT

F(u,v) has low frequency areas


at corners of the image while high
frequency areas are at the center
of the image which is inconvenient
to interpret.
• Low frequencies in the transform are related to slowly
varying intensity components in an image, such as the
walls of a room or a cloudless sky in an outdoor scene.
• High frequencies are caused by sharp transitions in
intensity, such as edges and noise

High frequency area

Low frequency area

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
2-D FFT Shift : Better Display of 2-D DFT
2-D FFT Shift is a MATLAB function: Shift the zero frequency
of F(u,v) to the center of an image.

2D FFTSHIFT

(Images from Rafael C. Gonzalez and Richard E. High frequency area Low frequency area
Wood, Digital Image Processing, 2nd Edition.
2-D FFT Shift (cont.) : How it works

-M

Display of 2D DFT
After FFT Shift
M

Original display
2M
of 2D DFT
-N 0 N 2N

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
2-Dimensional FFT shift

[ f (x, y)(−1)x+ y ] = F (u − M / 2,v − N / 2)


Example of 2-D DFT

Notice that the longer the time domain signal,


The shorter its Fourier transform
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example of 2-D DFT
Example of 2-D DFT

2D DFT

Original image

2D FFT Shift
Example of 2-D DFT

2D DFT

Original image

2D FFT Shift
Relationship between Convolution and DFT
Basic Concept of Filtering in the Frequency Domain
From Fourier Transform Property:

g(x, y) = f (x, y)  h( x, y)  F (u, v)  H (u, v) = G(u, v)

We cam perform filtering process by using

Multiplication in the frequency domain


is easier than convolution in the spatial
Domain.

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Spatial filtering
Discrete convolution of f(x,y) and h(x,y)
Filtering in the Frequency Domain with FFT shift

H(u,v)
F(u,v) g(x,y)
(User defined)

FFT shift
X 2D IFFT

2D FFT
FFT shift

f(x,y) G(u,v)

In this case, F(u,v) and H(u,v) must have the same size and
have the zero frequency at the center.
Multiplication in Freq. Domain = Circular Convolution

This means that without padding


the image properly, results from
one side of the image will wrap
around to the other side of the
image
Multiplication in Freq. Domain = Circular Convolution

Original H(u,v)
image Gaussian
Lowpass
Filter with
D0 = 5

Filtered image
(obtained using
circular convolution)

Incorrect areas at image rims


Linear Convolution by using Circular Convolution and Zero Padding
The need for Padding

Failure to handle the periodicity issue properly will give incorrect results
if the convolution function is obtained using the Fourier transform.
The result will have erroneous data at the beginning and have missing
data at the end.
The solution to this problem is straightforward. Assume that f and h
consist of A and B points, respectively. We append zeros to both
functions so that they have identical periods, denoted by P.
Linear Convolution by using Circular Convolution and Zero Padding

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Linear Convolution by using Circular Convolution and Zero Padding

Filtered image

Zero padding area in the spatial


Domain of the mask image Only this area is kept.
(the ideal lowpass filter)
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Lowpass filter vs. Highpass filter

▪ A function H(u,v) that attenuates high frequencies while passing


low frequencies (called a lowpass filter) would blur an image.
▪ While a filter with the opposite property (called a highpass filter)
would enhance sharp detail but cause a reduction in contrast in
the image.
Filtering in the Frequency Domain : Example
In this example, we set F(0,0) to zero
which means that the zero frequency
component is removed.

Note: Zero frequency = average


intensity of an image (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Filtering in the Frequency Domain : Example
Lowpass Filter Highpass Filter

Result of Sharpening Filter


Filter Masks and Their Fourier Transforms

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Filtering in the Frequency Domain : Example
The image is blurred This result is as
the blurring is not expected, with a
uniform; the top white uniform dark border
edge is blurred, but resulting from zero
the sides are not padding
Filtering in the Frequency Domain

Image Smoothing Using Lowpass Frequency Domain Filters


Ideal Lowpass Filters
Gaussian Lowpass Filters
Butterworth Lowpass Filters
Image Sharpening Using Highpass Filters
Ideal, Gaussian, And Butterworth Highpass Filters From Lowpass Filters
The Laplacian In The Frequency Domain
Unsharp Masking, High-boost Filtering, an High frequency- Emphasis Filtering
Homomorphic Filtering
Image Smoothing Using Lowpass Frequency Domain Filters

Ideal Lowpass Filters

Gaussian Lowpass Filters

Butterworth Lowpass Filters


Ideal Lowpass Filter
Ideal LPF Filter Transfer function A 2-D lowpass filter that passes
without attenuation all frequencies
within a circle of radius from the
origin, and “cuts off” all frequencies
outside this, circle is called an ideal
lowpass filter (ILPF)

where D(u,v) = Distance from (u,v) to the center of the mask.

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Examples of Ideal Lowpass Filters

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.

The smaller D0, the more high frequency components are removed.
Results of Ideal Lowpass Filters

Ringing effect
can be obviously
seen!
which becomes
finer in texture as
the amount of
high frequency
content removed
decreases
How ringing effect happens
How ringing effect happens (cont.)

Surface Plot
-3
x 10

15

Spatial Response of Ideal 10

Lowpass Filter with D0 = 5 5

20
20
0
Ripples that cause ringing effect -20 -20
0
How ringing effect happens (cont.)

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Butterworth Lowpass Filter
Transfer function

Where D0 = Cut off frequency, N = filter order.


Results of Butterworth Lowpass Filters

There is less
ringing effect
compared to
those of ideal
lowpass
filters!
Spatial Masks of the Butterworth Lowpass Filters

Some ripples can be seen.


Gaussian Lowpass Filter
Transfer function
− D 2(u,v ) / 2D 2
H (u, v) = e 0

Where D0 = spread factor.

Note: the Gaussian filter is the only filter that has no ripple and
hence no ringing effect.
Gaussian Lowpass Filter (cont.)
− D 2(u,v ) / 2D 2
H (u, v) = e 0

0.8

0.6
Gaussian lowpass
0.4 filter with D0 = 5
0.2

20
20
0
0
-20 -20

0.03

Spatial respones of the 0.02

Gaussian lowpass filter 0.01

with D0 = 5 0

20
20
0
0
-20 -20
Gaussian shape
Results of Gaussian Lowpass Filters

No ringing
effect!
Application of Gaussian Lowpass Filters

Original image Better Looking

The GLPF can be used to remove jagged edges


(Images from Rafael C. Gonzalez and Richard E.
and “repair” broken characters.
Wood, Digital Image Processing, 2nd Edition.
Application of Gaussian Lowpass Filters (cont.)
Remove wrinkles

Original image

Softer-Looking

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Application of Gaussian Lowpass Filters (cont.)

Remove artifact lines: this is a simple but crude way to do it!


Image Sharpening Using Highpass Filters

Ideal, Gaussian, And Butterworth Highpass Filters From Lowpass Filters

The Laplacian In The Frequency Domain

Unsharp Masking, High-boost Filtering, a High frequency- Emphasis Filtering

Homomorphic Filtering
Highpass Filters

Hhp = 1 - Hlp
Ideal Highpass Filters
Ideal HPF Filter Transfer function

0 D(u,v)  D0
H (u, v) = 
1 D(u,v)  D0
where D(u,v) = Distance from (u,v) to the center of the mask.

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Butterworth Highpass Filters
Transfer function

Where D0 = Cut off frequency, N = filter order.

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Gaussian Highpass Filters
Transfer function

Where D0 = spread factor.

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Gaussian Highpass Filters (cont.)

− D 2(u,v ) / 2D 2

1 H (u, v) = 1 − e 0

0.8

0.6 Gaussian highpass


0.4 filter with D0 = 5
0.2

0
60
60
40 50
40
20 30
20
10

3000

2000

Spatial respones of the 1000

Gaussian highpass filter 0

with D0 = 5 60
60
40 50
40
20 30
20
10
Spatial Responses of Highpass Filters

Ripples
Results of Ideal Highpass Filters

Ringing effect can be


obviously seen!

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Results of Butterworth Highpass Filters

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Results of Gaussian Highpass Filters

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Using highpass filtering and thresholding for image enhancement.
Laplacian Filter in the Frequency Domain

Laplacian

2 f 2 f
 2
f = 2 +
x  y2

2 f = 4z −(z + z + z + z )
5 2 4 6 8

✓ Laplacian mask

Z1 Z2 Z3 0 1 0

Z4 Z5 Z6 1 -4 1

Z7 Z8 Z9 0 1 0
Laplacian Filter in the Frequency Domain
Laplacian Filter in the Frequency Domain (cont.)
Laplacian Filter in the Frequency Domain

The Laplacian can be implemented in the frequency domain


by using the filter.

H(u,v) = −(u2 + v2 )

The center of the filter function also needs to be shifted.

H(u,v) = −[(u−M/2)2 +(v − N/2)2]

The Laplacian-filtered image in the spatial domain is


obtained by computing the inverse Fourier transform
of H(u,v)F(u,v).

2f(x, y)=1{−[(u−M/2)2 +(v−N/2)2]F(u,v)}


Laplacian Filter in the Frequency Domain

The enhancement :
g(x, y) = f (x, y) − 2 f (x, y)

In freq. domain :
H (u,v ) = 1 + [( u − M /2) 2 + (v − N/2) 2 ]
By inverse transform

g(x, y) = −1{1+[(u − M / 2)2 +(v − N / 2)2 ]F(u,v)}


Sharpening Filtering in the Frequency Domain (cont.)
Sharpening Filtering in the Frequency Domain (cont.)
Unsharp Masking, High-Boost Filtering

Unsharp Masking, High-Boost Filtering


High-boost filtering
✓ A generalization of unsharp masking
✓ To increase the contribution made by the original
image to the overall filtered result.

Unsharp masking
✓ Consists simply of generating a sharp image by
subtracting from an image a blurred version of itself.
Sharpening Filtering in the Frequency Domain
Spatial Domain

fhp (x, y) = f (x, y) − flp (x, y) Unsharp masking

fhb (x, y) = Af (x, y) − flp (x, y) High boost filtering

fhb (x, y) = ( A −1) f (x, y) + f (x, y) − flp (x, y)

fhb (x, y) = ( A −1) f (x, y) + fhp (x, y)

Frequency Domain Filter

Hhp (u, v) = 1 − Hlp (u, v)

Hhb (u, v) = ( A −1) + Hhp (u, v)

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
High-Frequency Emphasis Filtering

To accentuate the contribution to enhancement made


by the high-frequency components of an image
Multiplying a highpass filter function by a constant and
adding an offset so that the zero frequency term is not
eliminated by the filter
Filter transfer function of High frequency emphasis

✓ Typical values of a are in the range 0.25 to 0.5


and typical values of b are in the range 1.5 to 2.0.
High Frequency Emphasis Filtering
Hhfe (u, v) = a + bHhp (u, v)
Original Butterworth
highpass
filtered
image

High freq. emphasis After


filtered image Hist
Eq.

a = 0.5, b = 2
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
High Frequency Emphasis Filtering
Homomorphic Filtering
An image can be expressed as

f (x, y) = i( x, y)r( x, y)
i(x,y) = illumination component
r(x,y) = reflectance component

We need to suppress effect of illumination that cause image


intensity changed slowly.
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( x, y)} = {ln f ( x,y)}
= {ln i( x, y)} + {ln r(x, y)}
Z (u, v) = Fi (u, v) + Fr (u, v)
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)F i (u, v)} + −1{H (u, v)F r (u, v)}
= i' (x, y) + r'(x, y)
g ( x, y) = e s ( x, y ) = ei '( x, y ) e r '( x, y )
= i0 ( x, y)r0 (x, y)
Homomorphic Filtering

• Illumination component of an image


– Characterized by slow spatial variation
– Low frequencies associate with illumination
• Reflectance component of an image
– To vary abruptly, particularly at the junctions
of dissimilar objects
– High frequencies associate with reflectance
• A good deal of control can be gained over the
illumination and reflectance components with a
homomorphic filter.
• This control requires specification of a filter
function H(u,v) that affects the low- and high-
frequency components of the Fourier transform in
different ways.
Homomorphic Filter Function H(u,v)
Homomorphic Filtering

Slightly modified from of the Gaussian highpass


filter

H (u, v) = ( H− L )[1− e −c( D 2 (u,v) / D 0 2 )


]+ L

✓ Constant c
To control the sharpness of the slope of the
filter function as it transitions between γL and
γH.
✓ This type of filter is similar to the high-
frequency emphasis filter.
Homomorphic Filtering

A reduction of dynamic range in the brightness, together with an


increase in contrast, brought out the details of objects inside the
shelter and balanced the gray levels of the outside walls.
Enhanced image is sharper.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Homomorphic Filtering
Correlation Application: Object Detection

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
FAST FOURIER TRANSFORM (FFT)
The Fast Fourier Transform

- The time taken to evaluate a DFT on a digital computer depends mainly on


the number of multiplication involved, since these are the slowest operations.
- With DFT, this number is directly related to N2 (matrix multiplication of a
vector), where N is the length of the transform.
- N is chosen to be at least 256 to get a reasonable approximation of the
spectrum of the sequence. Hence 2562 = 65536! And computational speeds
becomes major consideration.
- Highly efficient computer algorithms for estimating DFT have been
developed since the mid-60’s by two mathematicians named Cooley and
Tukey. These are known as Cooley-Tukey Fast Fourier Transform (CT-FFT)
algorithms. They rely on the fact that the standard DFT involves a lot of
redundant calculations.
The Fast Fourier Transform

N −1 2 N −1
−j
F [n] =  f [k ]e F [n] =  f [k ]W
nk
N nk
Re-writing: as N
k =0 k =0

- The same values of WNnk (called a twiddle factor) are calculated many times
as the computational proceeds.
- First, the integer products nk repeats for different combinations of k and n.
- Secondly, WNnk is a periodic function with only N distinct values.
The Fast Fourier Transform
The Fast Fourier Transform

Decimation-in-time algorithm …
Let us begin by splitting the single summation over N samples into 2 summations, each
with N/2 samples, one for k even and the other for k odd.

Substitute m = k/2 for k even and m = (k-1)/2 for k odd and write:
N N
−1 −1
2 2
F [n] =  f [2m]WN2 mn +  f [2m + 1]WN( 2 m +1) n
m =0 m =0
2 2
−j ( 2 mn ) −j mn
Note that WN2 mn = e N
=e N 2
= WNmn2
N N
−1 −1
2 2
Therefore F [n] =  f [2m]WNmn2 + WNn  f [2m + 1]WNmn2
m =0 m =0

ie. F [n] = G[n] + WNn H [n]


The Fast Fourier Transform

F [n] = G[n] + WNn H [n]

Thus, the N-point DFT F[n] can be obtained from two N/2-point transforms, one on even
input data, G[n] and the other one on odd input data, H[n].

Although the frequency index n ranges over N values, only N/2 values of G[n] and H[n]
need to be computed since G[n] and H[n] are periodic in n with period N/2.
For example: N = 8:
• Even input data: f[0], f[2], f[4], f[6]
• Odd input data: f[1], f[3], f[5], f[7]

From F [n] = G[n] + WNn H [n]


We’ll get F [0] = G[0] + W80 H [0]
F [1] = G[1] + W81 H [1]
F [2] = G[2] + W82 H [2]
F [3] = G[3] + W83 H [3]
F [4] = G[0] + W84 H [0] = G[0] − W80 H [0]
F [5] = G[1] + W85 H [1] = G[1] − W81 H [1]
F [6] = G[2] + W86 H [2] = G[2] − W82 H [2]
F [7] = G[3] + W87 H [3] = G[3] − W83 H [3]
This is shown graphically on the FFT signal flow graph below:
Assuming that N is a power of 2, we can repeat the above process on the two N/2-point
transforms, breaking them down to N/4-point transforms, etc…, until we come down to
2-pont transforms.

For N=8, only one further stage is needed (i.e. there are  stages, where N = 2 ), as
shown below.
Thus, the FFT is computed by dividing up, or decimating, the sample sequence f[k] into
sub-sequences until only 2-point DFT’s remain.

Since it is the input, or time, samples divided up, this algorithm is known as the
decimation-in-time (DIT) algorithm. (An equivalent algorithm exists for which the output,
or frequency, points are sub-divided --- the decimation-in- frequency algorithm.)

The basic computation at the heart of the FFT is known as the butterfly because of its
crisscross appearance. For the DIT FFT algorithm, the butterfly computation is of the form
shown:
where A and B are complex numbers. Thus, a
butterfly computation requires
1 complex multiplication and 2 complex
additions.

Note also, that the input samples are “bit-


reversed” (see table) because at each stage of
decimation the sequence input samples is
separated into even- and odd-indexed samples.

( The bit-reversal algorithm only


applies if N is an integral power
of 2. )

3/17/2023
The Fast Fourier Transform
A step-by-step FFT signal flow graph generation
F [0] = G[0] + W80 H [0]
F [1] = G[1] + W81 H [1]
F [2] = G[2] + W82 H [2]
F [3] = G[3] + W83 H [3]
F [4] = G[0] + W84 H [0] = G[0] − W80 H [0]
Note: the WNnk is the
F [5] = G[1] + W H [1] = G[1] − W H [1]
8
5
8
1
negative of the WNnk!
F [6] = G[2] + W H [2] = G[2] − W82 H [2]
8
6

F [7] = G[3] + W87 H [3] = G[3] − W83 H [3]


The circles are where the FFT butterflies are.
An 8-point FFT can be decimated into two 4-point DFTs and four 2-point DFTs
accordingly, as shown.
Consider a 2-point DFT which has f[0] and f[2] as inputs, from def.
N −1 1
F [n] =  f [k ]W nk
N so F [0] =  f [k ]W20 k = f [0] + f [1]
k =0 k =0
1
F [1] =  f [k ]W2k = f [0] + f [1]W21 = f [0] − f [1]
k =0

The twiddle factor W2nk has 2 values: +1 and -1

Therefore, F0, 0 [0] = f [0] + f [4]


F0, 0 [1] = f [0] − f [4]
F0,1[0] = f [2] + f [6]
F0,1[1] = f [2] − f [6]
F1, 0 [0] = f [1] + f [5]
F1, 0 [1] = f [1] − f [5]
F1,1[0] = f [3] + f [7]
F1,1[1] = f [3] − f [7]
The next stage would be 4-point DFTs:

The twiddle factor W4nk has 4 values: +1, -j, -1 and +j


From the diagram,
F0 [0] = F0, 0 [0] + W40 F0,1[0] = F0, 0 [0] + F0,1[0]
F0 [2] = F0, 0 [0] + W42 F0,1[0] = F0, 0 [0] − F0,1[0]
F0 [1] = F0, 0 [1] + W41 F0,1[1] = F0, 0 [1] − jF0,1[1]
F0 [3] = F0, 0 [1] + W43 F0,1[1] = F0, 0 [1] + jF0,1[1]

F1[0] = F1, 0 [0] + W40 F1,1[0] = F1, 0 [0] + F1,1[0]


F1[2] = F1, 0 [0] + W42 F1,1[0] = F1, 0 [0] − F1,1[0]
F1[1] = F1, 0 [1] + W41 F1,1[1] = F1, 0 [1] − jF1,1[1]
F1[3] = F1, 0 [1] + W43 F1,1[1] = F1, 0 [1] + jF1,1[1]

These will be the inputs to the next stage which is the final stage, which we have
already done before.
Can you identify where the FFT butterflies are?
Computational Speed of FFT

The DFT requires N2 complex multiplications (and (N-1)2 complex additions).

For FFT, each stage (i.e. each halving), N/2 complex multiplications are required to
combine the results of the previous stage. Since there are (log2N) stages, the number of
complex multiplications required to evaluate an N-point DFT with the FFT is
approximately N/2xlog2N (and Nlog2N complex additions).

Remember: The Fast Fourier Transform is just a faster algorithm for computing the Discrete
Fourier Transform —it does not produce a different result
MATLAB CODE: FFT

https://www.mathworks.com/help/matlab/ref/fft.html

You might also like