108
Fourier Transform 1

IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Fourier Transform

1

Page 2: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Contents

•  Signals as functions (1D, 2D) –  Tools

•  Continuos Time Fourier Transform (CTFT)

•  Discrete Time Fourier Transform (DTFT)

•  Discrete Fourier Transform (DFT)

•  Discrete Cosine Transform (DCT)

•  Sampling theorem

2

Page 3: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Signals as functions

1.  Continuous functions of real independent variables –  1D: f=f(x) –  2D: f=f(x,y) x,y –  Real world signals (audio, ECG, images)

2.  Real valued functions of discrete variables –  1D: f=f[k] –  2D: f=f[i,j] –  Sampled signals

3.  Discrete functions of discrete variables –  1D: y=y[k] –  2D: y=y[i,j] –  Sampled and quantized signals –  For ease of notations, we will use the same notations for 2 and 3

3

Page 4: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Fourier Transform

•  Different formulations for the different classes of signals –  Summary table: Fourier transforms with various combinations of continuous/

discrete time and frequency variables. –  Notations:

•  CTFT: continuous time FT: t is real and f real (f=ω) (CT, CF) •  DTFT: Discrete Time FT: t is discrete (t=n), f is real (f=ω) (DT, CF) •  CTFS: CT Fourier Series (summation synthesis): t is real AND the function is periodic, f

is discrete (f=k), (CT, DF) •  DTFS: DT Fourier Series (summation synthesis): t=n AND the function is periodic, f

discrete (f=k), (DT, DF) •  P: periodical signals •  T: sampling period •  ωs: sampling frequency (ωs=2π/T) •  For DTFT: T=1 → ωs=2π

•  This is a hint for those who are interested in a more exhaustive theoretical approach

4

Page 5: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Images as functions

•  Gray scale images: 2D functions –  Domain of the functions: set of (x,y) values for which f(x,y) is defined : 2D lattice

[i,j] defining the pixel locations –  Set of values taken by the function : gray levels

•  Digital images can be seen as functions defined over a discrete domain {i,j: 0<i<I, 0<j<J}

–  I,J: number of rows (columns) of the matrix corresponding to the image –  f=f[i,j]: gray level in position [i,j]

5

Page 6: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example 1: δ function

[ ]⎩⎨⎧

≠≠

===

jijiji

ji;0,001

[ ]⎩⎨⎧ ==

=−otherwise

JjiJji

0;01

6

Page 7: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example 2: Gaussian

2

22

2

