You are on page 1of 55

Fourier Transform (Chapter 4)

CS474/674 Prof. Bebis

Mathematical Background:
Complex Numbers
A complex number x is of the form:

: real part, b: imaginary part


Addition:

Multiplication:

Mathematical Background:
Complex Numbers (contd)
Magnitude-Phase (i.e., vector) representation:

Magnitude:
Phase:

Magnitude-Phase notation:

Mathematical Background:
Complex Numbers (contd)
Multiplication using magnitude-phase representation

Complex conjugate

Properties

Mathematical Background:
Complex Numbers (contd)
Eulers formula

Properties
j

Mathematical Background:
Sine and Cosine Functions
Periodic functions
General form of sine and cosine functions:
y(t)=Asin(t+b)

y(t)=Acos(t+b)

Mathematical Background:
Sine and Cosine Functions
Special case: A=1, b=0, =1

period=2

3/2

/2

/2

3/2

Mathematical Background:
Sine and Cosine Functions (contd)
Changing the phase shift b:

Note: cosine is a shifted sine function:

cos(t ) sin(t )
2

Mathematical Background:
Sine and Cosine Functions (contd)
Changing the amplitude A:

Mathematical Background:
Sine and Cosine Functions (contd)
Changing the period T=2/||:
Asssume A=1, b=0: y=cos(t)

=4
period 2/4=/2
shorter period
higher frequency
(i.e., oscillates faster)
frequency is defined as f=1/T
Alternative notation: cos(t) or cos(2t/T) or cos(t/T) or cos(2ft) or cos(ft)

Basis Functions
Given a vector space of functions, S, then if any f(t) S can
be expressed as
f (t ) ak k (t )
k

the set of functions k(t) are called the expansion set of S.


If the expansion is unique, the set k(t) is a basis.

Image Transforms
Many times, image processing tasks are 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.

Transformation Kernels
Forward Transformation
T (u , v)

M 1 N 1

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

forward transformation kernel

u 0,1,..., M 1, v 0,1,..., N 1

x 0 y 0

inverse transformation kernel

Inverse Transformation
f ( x, y )

M 1 N 1

T (u, v)s( x, y, u, v)
u 0 v 0

x 0,1,..., M 1, y 0,1,..., N 1

Kernel Properties
A kernel is said to be separable if:

r ( x, y, u , v) r1 ( x, u )r2 ( y, v)
A kernel is said to be symmetric if:

r ( x, y, u , v) r1 ( x, u )r1 ( y, v)

Fourier Series Theorem


Any periodic function f(t) can be expressed as a
weighted sum (infinite) of sine and cosine functions of
varying frequency:

is called the fundamental frequency

Fourier Series (contd)

1
2
3

Continuous Fourier Transform (FT)


Transforms a signal (i.e., function) from the spatial (x)
domain to the frequency (u) domain.

where

Definitions
F(u) is a complex function:
Magnitude of FT (spectrum):
Phase of FT:
Magnitude-Phase representation:
Power of f(x): P(u)=|F(u)|2=

Why is FT Useful?
Easier to remove undesirable frequencies in the
frequency domain.
Faster to perform certain operations in the frequency
domain than in the spatial domain.

Example: Removing undesirable frequencies


noisy signal

To remove certain
frequencies, set their
corresponding F(u)
coefficients to zero!

remove high
frequencies

frequencies

reconstructed
signal

How do frequencies show up in an image?


Low frequencies correspond to slowly varying pixel
intensities (e.g., continuous surface).
High frequencies correspond to quickly varying pixel
intensities (e.g., edges)

Original Image

Low-passed

Example of noise reduction using FT


Input image

Band-reject
filter

Spectrum (frequency domain)

Output image

Frequency Filtering: Main Steps


1. Take the FT of f(x):
2. Remove undesired frequencies:
3. Convert back to a signal:

Well talk more about these steps later .....

Example: rectangular pulse

magnitude

rect(x) function

sinc(x)=sin(x)/x

Example: impulse or delta function


Definition of delta function:
Properties:

Example: impulse or delta function (contd)


FT of delta function:

x
u

Example: spatial/frequency shifts


f ( x) F (u ), then
(1) f ( x x0 ) e
(2) f ( x)e

j 2u0 x

j 2ux0

Special Cases:

F (u )

F (u u 0 )

( x x0 ) e
e

j 2u 0 x

j 2ux0

(u u 0 )

Example: sine and cosine functions


FT of the cosine function

cos(2u0x)

F(u)

1/2

Example: sine and cosine functions (contd)


FT of the sine function

jF(u)

sin(2u0x)

Extending FT in 2D
Forward FT

Inverse FT

Example: 2D rectangle function


FT of 2D rectangle function
2D sinc()
top view

Discrete Fourier Transform (DFT)

Discrete Fourier Transform (DFT) (contd)


Forward DFT

Inverse DFT

1/(Nx)

Example

Extending DFT to 2D
Assume that f(x,y) is M x N.
Forward DFT

Inverse DFT:

Extending DFT to 2D (contd)


Special case: f(x,y) is N x N.
Forward DFT
u,v = 0,1,2, , N-1

Inverse DFT
x,y = 0,1,2, , N-1

Extending DFT to 2D (contd)


2D cos/sin functions

Interpretation:

Visualizing DFT
Typically, we visualize |F(u,v)|
The dynamic range of |F(u,v)| is typically very large
Apply streching:

original image

(c is const)
|F(u,v)|

|D(u,v)|

before stretching

after stretching

DFT Properties: (1) Separability


The 2D DFT can be computed using 1D transforms only:

Forward DFT:

kernel is
separable:

j 2 (

ux vy
)
N

j 2 (

ux
vy
) j 2 ( )
N
N

DFT Properties: (1) Separability (contd)


Rewrite F(u,v) as follows:

Lets set:

Then:

DFT Properties: (1) Separability (contd)


How can we compute F(x,v)?
)

N x DFT of rows of f(x,y)


How can we compute F(u,v)?

DFT of cols of F(x,v)

DFT Properties: (1) Separability (contd)

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 (contd)


To show a full period, we need to translate the origin
of the transform at u=N/2 (or at (N/2,N/2) in 2D)
|F(u)|

|F(u-N/2)|

DFT Properties: (4) Translation (contd)


)
N

To move F(u,v) at (N/2, N/2), take


)
N

DFT Properties: (4) Translation (contd)

sinc

no translation

sinc

after translation

DFT Properties: (5) Rotation


Rotating f(x,y) by rotates F(u,v) by

DFT Properties: (6) Addition/Multiplication

but

DFT Properties: (7) Scale

DFT Properties: (8) Average value


Average:

F(u,v) at u=0, v=0:

So:

Magnitude and Phase of DFT


What is more important?

magnitude

phase

Hint: use the inverse DFT to reconstruct the input


image using only magnitude or phase information

Magnitude and Phase of DFT (contd)


Reconstructed image using
magnitude only
(i.e., magnitude determines the
strength of each component)

Reconstructed image using


phase only
(i.e., phase determines
the phase of each component)

Magnitude and Phase of DFT (contd)


only phase

only magnitude

phase (woman)
magnitude (rectangle)

phase (rectangle)
magnitude (woman)