Professional Documents
Culture Documents
Fourier Analysis
Fourier Analysis
Image Processing
Earl F. Glynn
Scientific Programmer
Bioinformatics
Stowers Institute for Medical Research
14 Feb 2007
1
Fourier Analysis and
Image Processing
• History
• Periodic Signals
• Fourier Analysis
– Fourier Series
– Fourier Transform
– Discrete Fourier Transform (DFT)
– Fast Fourier Transform (FFT)
• 2D FFT and Image Processing
– Spatial Frequency in Images
– 2D Discrete Fourier Transform
– 2D FFT Examples
– Applications of FFTs in Image Processing
• Summary 2
History
Jean Baptiste Joseph Fourier
1768-1830
http://de.wikipedia.org/wiki/Kreiszahl
Outlined technique in memoir, On the Propagation of Heat in Solid Bodies, which was
read to Paris Institute on 21 Dec 1807. Controversial then: Laplace and Lagrange
objected to what is now Fourier series: “... his analysis ... leaves something to be desired on
the score of generality and even rigour...” (from report awarding Fourier math prize in 1811)
x(t + T) = x(t)
4
Periodic Signals
x(t + T) = x(t)
Fundamental
frequency:
1.0
f0 = 1/T0
sin(t)
0.0
T0
-1.0
0 π 2 π 3π 2 2π 3π 4π
t
1.0
sin(4t)
0.0
-1.0
0 π 2 π 3π 2 2π 3π 4π
t
5
Harmonics: Integer multiples of frequency of wave
Periodic Signals
x(t + T) = x(t)
T0
-2 -1
0 π 2 π 3π 2 2π 3π 4π
6
Biological time series can be quite complex, and will contain noise.
Periodic Signals
Periodicity in Biology and Medicine
Electrocardiogram (ECG): Measure of the dipole moment caused by
depolarization and repolarization of heart muscle cells.
From http://www.ecglibrary.com/norm.html
Intraerythrocytic Developmental
Cycle of Plasmodium falciparum
From Bozdech, et al, Fig. 1A, PLoS Biology, Vol 1, No 1, Oct 2003, p 3.
• Fourier Transform
Maps one function to another: continuous-to-continuous mapping.
An integral transform.
8
Fourier Series
Trigonometric Fourier Series
Expansion of continuous function into weighted sum of sines and cosines.
x(t ) = a + ∑ [ a ⋅ cos (k ω ]
∞
0
k 0 t ) + bk ⋅ sin (k ω 0 t )
2 k =1
x(t ) ⋅ cos(k ω 0 t ) dt
2
T ∫T
ak = 0
0
x(t ) ⋅ sin(k ω 0 t ) dt
2
bk = ∫
T T 0
0
2π
ω0 = = 2π
www.science.org.au/nova/029/029img/wave1.gif
f
T 0
0
u* = a - ib
Euler’s Formula:
DeMoivre’s Theorem:
10
Fourier Series
Complex Exponential Fourier Series
Expansion of continuous function into weighted sum of complex exponentials.
∞
ω 0 ⋅t
∑c e
i ⋅k ⋅
x (t ) = k
k = −∞
1 − i ⋅k ⋅ω 0 ⋅t
c k
= ∫
T T 0
x(t ) ⋅ e dt
0
2π
ω0 = = 2π f
T 0
0
Notes:
• If x(t) is real, c-k = ck*.
• For k = 0, ck = average value of x(t) over one period.
• a0/2 = c0; ak = ck + c-k; bk = i · (ck - c-k)
Source Schaum’s Theory and Problems: Signals and Systems, Hwei P. Hsu, 1995, pp. 211-213 11
Fourier Series
Complex Exponential Fourier Series
Source: Schaum’s Theory and Problems: Signals and Systems, Hwei P. Hsu, 1995, pp. 211-213 12
sin 2t sin 3t
x (t ) = 2 sin t − + − ...
2 3
Fourier Series
Given: x(t) = t
1.0
0.8
0.6
x(t)
0.4
0.2
0.0
0.0 0.2 0.4 0.6 0.8 1.0
Fourier Series:
sin 2t sin 3t
x(t ) = 2 sin t − + − ...
2 3
Fourier Series
Given: x(t) = t Fourier Series: sin 2t sin 3t
x(t ) = 2 sin t − + − ...
2 3
3
1.5
1
2
1.0
Fourier Terms
2
x(t)
0.5
3
0.0
1
5 6
-0.5
-1.0
0 π 4 π 2 3π 4 π 0 π 4 π 2 3π 4 π
t t
Fourier Series
Given: x(t) = t Fourier Series: sin 2t sin 3t
x(t ) = 2 sin t − + − ...
2 3
100 terms
3
200 terms
2
x(t)
1
0
0 π 4 π 2 3π 4 π
Remove
High Frequency
Component
0
Decomposition Reconstruction
“Remove” high frequency noise by zeroing a term in series expansion
selected 16
Fourier Transform
Maps one function to another: continuous-to-continuous mapping.
From http://en.wikipedia.org/wiki/Continuous_Fourier_transform
Also see Schaum’s Theory and Problems: Signals and Systems, Hwei P. Hsu, 1995, pp. 219-223 18
Discrete Time Signal
sinθ
1.0
0.5
sinθ
0.0
N0
-0.5
-1.0
0 π 2 π 3π 2 2π 3π 4π
19
Discrete Fourier Transform (DFT)
Given discrete time sequence, x[n], n = 0, 1, …, N-1
k = 0, 1, …, N-1
Nth root of unity
Inverse Discrete Fourier Transform (IDFT)
N −1 i ( 2πkn / N )
1
x[n] = IDFT{ X [k ]} =
N
∑ X [k ] ⋅ e
n=0
The Eight Eighth Roots of Unity
http://math.fullerton.edu/mathews/
• One-to-one correspondence between x[n] and X[k] c2003/ComplexAlgebraRevisitedMod.html
• DFT closely related to discrete Fourier series and the Fourier Transform
• DFT is ideal for computer manipulation
• Share many of the same properties as Fourier Transform
• Multiplier (1/N) can be used in DFT or IDFT. Sometimes 1/SQRT(N) used in both.
Sources: Schaum’s Theory and Problems: Signals and Systems, Hwei P. Hsu, 1995, pp. 305 20
and http://en.wikipedia.org/wiki/Fast_Fourier_transform
Discrete Fourier Transform (DFT)
N −1 − i ( 2πkn / N )
X [k ] = DFT{x[n]} = ∑ x[n] ⋅ e
n=0
k = 0, 1, …, N-1
− 0 ⋅ iπ / 2
e −1⋅iπ / 2
e − 2 ⋅ iπ / 2
e − 3⋅ i π / 2
k X 1 = e e e e x1 n
X 2 − 0 ⋅ iπ / 2 − 2 ⋅ iπ / 2 − 4 ⋅ iπ / 2 − 6 ⋅ iπ / 2
x
e− 0⋅iπ / 2 e
− 3⋅ i π / 2
e − 6 ⋅ iπ / 2
e − 9 iπ / 2
2
X 3 e e e e x3
X 0 1 1 1 1 x 0
− −
X 1 = 1 i 1 i x1
X 2 1 − 1 1 − 1 x 2
X 3 1 i − 1 − i x 3
21
Discrete Fourier Transform (DFT)
For N = 4, the DFT is:
X 0 1 1 1 1 x 0
− −
X 1 = 1 i 1 i x1
X 2 1 − 1 1 − 1 x 2
X 3 1 i − 1 − i x 3
x = [1, 0, 1, 0] X = [2, 0, 2, 0]
x = [0, 3, 0, 3] X = [6, 0, -6, 0]
x = [1, 1, 1, 1] X = [4, 0, 0, 0]
x = [0, 0, 0, 0] X = [0, 0, 0, 0]
x = [0, 0, 1, 1] X = [2, -1+i, 0, -1-i]
x = [1, 1, 0, 0] X = [2, 1- i, 0, 1+i]
X[0]/N = mean
22
Discrete Fourier Transform (DFT)
x = [1, 0, 1, 0] DFT(x) = [2, 0, 2, 0]
x = [0, 1, 0, 1] DFT(x) = [2, 0, -2, 0]
Discrete Sequence
0.0 0.5 1.0
x(t)
1 2 3 4
Time
Periodogram
Spectral Power
0.6
0.0
1/Time
Periodogram = |DFT(x)|2 / N 23
(excluding first term, which is the mean)
Discrete Fourier Transform (DFT)
x = [0, 0, 1, 1] X = [2, -1+i, 0, -1-i]
x = [1, 1, 0, 0] X = [2, 1- i, 0, 1+i]
Discrete Sequence
0.0 0.5 1.0
x(t)
1 2 3 4
Time
Periodogram
?
Spectral Power
0.3
0.0
1/Time
ΔT = 1
x(t)
1 2 3 4
Time
fNyquist =1/(2ΔT)Periodogram
Spectral Power
0.3
0.0
1/Time
The top signal is sampled at the Nyquist limit and is not aliased.
The bottom signal is sampled beyond the Nyquist limit and is aliased.
Aliasing occurs when higher frequencies are folded into lower frequencies.
26
From: http://www.siggraph.org/education/materials/HyperGraph/aliasing/alias3.htm
Fast Fourier Transform (FFT)
Discrete Fourier Transform (DFT)
N −1 − i ( 2πkn / N )
X [k ] = DFT{x[ n]} = ∑ x[n] ⋅ e
n=0
k = 0, 1, …, N-1
28
Fast Fourier Transform (FFT)
Software
www.fftw.org
FFTW is a C subroutine library for computing the discrete Fourier transform
(DFT) in one or more dimensions, of arbitrary input size
29
Fast Fourier Transform (FFT)
1D FFT in IDL Software
Source: http://imagejdocu.tudor.lu/Members/tboudier/plonearticle.2006-07-12.6904098144/2006-07-14.2969642786/image
32
Spatial Frequency in Images
Frequency = 1 Frequency = 2
1 Cycle 2 Cycles
33
2D Discrete Fourier Transform
M −1 N −1 um vn
1
∑ ∑ I [m, n] ⋅ e
−i 2π +
F [u, v] = M N
MN m =0 n =0
M pixels
(0,0) SM units
(0,N/2)
N pixels
SN units
Fourier (0,0)
Transform (-M/2,0) (M/2,0)
Fourier (0,0)
Transform (-M/2,0) (M/2,0)
(0,0) Origin
(0,0) Origin
FFT Inverse
FFT
Noise Pattern
Stands Out as Four Noise
Four Spikes Spikes Removed
Edit FFT
Source: www.mediacy.com/apps/fft.htm, Image Pro Plus FFT Example. Last seen online in 2004. 39
Application of FFT
Pattern/Texture Recognition
Source: Lee and Chen, A New Method for Coarse Classification of Textures and Class Weight Estimation 40
for Texture Retrieval, Pattern Recognition and Image Analysis, Vol. 12, No. 4, 2002, pp. 400–410.
Application of FFT
Pattern/Texture Recognition
I[m,n] I’[m,n]
Raw Image Enhanced Image
Pre- Post-
processing processing
Source: Gonzalez and Woods, Digital Image Processing (2nd ed), 2002, p. 159 42
Application of FFT
Filtering: IDL Fourier Filter Demo
IDL Run Demo, Data Analysis, Image Processing, Image Processing Demo
43
Application of FFT
Filtering: IDL Fourier Filtering Demo
Source: http://www.reindeergraphics.com/index.php?option=com_content&task=view&id=179&Itemid=127 45
Application of FFT
Deblurring: Deconvolution
The Point Spread Function (PSF) is the Fourier transform of a filter.
(the PSP says how much blurring there will be in trying to image a point).
Deblurred image
Source: http://www.reindeergraphics.com/index.php?option=com_content&task=view&id=179&Itemid=127 46
Summary
• Fourier Analysis is a powerful tool even when periodicity is not
directly a part of the problem being solved.
• Discrete Fourier Transforms (DFT) are well-suited for computation
by computer, especially when using Fast Fourier Transform (FFT)
algorithms.
• Fourier Analysis can be used to remove noise from a signal or
image.
• Interpretation of the complex Fourier Transform is not always
straightforward.
• Convolution and Deconvolution are “simple” in Fourier transform
space to restore or enhance images.
• There are many other image processing uses of Fourier Analysis,
such as image compression [JPGs use the Discrete Cosine
Transform (DCT), which is a special kind of DFT] 47