21),( σ

πσ

yx

eyxf+

=

2

22

2

21],[ σ

πσ

ji

ejif+

=

Continuous function

Discrete version

7

Page 8: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example 3: Natural image

8

Page 9: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example 3: Natural image

9

Page 10: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Complex Numbers

•  A complex number x is of the form:

a: real part, b: imaginary part

•  Addition

•  Multiplication

Page 11: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Complex Numbers (cont’d)

•  Magnitude-Phase (i.e.,vector) representation

Magnitude:

Phase:

φ Phase – Magnitude notation:

Page 12: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Complex Numbers (cont’d)

•  Multiplication using magnitude-phase representation

•  Complex conjugate

•  Properties

Page 13: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Complex Numbers (cont’d)

•  Euler’s formula

•  Properties

j

Page 14: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Sine and Cosine Functions

•  Periodic functions

•  General form of sine and cosine functions:

Page 15: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Sine and Cosine Functions

Special case: A=1, b=0, α=1

π

π

Page 16: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Sine and Cosine Functions (cont’d)

Note: cosine is a shifted sine function:

•  Shifting or translating the sine function by a const b

cos( ) sin( )2

t t π= +

Page 17: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Sine and Cosine Functions (cont’d)

•  Changing the amplitude A

Page 18: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Mathematical Background: Sine and Cosine Functions (cont’d)

•  Changing the period T=2π/|α| consider A=1, b=0: y=cos(αt)

period 2π/4=π/2

shorter period higher frequency (i.e., oscillates faster)

α =4

Frequency is defined as f=1/T

Alternative notation: sin(αt)=sin(2πt/T)=sin(2πft)

Page 19: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Fourier Series Theorem

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

is called the “fundamental frequency”

Page 20: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Fourier Series (cont’d)

α1

α2

α3

Page 21: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Continuous Fourier Transform (FT)

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

where

(IFT)

Page 22: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Why is FT Useful?

•  Easier to remove undesirable frequencies.

•  Faster perform certain operations in the frequency domain than in the spatial domain.

Page 23: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example: Removing undesirable frequencies

remove high frequencies

reconstructed signal

frequencies noisy signal

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

Page 24: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

How do frequencies show up in an image?

•  Low frequencies correspond to slowly varying information (e.g., continuous surface).

•  High frequencies correspond to quickly varying information (e.g., edges)

Original Image Low-passed

Page 25: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example of noise reduction using FT

Page 26: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Frequency Filtering Steps

1. Take the FT of f(x):

2. Remove undesired frequencies:

3. Convert back to a signal:

We’ll talk more about this later .....

Page 27: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Definitions

•  F(u) is a complex function:

•  Magnitude of FT (spectrum):

•  Phase of FT:

•  Magnitude-Phase representation:

•  Energy of f(x): P(u)=|F(u)|2

Page 28: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Continuous Time Fourier Transform (CTFT)

Time is a real variable (t)

Frequency is a real variable (ω)

Signals : 1D

28

Page 29: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

The idea A signal can be interpreted as en electromagnetic wave. This consists of lights of different “color”, or frequency, that can be split apart usign an optic prism. Each component is a “monochromatic” light with sinusoidal shape.

Following this analogy, each signal can be decomposed into its “sinusoidal” components which represent its “colors”.

Of course these components in general do not correspond to visible monochromatic light. However, they give an idea of how fast are the changes of the signal.

29

Page 30: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

CTFT: Concept

■  A signal can be represented as a weighted sum of sinusoids.

■  Fourier Transform is a change of basis, where the basis functions consist of sins and cosines (complex exponentials).

[Gonzalez Chapter 4]

30

Page 31: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Continuous Time Fourier Transform (CTFT)

T=1

31

Page 32: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Fourier Transform

•  Cosine/sine signals are easy to define and interpret.

•  Analysis and manipulation of sinusoidal signals is greatly simplified by dealing with related signals called complex exponential signals.

•  A complex number has real and imaginary parts: z = x+j y

•  The Eulero formula links complex exponential signals and trigonometric functions

( )e cos sinjr r jα α α= +cosα = e

iα + e−iα

2

sinα = eiα − e−iα

2i32

Page 33: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

CTFT

•  Continuous Time Fourier Transform

•  Continuous time a-periodic signal

•  Both time (space) and frequency are continuous variables –  NON normalized frequency ω is used

•  Fourier integral can be regarded as a Fourier series with fundamental frequency approaching zero

•  Fourier spectra are continuous –  A signal is represented as a sum of sinusoids (or exponentials) of all

frequencies over a continuous frequency interval

( ) ( )

1( ) ( )2

j t

tj t

F f t e dt

f t F e d

ω

ω

ω

ω

ω ωπ

−=

=

analysis

synthesis

Fourier integral

33

Page 34: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

CTFT of real signals

•  Real signals: each signal sample is a real number

•  Property: the CTFT is symmetric

34

( ) ( )

( ) ( ) ( )

( ){ } ( ) ( ) ( )'

ˆ

ˆ ˆ

Pr

ˆ' 'j t j t

f t f

f t f foof

f t f t e dt f t e dt fω ω

ω

ω ω

ω

+∞ +∞−

−∞ −∞

− → − =

ℑ − = − = = −∫ ∫

f̂ −ω( ) = f ω( )

ω

Page 35: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Sinusoids

•  Frequency domain characterization of signals

Frequency domain (spectrum, absolute value of the transform)

Signal domain

( ) ( ) j tF f t e dtωω+∞

−∞

= ∫

35

Page 36: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Gaussian

Frequency domain

Time domain

36

Page 37: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

rect

sinc function

Frequency domain

Time domain

37

Page 38: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example

38

Page 39: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Example

39

Page 40: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Properties

40

Page 41: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

CTFT

•  Change of variables for simplified notations: ω=2πu

•  More compact notations (same as in GW)

2(2 ) ( ) ( ) j uxF u F u f x e dxππ∞

−∞

= = =∫( )2 21( ) ( ) 2 ( )

2j ux j uxf x F u e d u F u e duπ ππ

π

∞ ∞

−∞ −∞

= =∫ ∫

( )

2

2

( ) ( )

( )

j ux

j ux

F u f x e dx

f x F u e du

π

π

∞−

−∞

−∞

=

=

41

Page 42: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Images vs Signals

1D

•  Signals

•  Frequency –  Temporal –  Spatial

•  Time (space) frequency characterization of signals

•  Reference space for –  Filtering –  Changing the sampling rate –  Signal analysis –  ….

2D

•  Images

•  Frequency –  Spatial

•  Space/frequency characterization of 2D signals

•  Reference space for –  Filtering –  Up/Down sampling –  Image analysis –  Feature extraction –  Compression –  ….

42

Page 43: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

43

Page 44: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

44

Page 45: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

2D Continuous FT

45

Page 46: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

2D Frequency domain

ωx

ωy

Large vertical frequencies correspond to horizontal lines

Large horizontal frequencies correspond to vertical lines

Small horizontal and vertical frequencies correspond smooth grayscale changes in both directions

Large horizontal and vertical frequencies correspond sharp grayscale changes in both directions

46

Page 47: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

2D spatial frequencies

•  2D spatial frequencies characterize the image spatial changes in the horizontal (x) and vertical (y) directions

–  Smooth variations -> low frequencies –  Sharp variations -> high frequencies

x

y

ωx=1 ωy=0 ωx=0

ωy=1

47

Page 48: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

2D Continuous Fourier Transform

•  2D Continuous Fourier Transform (notation 2)

( ) ( ) ( )

( ) ( ) ( )

2

2

ˆ , ,

ˆ, ,

j ux vy

j ux vy

f u v f x y e dxdy

f x y f u v e dudv

π

π

+∞− +

−∞

+∞+

−∞

=

= =

22 ˆ( , ) ( , )f x y dxdy f u v dudv∞ ∞ ∞ ∞

−∞ −∞ −∞ −∞

=∫ ∫ ∫ ∫ Plancherel’s equality

48

Page 49: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Delta

•  Sampling property of the 2D-delta function (Dirac’s delta)

•  Transform of the delta function

0 0 0 0( , ) ( , ) ( , )x x y y f x y dxdy f x yδ∞

−∞

− − =∫

{ } 2 ( )( , ) ( , ) 1j ux vyF x y x y e dxdyπδ δ∞ ∞

− +

−∞ −∞

= =∫ ∫

{ } 0 02 ( )2 ( )0 0 0 0( , ) ( , ) j ux vyj ux vyF x x y y x x y y e dxdy e ππδ δ

∞ ∞− +− +

−∞ −∞

− − = − − =∫ ∫ shifting property

49

Page 50: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Constant functions

•  Inverse transform of the impulse function

•  Fourier Transform of the constant (=1 for all x and y)

( ) 2 ( )

( , ) 1 ,

, ( , )j ux vy

k x y x y

F u v e dxdy u vπ δ∞ ∞

− +

−∞ −∞

= ∀

= =∫ ∫

{ }1 2 ( ) 2 (0 0)( , ) ( , ) 1j ux vy j x vF u v u v e dudv eπ πδ δ∞ ∞

− + +

−∞ −∞

= = =∫ ∫

50

Page 51: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Trigonometric functions

•  Cosine function oscillating along the x axis –  Constant along the y axis

{ } 2 ( )

2 ( ) 2 ( )2 ( )

( , ) cos(2 )

cos(2 ) cos(2 )

2

j ux vy

j fx j fxj ux vy

s x y fx

F fx fx e dxdy

e e e dxdy

π

π ππ

π

π π∞ ∞

− +

−∞ −∞

∞ ∞ −− +

−∞ −∞

=

= =

⎡ ⎤+= ⎢ ⎥

⎣ ⎦

∫ ∫

∫ ∫

[ ]

2 ( ) 2 ( ) 2

2 2 ( ) 2 ( ) 2 ( ) 2 ( )

12

1 112 2

1 ( ) ( )2

j u f x j u f x j vy

j vy j u f x j u f x j u f x j u f x

e e e dxdy

e dy e e dx e e dx

u f u f

π π π

π π π π π

δ δ

∞ ∞− − − + −

−∞ −∞

∞ ∞ ∞− − − − + − − − +

−∞ −∞ −∞

⎡ ⎤= + =⎣ ⎦

⎡ ⎤ ⎡ ⎤= + = + =⎣ ⎦ ⎣ ⎦

− + +

∫ ∫

∫ ∫ ∫

51

Page 52: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Vertical grating

ωx

ωy

0

52

Page 53: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Double grating

ωx

ωy

0

53

Page 54: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Smooth rings

ωx

ωy

54

Page 55: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Vertical grating

ωx

ωy

0 -2πf 2πf

55

Page 56: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

2D box 2D sinc

56

Page 57: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

CTFT properties

■  Linearity

■  Shifting

■  Modulation

■  Convolution

■  Multiplication

■  Separability

( , ) ( , ) ( , ) ( , )af x y bg x y aF u v bG u v+ ⇔ +

( , )* ( , ) ( , ) ( , )f x y g x y F u v G u v⇔

( , ) ( , ) ( , )* ( , )f x y g x y F u v G u v⇔

( , ) ( ) ( ) ( , ) ( ) ( )f x y f x f y F u v F u F v= ⇔ =

0 02 ( )0 0( , ) ( , )j ux vyf x x y x e F u vπ− +− − ⇔

0 02 ( )0 0( , ) ( , )j u x v ye f x y F u u v vπ + ⇔ − −

57

Page 58: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Separability

1.  Separability of the 2D Fourier transform –  2D Fourier Transforms can be implemented as a sequence of 1D Fourier

Transform operations performed independently along the two axis

( )

2 ( )

2 2 2 2

2

( , ) ( , )

( , ) ( , )

( , ) ,

j ux vy

j ux j vy j vy j ux

j vy

F u v f x y e dxdy

f x y e e dxdy e dy f x y e dx

F u y e dy F u v

π

π π π π

π

∞ ∞− +

−∞ −∞

∞ ∞ ∞ ∞− − − −

−∞ −∞ −∞ −∞

∞−

−∞

= =

= =

= =

∫ ∫

∫ ∫ ∫ ∫

2D FT 1D FT along the rows

1D FT along the cols

58

Page 59: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Separability

•  Separable functions can be written as

2.  The FT of a separable function is the product of the FTs of the two functions

( ) ( )

( ) ( )

2 ( )

2 2 2 2

( , ) ( , )

( ) ( )

j ux vy

j ux j vy j vy j ux

F u v f x y e dxdy

h x g y e e dxdy g y e dy h x e dx

H u G v

π

π π π π

∞ ∞− +

−∞ −∞

∞ ∞ ∞ ∞− − − −

−∞ −∞ −∞ −∞

= =

= =

=

∫ ∫

∫ ∫ ∫ ∫

( ) ( ) ( ) ( ) ( ) ( ), ,f x y h x g y F u v H u G v= ⇒ =

( ) ( ) ( ),f x y f x g y=

59

Page 60: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Discrete Time Fourier Transform (DTFT)

Applies to Discrete time (sampled) signals and time series

1D

60

Page 61: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

61

Fourier Transform: 2D Discrete Signals

■  Fourier Transform of a 2D discrete signal is defined as

where

2 ( )( , ) [ , ] j um vn

m nF u v f m n e π

∞ ∞− +

=−∞ =−∞

= ∑ ∑

1 1,2 2

u v−≤ <

1/ 2 1/ 22 ( )

1/ 2 1/ 2

[ , ] ( , ) j um vnf m n F u v e dudvπ +

− −

= ∫ ∫

■  Inverse Fourier Transform

Page 62: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Properties

•  Periodicity: 2D Fourier Transform of a discrete a-periodic signal is periodic –  The period is 1 for the unitary frequency notations and 2π for normalized

frequency notations. –  Proof (referring to the firsts case)

( )2 ( ) ( )( , ) [ , ] j u k m v l n

m nF u k v l f m n e π

∞ ∞− + + +

=−∞ =−∞

+ + = ∑ ∑

( )2 2 2[ , ] j um vn j km j ln

m nf m n e e eπ π π

∞ ∞− + − −

=−∞ =−∞

= ∑ ∑

2 ( )[ , ] j um vn

m nf m n e π

∞ ∞− +

=−∞ =−∞

= ∑ ∑

1 1

( , )F u v=

Arbitrary integers

62

Page 63: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

63

Fourier Transform: Properties

■  Periodicity: Fourier Transform of a discrete signal is periodic with period 1.

( )2 ( ) ( )( , ) [ , ] j u k m v l n

m nF u k v l f m n e π

∞ ∞− + + +

=−∞ =−∞

+ + = ∑ ∑

( )2 2 2[ , ] j um vn j km j ln

m nf m n e e eπ π π

∞ ∞− + − −

=−∞ =−∞

= ∑ ∑

2 ( )[ , ] j um vn

m nf m n e π

∞ ∞− +

=−∞ =−∞

= ∑ ∑

1 1

( , )F u v=

Arbitrary integers

Page 64: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

64

Fourier Transform: Properties

■  Linearity, shifting, modulation, convolution, multiplication, separability, energy conservation properties also exist for the 2D Fourier Transform of discrete signals.

Page 65: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

65

DTFT Properties

■  Linearity

■  Shifting

■  Modulation

■  Convolution

■  Multiplication

■  Separable functions

■  Energy conservation

[ , ] [ , ] ( , ) ( , )af m n bg m n aF u v bG u v+ ⇔ +

0 02 ( )0 0[ , ] ( , )j um vnf m m n n e F u vπ− +− − ⇔

[ , ] [ , ] ( , )* ( , )f m n g m n F u v G u v⇔

[ , ]* [ , ] ( , ) ( , )f m n g m n F u v G u v⇔

0 02 ( )0 0[ , ] ( , )j u m v ne f m n F u u v vπ + ⇔ − −

[ , ] [ ] [ ] ( , ) ( ) ( )f m n f m f n F u v F u F v= ⇔ =2 2[ , ] ( , )

m nf m n F u v dudv

∞ ∞∞ ∞

=−∞ =−∞ −∞ −∞

=∑ ∑ ∫ ∫

Page 66: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

66

Fourier Transform: Properties

■  Define Kronecker delta function

■  Fourier Transform of the Kronecker delta function

1, for 0 and 0[ , ]

0, otherwisem n

m nδ= =⎧ ⎫

= ⎨ ⎬⎩ ⎭

( ) ( )2 2 0 0( , ) [ , ] 1j um vn j u v

m nF u v m n e eπ πδ

∞ ∞− + − +

=−∞ =−∞

⎡ ⎤= = =⎣ ⎦∑ ∑

Page 67: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

67

DTFT Properties

■  Fourier Transform of 1

To prove: Take the inverse Fourier Transform of the Dirac delta function and use the fact that the Fourier Transform has to be periodic with period 1.

( )2( , ) 1 ( , ) 1 ( , )j um vn

m n k lf m n F u v e u k v lπ δ

∞ ∞ ∞ ∞− +

=−∞ =−∞ =−∞ =−∞

⎡ ⎤= ⇔ = = − −⎣ ⎦∑ ∑ ∑ ∑

Page 68: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

68

Impulse Train

■  Define a comb function (impulse train) as follows

, [ , ] [ , ]M Nk l

comb m n m kM n lNδ∞ ∞

=−∞ =−∞

= − −∑ ∑

where M and N are integers

2[ ]comb n

n

1

Page 69: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

69

Impulse Train

combM ,N [m,n] δ[m− kM ,n− lN ]l=−∞

∑k=−∞

[ ] 1, ,k l k l

k lm kM n lN u vMN M N

δ δ∞ ∞ ∞ ∞

=−∞ =−∞ =−∞ =−∞

⎛ ⎞− − ⇔ − −⎜ ⎟⎝ ⎠

∑ ∑ ∑ ∑

1 1,( , )

M N

comb u v, [ , ]M Ncomb m n

combM ,N (x, y) δ x − kM , y − lN( )l=−∞

∑k=−∞

•  Fourier Transform of an impulse train is also an impulse train:

Page 70: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

70

Impulse Train

2[ ]comb n

n u

1 12

12

1 ( )2comb u

12

Page 71: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

71

Impulse Train

( ) 1, ,k l k l

k lx kM y lN u vMN M N

δ δ∞ ∞ ∞ ∞

=−∞ =−∞ =−∞ =−∞

⎛ ⎞− − ⇔ − −⎜ ⎟⎝ ⎠

∑ ∑ ∑ ∑

1 1,( , )

M N

comb u v, ( , )M Ncomb x y

combM ,N (x, y) = δ x − kM , y − lN( )l=−∞

∑k=−∞

•  In the case of continuous signals:

Page 72: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

72

Impulse Train

2( )comb x

x u

1 12

12

1 ( )2comb u

12

2

Page 73: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

2D DTFT: constant

■  Fourier Transform of 1

To prove: Take the inverse Fourier Transform of the Dirac delta function and use the fact that the Fourier Transform has to be periodic with period 1.

( )2

[ , ] 1, ,

[ , ] 1

( , )

j uk vl

k l

k l

f k l k l

F u v e

u k v l

π

δ

∞ ∞− +

=−∞ =−∞

∞ ∞

=−∞ =−∞

= ∀

⎡ ⎤= =⎣ ⎦

= − −

∑ ∑

∑ ∑ periodic with period 1 along u and v

73

Page 74: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Consequences

Sampling (Nyquist) theorem

74

Page 75: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

75

Sampling

x

xM

( )f x

( )Mcomb x

u

( )F u

u

1( )* ( )M

F u comb u

u1M

1 ( )M

comb u

x

( ) ( )Mf x comb x

Page 76: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

76

Sampling

x

( )f x

u

( )F u

u

1( )* ( )M

F u comb u

x

( ) ( )Mf x comb x

WW−

M

W

1M1 2W

M>Nyquist theorem: No aliasing if

Page 77: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

77

Sampling

u

1( )* ( )M

F u comb u

x

( ) ( )Mf x comb x

M

W

1M

If there is no aliasing, the original signal can be recovered from its samples by low-pass filtering.

12M

Page 78: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

78

Sampling

x

( )f x

u

( )F u

u

1( )* ( )M

F u comb u

( ) ( )Mf x comb x

WW−

W

1MAliased

Page 79: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

79

Sampling

x

( )f x

u

( )F u

u[ ]( )* ( ) ( )Mf x h x comb x

WW−

1M

Anti-aliasing filter

uWW−

( )* ( )f x h x12M

Page 80: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

80

Sampling

u[ ]( )* ( ) ( )Mf x h x comb x

1M

u( ) ( )Mf x comb x

W

1M

■  Without anti-aliasing filter:

■  With anti-aliasing filter:

Page 81: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

81

Sampling in 2D (images)

x

y

u

v

uW

vW

x

y

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

M

N

, ( , )M Ncomb x y

u

v

1M

1N

1 1,( , )

M N

comb u v

Page 82: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

82

Sampling

u

v

uW

vW

,( , ) ( , )M Nf x y comb x y

1M

1N

1 2 uWM>No aliasing if and

1 2 vWN>

Page 83: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

83

Interpolation (low pass filtering)

u

v

1M

1N

1 1, for and v( , ) 2 2

0, otherwise

MN uH u v M N

⎧ ≤ ≤⎪= ⎨⎪⎩

12N

12M

Ideal reconstruction filter:

Page 84: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

84

Anti-Aliasing

a=imread(‘barbara.tif’);

Page 85: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

85

Anti-Aliasing

a=imread(‘barbara.tif’); b=imresize(a,0.25); c=imresize(b,4);

Page 86: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Bahadir K.

Gunturk

86

Anti-Aliasing

a=imread(‘barbara.tif’); b=imresize(a,0.25); c=imresize(b,4); H=zeros(512,512); H(256-64:256+64, 256-64:256+64)=1; Da=fft2(a); Da=fftshift(Da); Dd=Da.*H; Dd=fftshift(Dd); d=real(ifft2(Dd));

Page 87: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Discrete Fourier Transform (DFT)

Applies to finite length discrete time (sampled) signals and time series

The easiest way to get to it

Time is a discrete variable (t=n)

Frequency is a discrete variable (f=k)

87

Page 88: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

DFT

•  The DFT can be considered as a generalization of the CTFT to discrete series

•  It is the FT of a discrete (sampled) function of one variable

–  The 1/N factor is put either in the analysis formula or in the synthesis one, or the 1/sqrt(N) is put in front of both.

•  Calculating the DFT takes about N2 calculations

12 /

01

2 /

0

1[ ] [ ]

[ ] [ ]

Nj kn N

nN

j kn N

k

F k f n eN

f n F k e

π

π

−−

=−

=

=

=

88

Page 89: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

In practice..

•  In order to calculate the DFT we start with k=0, calculate F(0) as in the formula below, then we change to u=1 etc

•  F[0] is the average value of the function f[n] in k=0 –  This is also the case for the CTFT

•  The transformed function F[k] has the same number of terms as f[n] and always exists

•  The transform is always reversible by construction so that we can always recover f given F

1 12 0 /

0 0

1 1[0] [ ] [ ]N N

j n N

n nF f n e f n f

N Nπ

− −−

= =

= = =∑ ∑

89

Page 90: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Highlights on DFT properties

time

amplitude

0

Frequency (k)

|F[k]| F[0] low-pass

characteristic

90

The DFT of a real signal is symmetric The DFT of a real symmetric signal (even like the cosine) is real and symmetric The DFT is N-periodic Hence The DFT of a real symmetric signal only needs to be specified in [0, N/2]

0 N/2 N

Page 91: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Visualization of the basic repetition

•  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-N/2)|

