Fourier Transform
Image Transforms
• Many times, image processing tasks can be best
performed in a domain other than the spatial domain.
• Key steps
(1) Transform the image
(2) Carry the task(s) in the transformed domain.
(3) Apply inverse transform to return to the spatial domain.
Trigonometric Fourier Series
• Any periodic function f(t) can be
expressed as a weighted (infinite)
sum of sine and cosine functions of
increasing frequency:
basis functions
where
n=1,2,3,…
coefficients of expansion
Trigonometric Fourier Series (cont’d)
Sinusoidals of varying frequency
Trigonometric Fourier Series - Example
Exponential Fourier Series
complex exponential
Relationship to
trigonometric series:
where
• This can also be thought as a decomposition into
sines and cosines as implied by Euler’s formula:
Time and Frequency
• example : g(t) = sin(2pi f t) + (1/3)sin(2pi (3f) t)
Time and Frequency
• example : g(t) = sin(2pi f t) + (1/3)sin(2pi (3f) t)
= +
Frequency Spectra
• example : g(t) = sin(2pi f t) + (1/3)sin(2pi (3f) t)
= +
Frequency Spectra
• Usually, frequency is more interesting than the phase
Frequency Spectra
= +
=
Frequency Spectra
= +
=
Frequency Spectra
= +
=
Frequency Spectra
= +
=
Frequency Spectra
= +
=
Frequency Spectra
=
Fourier Transform – more formally
Represent the signal as an infinite weighted sum
of an infinite number of sinusoids
Note:
Arbitrary function Single Analytic Expression
Spatial Domain (x) Frequency Domain (u)
(Frequency Spectrum F(u))
Inverse Fourier Transform (IFT)
Why is FT Useful?
• Easier to remove undesirable frequencies in the
frequency domain (i.e., frequency domain filtering).
• Faster to perform certain operations in the frequency
domain than in the spatial domain (e.g., convolution)
using the Fast Fourier Transform (FFT)
Frequency Filtering: Main Steps
1. Take the FT of f(x):
2. Remove undesired frequencies
by applying a filter:
3. Convert back to spatial domain:
More details later …
Example: Removing undesirable frequencies
frequency
noisy signal decomposition
remove high filtered
frequencies signal
How do frequencies show up in an image?
• Low frequencies correspond to slowly varying pixel
intensities (e.g., smooth areas).
• High frequencies correspond to quickly varying pixel
intensities (e.g., edges)
Original Image Smoothed or low-passed image
(i.e., high frequencies removed)
Extending FT in 2D
• Forward FT
• Inverse FT
Discrete Fourier Transform (DFT)
• Extending the FT to the DFT requires converting
continuous functions into a sequence of discrete
values 🡪 apply sampling!
f(x) F(u)
x-th sample (i.e., x is now an index)
Δx: sampling step in the spatial domain
(assuming x0=0)
u-th sample (i.e., u is now an index)
Δu: sampling step in the frequency domain
Discrete Fourier Transform (DFT) (cont’d)
Forward DFT:
u-th sample (i.e., u is now an index)
Inverse DFT:
x-th sample (i.e., x is now an index)
Example
f(0) = 2
f(1) = 3
f(2) = 4
f(3) = 4
13/4
F(0) = 13/4
F(1) = 1/4(-2+j) 1
F(2) = -1/4
F(3) = -1/4(2+j)
Extending DFT to 2D
• Assuming that f(x,y) is M x N:
• Forward DFT
(u-th, v-th) sample (i.e., u and v are now an indices)
• Inverse DFT:
Notation:
x
(x-th, y-th) sample (i.e., x and y are now an indices)
Extending DFT to 2D (cont’d)
• Special case: f(x,y) is N x N:
• Forward DFT
(u-th, v-th) sample (i.e., u and v are now an indices)
• Inverse DFT
(x-th, y-th) sample (i.e., x and y are now an indices)
Image Processing in the Fourier Domain
Magnitude of the FT
Does not look anything like what we have seen
Image Processing in the Fourier Domain
Magnitude of the FT
Does not look anything like what we have seen
2D DFT Interpretation
2D cos/sin functions
DFT Properties: (1) Separability
• The 2D DFT can be computed using 1D DFTs:
Forward DFT:
This is because
the exponential
kernel is
separable!
DFT Properties: (1) Separability (cont’d)
• Using the kernel separability:
• Let’s set: 1
2D DFT steps:
• Then: 1
1. Compute F1(x,v)
2. Compute F(u,v)
DFT Properties: (1) Separability (cont’d)
• How to compute F1(x,v)?
) x,v=0,1,2,…N-1
N x DFT of the rows of f(x,y)
• How to compute F(u,v)?
1 u,v=0,1,2,…N-1
DFT of the cols of F1(x,v)
DFT Properties: (1) Separability
Computing 2D DFT using 1D DFTs:
f(x,y)🡪F1(x,v)🡪F(u,v)
The same exactly steps (i.e., rows first, columns
second) can be used to compute the 2D IDFT
using 1D IDFTs.
DFT Properties: (2) Periodicity
• The DFT and its inverse are periodic with period N:
DFT Properties: (3) Symmetry
DFT Properties: (4) Translation
f(x,y) F(u,v)
• Translation in spatial domain:
• Translation in frequency domain:
)
N
DFT Properties: (4) Translation (cont’d)
• To “see” a full period of the DFT, we need to translate the
origin of F(u) to N/2 in 1D or of F(u,v) to (N/2,N/2) in 2D
this is what we see!
|F(u)|
after translation
|F(u-N/2)|
DFT Properties: (4) Translation (cont’d)
• Use the following property to preform the translation
F(u-N/2,v-N/2):
)
N
Set
• This results to the following result:
DFT Properties: (4) Translation (cont’d)
• Need to pre-multiply f(x,y) by (-1) x+y to see a full
period.
• You need to “undo” the multiplication by (-1) x+y when
you transform your results back to the spatial domain.
f(x,y) (-1)x+y 🡪2D DFT🡪 Filtering 🡪 2D IDFT 🡪g(x,y) (-1)x+y
DFT Properties: (4) Translation (cont’d)
sinc
before translation after translation
DFT Properties: (5) Rotation
• Rotating f(x,y) by θ rotates F(u,v) by θ
DFT Properties: (6) Addition/Multiplication
DFT Properties: (7) Scale
DFT Properties: (8) Average value
Average:
F(u,v) at u=0, v=0:
So: