Image Processing,
Retrieval, and Analysis (I)
Prof. Christian Bauckhage
Outline
Lecture 09
Recap
Derivation of the FT
The Fourier Transform and Linear Filters
Higher Dimensional FT
Discrete FT
Fourier Spectra
Filtering
Denoising
Summary
Exercises
Recap
Fourier series (I)
I assume a general periodic function f (x), w.l.o.g. period = 1
Recap
Fourier series (I)
I assume a general periodic function f (x), w.l.o.g. period = 1
I then
a0 X
n
f (x) = + αk sin(2π k x + φk )
2
k=1
where a0 , αk , φk , and νk = 2π k ∈ R
Recap
Fourier series (I)
I assume a general periodic function f (x), w.l.o.g. period = 1
I then
a0 X
n
f (x) = + αk sin(2π k x + φk )
2
k=1
where a0 , αk , φk , and νk = 2π k ∈ R
I or, using the complex exponential
X
n X
n
f (x) = ck ei 2π k x = f̂ (k) ei 2π k x
k=−n k=−n
where ck ∈ C
Recap
Fourier series (II)
I the complex valued function
Z1
f̂ (k) = f (x) e−i 2π k x dx
0
is called the kth Fourier coefficient
Recap
Fourier series (II)
I the complex valued function
Z1
f̂ (k) = f (x) e−i 2π k x dx
0
is called the kth Fourier coefficient
I general periodic functions f (x) require infinite series
∞
X
f (x) = f̂ (k) ei 2π k x
k=−∞
Recap
example: sharp edges require high frequencies (I)
f (x) f (x)
1 1
0 0
0 1 0 1
n=1 n=3
f (x) f (x)
1 1
0 0
0 1 0 1
n=5 n=9
I a simple function f (x) and Fourier series approximations
where n = 1, 3, 5, 9
Recap
example: sharp edges require high frequencies (II)
g(x) g(x)
1 1
0 0
0 1 0 1
n=1 n=3
g(x) g(x)
1 1
0 0
0 1 0 1
n=5 n=9
I a simple function g(x) and Fourier series approximations
where n = 1, 3, 5, 9
Recap
example: sharp edges require high frequencies (III)
h(x) h(x)
1 1
0 0
0 1 0 1
n=1 n=3
h(x) h(x)
1 1
0 0
0 1 0 1
n=5 n=9
I a simple function h(x) and Fourier series approximations
where n = 1, 3, 5, 9
Recap
Fourier series (III)
I the Fourier coefficient is an inner product / a projection
Z1
f̂ (k) = f (x)e−i 2π k x dx
0
Z1
f (x)ei 2π k x dx = f (x), ei 2π k x
=
0
Recap
Fourier series (IV)
I from looking at
∞
X ∞
X
i 2π k x
f , ei 2π k x ei 2π k x (1)
f (x) = f̂ (k) e =
k=−∞ k=−∞
and considering that
1 if k = m
hei 2π k x , ei 2π m x i = δkm =
0 if k 6= m
we deduce that the set of complex exponentials
∞
ei 2π k x
k=−∞
forms an orthonormal basis for L2 [0, 1] functions
Recap
note:
I L2 [0, 1] is a vector space and f (x) ∈ L2 [0, 1] is a vector
Recap
note:
I L2 [0, 1] is a vector space and f (x) ∈ L2 [0, 1] is a vector
I the Fourier series in (1) is a Hilbert space generalization of
the (familiar) representation of vectors, say, x ∈ R2 where
x
x= 1
x2
is just a notional shorthand for
x = x1 · e1 + x2 · e2 = hx, e1 i · e1 + hx, e2 i · e2
X
2
= hx, ei i · ei
i=1
Recap
transition to the Fourier transform (I)
I transition from periodic to non-periodic functions
I view non-periodic functions as the limiting case of
periodic ones, i.e. consider period T and let T → ∞
Recap
transition to the Fourier transform (I)
I transition from periodic to non-periodic functions
I view non-periodic functions as the limiting case of
periodic ones, i.e. consider period T and let T → ∞
I then
I Fourier transform ⇔ generalization of Fourier coefficient
I inverse Fourier transform ⇔ generalization of Fourier series
Recap
transition to the Fourier transform (II)
I if f (x) is periodic of period T, the Fourier series becomes
∞
X 2π k
f (x) = f̂ (k) ei T x
k=−∞
Recap
transition to the Fourier transform (II)
I if f (x) is periodic of period T, the Fourier series becomes
∞
X 2π k
f (x) = f̂ (k) ei T x
k=−∞
and the Fourier coefficient becomes
ZT
1 2π k
f̂ (k) = f (x) e−i T x
dx
T
0
Z
T/2
1 2π k
= f (x) e−i T x
dx
T
−T/2
Recap
Question:
I why does the factor 1
T appear?
Recap
Question:
I why does the factor 1
T appear?
Answer:
I observe that
ZT ZT
i 2π k x i 2π k x i 2π k
x −i 2π k
x
e T ,e T = e T e T dx = 1 dx = T
0 0
⇒ the factor normalizes the inner product
Recap
transition to the Fourier transform (III)
I introducing the angular frequency
2π k
ω=
T
we have
ωT
k=
2π
as well as
dω 2π T
= ⇔ dk = dω
dk T 2π
and we intuit that dk = 1 (← this is not really rigorous!!!)
Recap
transition to the Fourier transform (IV)
I as a function of ω, the Fourier coefficient becomes
Z
T/2
1
f̃ (ω) = f (x) e−i ω x dx
T
−T/2
Recap
transition to the Fourier transform (IV)
I as a function of ω, the Fourier coefficient becomes
Z
T/2
1
f̃ (ω) = f (x) e−i ω x dx
T
−T/2
and the Fourier series can be written as
∞
X
f (x) = f̃ (ω) ei ω x · 1
ωT
2π =−∞
∞
X T
= f̃ (ω) ei ω x · dω
ωT
2π
2π =−∞
Recap
transition to the Fourier transform (V)
I finally, letting T → ∞, we obtain
Z
∞ Z
∞
1
f (x) = f (x) e−i ω x dx ei ω x dω
2π
−∞ −∞
Z
∞ Z
∞
1 √1
=√ f (x) e−i ω x dx ei ω x dω (2)
2π 2π
−∞ −∞
Recap
Fourier transform of f (x)
Z
∞
1
F(ω) = √ f (x) e−iωx dx
2π
−∞
inverse Fourier transform of F(ω)
Z
∞
1
f (x) = √ F(ω) eiωx dω
2π
−∞
Recap
interpretation
I the Fourier transform analyzes f (x) into its constituent
parts — a continuous family of complex exponentials
I the inverse Fourier transform synthesizes f (x) from the
constituent parts
Recap
note:
I some noticeable properties of the Fourier transform
I zero frequency
Z
1
F(0) = √ f (x) dx
2π R
Recap
note:
I some noticeable properties of the Fourier transform
I zero frequency
Z
1
F(0) = √ f (x) dx
2π R
I translation
F f (x − a) (ω) = e−iωa F f (x) (ω)
Recap
note:
I some noticeable properties of the Fourier transform
I zero frequency
Z
1
F(0) = √ f (x) dx
2π R
I translation
F f (x − a) (ω) = e−iωa F f (x) (ω)
I scaling
1
ω
F f (a · x) (ω) = F f (x)
|a| a
The Fourier Transform and Linear Filters
higher dimensional Fourier transforms
I the FT can be generalized
I from functions f (x) of one variable
I to functions f (x1 , x2 , . . . , xn ) of n variables
The Fourier Transform and Linear Filters
higher dimensional Fourier transforms
I the FT can be generalized
I from functions f (x) of one variable
I to functions f (x1 , x2 , . . . , xn ) of n variables
I for multivariate functions, we have
Z∞ Z P
n
−i ωk xk
− n2
F(ω1 , . . . , ωn ) = (2π) · · · f (x1 , . . . , xn ) e k=1 dx1 . . . dxn
−∞
and
Z∞ Z P
n
i ω k xk
− n2
f (x1 , . . . , xn ) = (2π) · · · F(ω1 , . . . , ωn ) e k=1 dω1 . . . dωn
−∞
The Fourier Transform and Linear Filters
2D Fourier transform
Z
∞ Z
∞
1
F(µ, ν) = f (x, y) e−i (µx+νy) dx dy
2π
−∞ −∞
inverse 2D Fourier transform
Z
∞ Z
∞
1
f (x, y) = F(µ, ν) ei (µx+νy) dµ dν
2π
−∞ −∞
The Fourier Transform and Linear Filters
discrete Fourier transform
I recall that digital images are discrete 2D functions
The Fourier Transform and Linear Filters
discrete Fourier transform
I recall that digital images are discrete 2D functions
I for the analysis and synthesis of discrete functions,
there are discrete version of the Fourier transform
and its inverse
The Fourier Transform and Linear Filters
discrete 2D Fourier transform
X N−1
M−1 X mx ny
F[m, n] = f [x, y] e−i 2π ( M + N ) (3)
x=0 y=0
discrete inverse 2D Fourier transform
1 XX
M−1 N−1
mx ny
f [x, y] = F[m, n] ei 2π ( M + N ) (4)
MN
m=0 n=0
The Fourier Transform and Linear Filters
note:
I M and N are finite, as are the sums in (3) and (4)
The Fourier Transform and Linear Filters
note:
I M and N are finite, as are the sums in (3) and (4)
I in order for the DFT and its inverse to make sense,
one implicitly assumes that f [x, y] is periodic with
periods M and N, that is
f [x, y] = f [x ± M, y ± N]
The Fourier Transform and Linear Filters
example
..
.
··· ···
..
.
The Fourier Transform and Linear Filters
note:
I there is a very efficient way of computing the n-dim DFT,
the so called fast Fourier transform (FFT)
The Fourier Transform and Linear Filters
note:
I there is a very efficient way of computing the n-dim DFT,
the so called fast Fourier transform (FFT)
I we shall not discuss it now but will return to it later
The Fourier Transform and Linear Filters
note:
I there are many other transforms that are similar in spirit
The Fourier Transform and Linear Filters
note:
I there are many other transforms that are similar in spirit
I some of them also feature prominently in image processing
I Discrete Cosine transform
I Walsh-Hadamard transform
I Discrete Wavelet transform
I Laplace transform
I Z transform
I ...
The Fourier Transform and Linear Filters
note:
I there are many other transforms that are similar in spirit
I some of them also feature prominently in image processing
I Discrete Cosine transform
I Walsh-Hadamard transform
I Discrete Wavelet transform
I Laplace transform
I Z transform
I ...
The Fourier Transform and Linear Filters
Fourier spectra
0
0 1
-1
-48 -40 -32 -24 -16 -8 0 8 16 24 32 40 48
f (x) = 1
2 (sin 2π2x + sin 2π8x) |F(ω)|
I a function composed of two elementary sine waves and its
frequency spectrum
I note: on a computer, continuous functions are represented
as discrete point sets; thus, the spectrum contains artifacts
The Fourier Transform and Linear Filters
2D example
I sinusoid image f (x, y) and its spectrum |F(µ, ν)|
The Fourier Transform and Linear Filters
2D example
I sinusoid image f (x, y) and its spectrum |F(µ, ν)|
The Fourier Transform and Linear Filters
2D example
I sinusoid image f (x, y) and its spectrum |F(µ, ν)|
The Fourier Transform and Linear Filters
2D example
I sinusoid image f (x, y) and its spectrum |F(µ, ν)| (again)
The Fourier Transform and Linear Filters
2D example
I sinusoid image f (x, y) and its spectrum |F(µ, ν)|
The Fourier Transform and Linear Filters
2D example
I sinusoid image f (x, y) and its spectrum |F(µ, ν)|
The Fourier Transform and Linear Filters
2D example
f (x, y) log|F(µ, ν)|
I natural image and its frequency spectrum
The Fourier Transform and Linear Filters
low-pass filter
I 1D example
I consider function Gl (ω)
0
−ωl ωl
The Fourier Transform and Linear Filters
low-pass filter
I 2D application (I)
F ·Gl (µ,ν)
−
→ −−−−−→
The Fourier Transform and Linear Filters
low-pass filter
I 2D application (II)
F −1
−−→
The Fourier Transform and Linear Filters
high-pass filter
I 1D example
I consider function Gh (ω)
0
−ωh ωh
The Fourier Transform and Linear Filters
high-pass filter
I 2D application (I)
F ·Gh (µ,ν)
−
→ −−−−−→
The Fourier Transform and Linear Filters
high-pass filter
I 2D application (II)
F −1
−−→
The Fourier Transform and Linear Filters
band-pass filter
I 1D example
I consider function Gb (ω)
0
−ωh −ωl ωl ωh
The Fourier Transform and Linear Filters
band-pass filter
I 2D application (I)
F ·Gb (µ,ν)
−
→ −−−−−→
The Fourier Transform and Linear Filters
band-pass filter
I 2D application (II)
F −1
−−→
The Fourier Transform and Linear Filters
effect of noise
The Fourier Transform and Linear Filters
effect of low pass filtering
h(x, y) log|H(µ, ν)| log|Gl (µ, ν) · H(µ, ν)| F −1 Gl (µ, ν) · H(µ, ν)
Summary
we now know about
I the Fourier transform and its inverse
I higher dimensional (inverse) FTs
I discrete (inverse) FTs
I the ideas behind of low-, high- and band-pass filtering
Exercises
1. show that the 2D Fourier transform is a separable
operation, i.e. show that
Z
∞ Z
∞
1
F(µ, ν) = f (x, y) e−i (µx+νy) dx dy
2π
−∞ −∞
Z
∞ Z
∞
1 √1
=√ f (x, y) e−i µx dx e−i νy dy
2π 2π
−∞ −∞