|F(u)|

f n[ ]e2πu0n → f k −u0[ ]

u0 =N2

f n[ ]e2π N

2n= f n[ ]eπNn = −1( )n f n[ ]→ f k − N

2#

$%&

'(

Page 92: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

DFT

•  About N2 multiplications are needed to calculate the DFT

•  The transform F[k] has the same number of components of f[n], that is N

•  The DFT always exists for signals that do not go to infinity at any point

•  Using the Eulero’s formula

( ) ( )( )1 1

2 /

0 0

1 1[ ] [ ] [ ] cos 2 / sin 2 /N N

j kn N

n nF k f n e f n j kn N j j kn N

N Nπ π π

− −−

= =

= = −∑ ∑

frequency component k discrete trigonometric functions

92

Page 93: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

2D example

no translation after translation

Page 94: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Going back to the intuition

•  The FT decomposed the signal over its harmonic components and thus represents it as a sum of linearly independent complex exponential functions

•  Thus, it can be interpreted as a “mathematical prism”

94

Page 95: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

DFT

•  Each term of the DFT, namely each value of F[k], results of the contributions of all the samples in the signal (f[n] for n=1,..,N)

•  The samples of f[n] are multiplied by trigonometric functions of different frequencies

•  The domain over which F[k] lives is called frequency domain

