You are on page 1of 10

Computer Vision, Image Processing and

Computational Photography
Lecture 4: Fourier transforms

Ayelet Heimowitz

November, 2022

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


Discrete Fourier transform
1-D DFT
N−1
X 2π
F [k] = f [n]e−j N
nk

n=0

In matrix form
1 1 1 ··· 1
 
 
F [0] 1 W W2 ··· W N−1  f [0]
 
 F [1] 
W2 W4 W N−2 
 
1 ··· f [1] 
 F [2] 
   
W3 W6 W N−3 
 
 1
= ···  . ,
 .   . 
.

  . . . . .    . 
 .  . . . .. .  f [N − 1]
. . . .
F [N − 1]
N−1 N−2
1 W W ··· W


where W = e−j N .
1-D IDFT
N−1
1 X 2π
f [n] = F [k]ej N nk
N
k=0

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


Discrete Fourier transform

Euler’s formula
ejθ = cos(θ) + j sin(θ).

1-D DFT
N−1  
X 2π 2π
F [k] = f [n] cos( nk) − j sin( nk)
N N
n=0

1-D DFT
N−1  
X 2π 2π
f [n] = F [k] cos( nk) + j sin( nk)
N N
k=0

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


Inverse Discrete Fourier transform
2-D DFT

N−1
X M−1
1 X −j2π( mu + nv )
F [u, v ] = √ f [m, n]e M N =
MN n=0 m=0
N−1
X M−1
1 mu nv mu nv
X  
= √ f [m, n] cos(2π( + )) − j sin(2π( + ))
MN n=0 m=0 M N M N

2-D IDFT

N−1
X M−1
1 X j2π( mu + nv )
f [m, n] = √ F [u, v ]e M N =
MN v =0 u=0
N−1
X M−1
1 mu nv mu nv
X  
= √ F [u, v ] cos(2π( + )) + j sin(2π( + ))
MN v =0 u=0 M N M N

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


DFT Basis functions

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


DFT of the image
Every image I (with real, finite pixel values) can be
represented as a weighted sum of the 2-D Fourier basis
functions.

The spectrum of the image is made up of the absolute values


of the coefficients of this sum |F [u, v ]|.

Spectrum is usually shifted such that |F [0, 0]| is in the center


of the matrix F .

The phase angle of the image is φ[u, v ] = tan−1 ( Imag{F [u,v ]}


real{F [u,v ]} ).

The Fourier transform in polar coordinates is


F [u, v ] = |F [u, v ]|e−jφ[u,v ] .
Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra
Centering the Fourier spectrum

To center the Fourier spectrum: multiply the image by (−1)m+n .

X M−1
N−1
1 X m+n −j2π( mu + nv )
F̂ [u, v ] = √ f [m, n](−1) e M N =
MN n=0 m=0

X M−1
N−1
1 X jπ(m+n) −j2π( mu + nv )
= √ f [m, n]e e M N =
MN n=0 m=0
N−1
X M−1 m(u−M/2) n(v −N/2)
1 X −j2π( + )
= √ f [m, n]e M N
MN n=0 m=0

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


Spectrum of the image

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


Filtering an image in the frequency domain

Multiply image by (−1)m+n .

Compute the DFT of the image.

Element-by-element multiplication with the DFT of the filter


H (convolution in the spatial domain is multiplication in the
frequency domain).

Compute the IDFT (real part).

Multiply image by (−1)m+n .

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra


Filtering an image in the frequency domain

Ayelet Heimowitz Computer Vision, Image Processing and Computational Photogra

You might also like