•  Each term of the summation which gives F[k] is called frequency component of harmonic component

95

Page 96: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

DFT is a complex number

•  F[k] in general are complex numbers

[ ] [ ]{ } [ ]{ }[ ] [ ] [ ]{ }

[ ] [ ]{ } [ ]{ }

[ ][ ]{ }[ ]{ }

[ ] [ ]

2 2

1

2

Re Im

exp

Re Im

Imtan

Re

F k F k j F k

F k F k j F k

F k F k F k

F kF k

F k

P k F k

= +

=

⎧ ⎫= +⎪ ⎪⎪ ⎪⎨ ⎬⎧ ⎫

= −⎪ ⎪⎨ ⎬⎪ ⎪⎩ ⎭⎩ ⎭

=

R

R

magnitude or spectrum

phase or angle

power spectrum

96

Page 97: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Stretching vs shrinking

97

stretched shrinked

Page 98: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Periodization vs discretization

•  DT (discrete time) signals can be seen as sampled versions of CT (continuous time) signals

•  Both CT and DT signals can be of finite duration or periodic

•  There is a duality between periodicity and discretization –  Periodic signals have discrete frequency (sampled) transform –  Discrete time signals have periodic transform –  DT periodic signals have discrete (sampled) periodic transforms

t

ampl

itude

ampl

itude

n

fk=f(kTs)

Ts

98

Linking continuous and discrete domains

Page 99: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Increasing the resolution by Zero Padding

•  Consider the analysis formula

•  If f[n] consists of n samples than F[k] consists of N samples as well, it is discrete (k is an integer) and it is periodic (because the signal f[n] is discrete time, namely n is an integer)

•  The value of each F[k], for all k, is given by a weighted sum of the values of f[n], for n=1,..,N-1

•  Key point: if we artificially increase the length of the signal adding M zeros on the right, we get a signal f1[m] for which m=1,…,N+M-1. Since

99

F k[ ] = 1N

f n[ ]e−2π jknN

n=0

N−1

f1 m[ ] =f [m] for 0 ≤m < N

0 for N ≤m < N +M

"

#$

%$

Page 100: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Increasing the resolution through ZP

•  Then the value of each F[k] is obtained by a weighted sum of the “real” values of f[n] for 0≤k≤N-1, which are the only ones different from zero, but they happen at different “normalized frequencies” since the frequency axis has been rescaled. In consequence, F[k] is more “densely sampled” and thus features a higher resolution.

100

Page 101: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Increasing the resolution by Zero Padding

n

zero padding

0 N0

k 0 2π

F(Ω) (DTFT) in shade F[k]: “sampled version”

4π 2π/N0

101

Page 102: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Zero padding

n

zero padding

0 N0

k 0 2π

F(Ω)

4π 2π/N0

Increasing the number of zeros augments the “resolution” of the transform since the samples of the DFT get “closer”

102

Page 103: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Summary of dualities

FOURIER DOMAIN SIGNAL DOMAIN

Sampling Periodicity

Sampling Periodicity

DTFT

CTFS

Sampling+Periodicity Sampling +Periodicity DTFS/DFT

103

Page 104: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Discrete Cosine Transform (DCT)

Applies to digital (sampled) finite length signals AND uses only cosines.

The DCT coefficients are all real numbers

104

Page 105: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Discrete Cosine Transform (DCT)

•  Operate on finite discrete sequences (as DFT)

•  A discrete cosine transform (DCT) expresses a sequence of finitely many data points in terms of a sum of cosine functions oscillating at different frequencies

•  DCT is a Fourier-related transform similar to the DFT but using only real numbers

•  DCT is equivalent to DFT of roughly twice the length, operating on real data with even symmetry (since the Fourier transform of a real and even function is real and even), where in some variants the input and/or output data are shifted by half a sample

•  There are eight standard DCT variants, out of which four are common

•  Strong connection with the Karunen-Loeven transform –  VERY important for signal compression

105

Page 106: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

DCT

•  DCT implies different boundary conditions than the DFT or other related transforms

•  A DCT, like a cosine transform, implies an even periodic extension of the original function

•  Tricky part –  First, one has to specify whether the function is even or odd at both the left and

right boundaries of the domain –  Second, one has to specify around what point the function is even or odd

•  In particular, consider a sequence abcd of four equally spaced data points, and say that we specify an even left boundary. There are two sensible possibilities: either the data is even about the sample a, in which case the even extension is dcbabcd, or the data is even about the point halfway between a and the previous point, in which case the even extension is dcbaabcd (a is repeated).

106

Page 107: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

Symmetries

107

Page 108: IP-L5 -Fourier Transform...Fourier Transform • Different formulations for the different classes of signals – Summary table: Fourier transforms with various combinations of continuous

DCT

0

0

1

00 0

1

000 0

1cos 0,...., 12

2 1 1cos2 2

N

k nn

N

n kk

X x n k k NN

kx X X kN N

π

π

=

=

⎡ ⎤⎛ ⎞= + = −⎜ ⎟⎢ ⎥⎝ ⎠⎣ ⎦

⎧ ⎫⎡ ⎤⎛ ⎞= + +⎨ ⎬⎜ ⎟⎢ ⎥⎝ ⎠⎣ ⎦⎩ ⎭

•  Warning: the normalization factor in front of these transform definitions is merely a convention and differs between treatments.

–  Some authors multiply the transforms by (2/N0)1/2 so that the inverse does not require any additional multiplicative factor.

•  Combined with appropriate factors of √2 (see above), this can be used to make the transform matrix orthogonal.

108