<<

Fourier Transform

1 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.

2 Contents

• Signals as functions (1D, 2D) – Tools • Continuous Time (CTFT) • Discrete Time Fourier Transform (DTFT) • Discrete Fourier Transform (DFT) • Discrete Cosine Transform (DCT) • Sampling theorem

3 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 (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 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

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

a: real part, b: imaginary part

• Addition

• Multiplication

6

Mathematical Background: Complex Numbers (cont’d)

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

Magnitude:

Phase:

Phase – Magnitude notation:

7 Mathematical Background: Complex Numbers (cont’d)

• Multiplication using magnitude-phase representation

• Complex conjugate

• Properties

8 Mathematical Background: Complex Numbers (cont’d)

• Euler’s formula

• Properties

9 Mathematical Background: Sine and Cosine Functions

• Periodic functions • General form of sine and cosine functions:

10 Mathematical Background: Sine and Cosine Functions

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

π

π

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

• Shifting or translating the sine function by a const b

Note: cosine is a shifted sine function: π cos(tt )=+ sin( ) 2 12 Mathematical Background: Sine and Cosine Functions (cont’d)

• Changing the amplitude A

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

• Changing the period T=2π/|α| consider 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: sin(αt)=sin(2πt/T)=sin(2πft)

14 Fourier Series Theorem

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

is called the “fundamental frequency”

15 Fourier Series (cont’d)

α1

α2

α3

16 Concept

17 Continuous Time Fourier Transform (FT)

• Transforms a signal (i.e., function) from the spatial domain to the frequency domain. +∞ F (ω) = ∫ f (t)e− jωtdt −∞ Time domain +∞ f (t) = ∫ F (ω)e jωtdω −∞

Spatial domain

where

18 CTFT

• Change of variables for simplified notations: ω=2πu ∞ FuFufxedx(2π )== ( )∫ ( ) − jux2π = 1 ∞∞−∞ fx()==∫∫ Fue ()jux22ππ d( 2π u) Fue () jux du 2π −∞ −∞ • More compact notations (same as in GW)

∞ Fu()= ∫ f () xe− jux2π dx −∞ ∞ fx( ) = ∫ Fue()jux2π du −∞

19 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

20 Continuous Time Fourier Transform (CTFT)

Time is a real variable (t) Frequency is a real variable (ω) Signals : 1D

21 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]

22 Continuous Time Fourier Transform (CTFT)

T=1

23 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 eiα + e−iα cosα = jα 2 rre=+( cosαα j sin ) i i e α − e− α sinα = 2i

24 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

jt Fourier integral F(ω) = ∫ f() t e− ω dt analysis t 1 jtω ft()= ∫ F (ωω ) e d synthesis 2π ω 25 CTFT of real signals

• Real signals: each signal sample is a real number • Property: the CTFT is Hermttian-symmetric -> the spectrum is symmetric fˆ(−ω) = fˆ∗ (ω)

ω f (t) → fˆ (ω) f (−t) → fˆ (−ω) = fˆ ∗ (ω) Pr oof +∞ +∞ ℑ{ f (−t)} = ∫ f (−t)e− jωt dt = ∫ f (t ')e jωt ' dt ' =fˆ ∗ (−ω) −∞ −∞ 26 Sinusoids

+∞ − jtω • Frequency domain characterization of signals Fftedt()ω = ∫ () −∞

Signal domain

Frequency domain (spectrum, absolute value of the transform)

27 Gaussian

Time domain

Frequency domain

28 rect

Time domain

Frequency domain

29 Example

30 Properties

31 Discrete Time FT (DTFT)

• If f[n] is a function of the discrete variable n then the DTFT is given by

+∞ ˆ − jωn f2π (ω) = ∑ f [n]e n=−∞ 1 +∞ f [n] = ∫ fˆ(ω)e jωn dω 2π −∞

32 DTFT

+∞ ˆ − jωnT f1/T (ω) = ∑ T ⋅ f [nT ]e = n=−∞ +∞ % 2kπ ( + +∞ . = ∑ fˆ'ω − * = F , ∑ f [nT ]⋅δ (t − nT)/ k=−∞ & T ) -n=−∞ 0

+∞ 1 ˆ jωn f [nT ] = ∫ f1/T (ω)e dω T −∞

33 CT versus DT FT

Relationship between the (continuous) Fourier transform and the discrete Fourier transform. Left column: A continuous function (top) and its Fourier transform (bottom). Center-left column: of the original function (top). Fourier transform (bottom) is zero except at discrete points. The inverse transform is a sum of sinusoids called Fourier series. Center-right column: Original function is discretized (multiplied by a ) (top). Its Fourier transform (bottom) is a periodic summation (DTFT) of the original transform. Right column: The DFT (bottom) computes discrete samples of the continuous DTFT. The inverse DFT (top) is a periodic summation of the original samples. The FFT algorithm computes one cycle of the DFT and its inverse is one cycle of the DFT inverse.

34 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)

35 DFT

• The DFT can be considered as a generalization of the CTFT to discrete series of a finite number of samples • It is the FT of a discrete (sampled) function of one variable 1 N −1 Fk[]= ∑ f [] ne− jknN2/π N n=0 N −1 fn[]= ∑ Fke []jknN2/π k =0

– 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

36 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 11NN−−11 Ffnefnf[0]===∑∑ [ ]− jnN20/π [ ] NNnn==00

• F[0] is the mean value of the function f[n] – 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

37 Highlights on DFT properties The DFT of a real signal is symmetric (Hermitian symmetry) amplitude 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 time

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

0 N/2 N Frequency (k)

38 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)

2πu0n f [n]e → f [k − u0 ] N u = 0 2 N |F(u)| 2π n n # N & f [n]e 2 = f [n]eπ Nn = (−1) f [n] → f k − $% 2 '(

|F(u-N/2)|

39 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

11NN−−11 Fk[ ]==∑∑ f [ ne ]− jknN2/π f [ n ]( cos( j 2ππ knN /) − j sin( j 2 knN / )) NNnn==00

frequency component k discrete trigonometric functions

40 2D example

no translation after translation

41 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”

42 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

43 DFT is a complex number

• F[k] in general are complex numbers

Fk[ ] =+Re{ Fk[ ]} j Im{ Fk[ ]} Fk[ ] = Fk[ ] exp{ jR Fk[ ]}

22 ⎧⎫Fk[ ] =+Re{ Fk[ ]} Im{ Fk[ ]} ⎪⎪magnitude or spectrum ⎨⎬ −1 ⎧⎫Im{Fk[ ]} ⎪⎪R Fk=tan − [ ] ⎨⎬phase or angle ⎩⎭⎪⎪⎩⎭Re{Fk[ ]} 2 power spectrum Pk[ ] = Fk[ ]

44 Stretching vs shrinking

stretched shrinked

45 Periodization vs discretization Linking continuous and discrete domains

fk=f(kTs) amplitude amplitude

Ts

t n

• 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 46 Increasing the resolution by Zero Padding

• Consider the analysis formula

N−1 2π jkn 1 − F [k] = ∑ f [n]e N N n=0 • 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 " $ f [m] for 0 ≤ m < N f1 [m] = # $ 0 for N ≤ m < N + M %

47 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.

48 Increasing the resolution by Zero Padding

0 n N0 zero padding F(Ω) (DTFT) in shade F[k]: “sampled version”

0 2π 4π k 2π/N0

49 Increasing the number of zeros Zero padding augments the “resolution” of the transform since the samples zero padding of the DFT get “closer”

0 n

N0 F(Ω)

0 2π 4π k 2π/N0

50 Summary of dualities

SIGNAL DOMAIN FOURIER DOMAIN

Sampling DTFT Periodicity

Periodicity CTFS Sampling

Sampling+Periodicity DTFS/DFT Sampling +Periodicity

51 Discrete Cosine Transform (DCT)

Applies to digital (sampled) finite length signals AND uses only cosines. The DCT coefficients are all real numbers

52 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

53 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).

54 Symmetries

55 DCT

N0 −1 ⎡⎤π 1 Xxcos⎛⎞ nkkN 0,...., 1 kn=+=∑ ⎢⎥⎜⎟ 0 − n=0 ⎣⎦N0 ⎝⎠2 21⎧⎫N0 −1 ⎡⎤π k 1 xXXkcos ⎛⎞ nk=+⎨⎬0 ∑ ⎢⎥⎜⎟ + NN00⎩⎭22k =0 ⎣⎦⎝⎠

• Warning: the normalization factor in front of these transform definitions is merely a convention and differs between treatments. 1/2 – Some authors multiply the transforms by (2/N0) 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.

56 Summary of dualities

SIGNAL DOMAIN FOURIER DOMAIN

Sampling DTFT Periodicity

Periodicity CTFS Sampling

Sampling+Periodicity DTFS/DFT Sampling +Periodicity

57 Sampling

From continuous to discrete time

58 Impulse Train

■ Define a comb function (impulse train) as follows

∞ comb [n] [n lN] N = ∑δ − l=−∞

where M and N are integers

comb2[] n 1

n 59 Impulse Train

1 comb2[] n comb1 () u 2 2

1 1 2

n u

1 2

60 Impulse Train

1 comb2 () x comb1 () u 2 2

1 1 2

x u

2 1 2

61 Consequences

Sampling (Nyquist) theorem

62 Sampling fx() Fu()

x u

combM () x comb1 () u M x u

1 M M

Fu()* comb1 () u fxcombx()M () M

x u 63 Sampling fx() Fu()

x u −W W

Fu()* comb1 () u fxcombx()M () M

u x W

M 1 M 1 Nyquist theorem: No aliasing if > 2W M

64 Sampling

Fu()* comb1 () u fxcombx()M () M

u x W

M 1 M 1 2M

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

65 Sampling fx() Fu()

x u −W W

Fu()* comb1 () u M fxcombx()M () u W

1 Aliased M

66 Sampling fx() Fu() Anti-aliasing filter x u −W W

1 2M fx()*() hx u −W W

[ fx()*() hxcombx] M () u

1 M 67 Sampling ■ Without anti-aliasing filter:

fxcombx()M () u W

■ With anti-aliasing filter: 1 M

[ fx()*() hxcombx] M () u

1 M

68 Images vs Signals

1D 2D • Signals • Images • Frequency • Frequency – Temporal – Spatial – Spatial • Space/frequency characterization of • Time (space) frequency 2D signals characterization of signals • Reference space for • Reference space for – Filtering – Filtering – Changing the sampling rate – Up/Down sampling – Signal analysis – Image analysis – …. – Feature extraction – Compression – ….

69 2D Continuous FT

70 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

71 2D Frequency domain Large horizontal and vertical frequencies ω y correspond sharp Large vertical grayscale changes in frequencies correspond both directions to horizontal lines

ωx Small horizontal and vertical frequencies Large horizontal correspond smooth frequencies correspond grayscale changes in to vertical lines both directions

72 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

y

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

x 73 2D Continuous Fourier Transform

• 2D Continuous Fourier Transform (notation 2)

+∞ fˆ ( u,, v) = ∫ f( x y) e−j2π ( ux+ vy) dxdy −∞ +∞ f( x,, y) ==∫ fˆ ( u v) ej2π ( ux+ vy) dudv −∞

∞∞ ∞∞ 2 ˆ 2 ∫∫fxy(, ) dxdy= ∫∫ fuv (,) dudv Plancherel’s equality −∞ −∞ −∞ −∞

74 Delta

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

∞ δ (,xxyyfxydxdyfxy−− )(,)(,) = ∫ 00 00 −∞

• Transform of the delta function

∞∞ Fxy{δδ(, )} ==∫∫ (, xye )−juxvy2(π + ) dxdy 1 −∞ −∞

∞∞ juxvy2( ) juxvy2( ) shifting Fxxyyδδ(,−− )= (, xxyye−− )−π + dxdye =−π 00+ { 00} ∫∫ 00 property −∞ −∞

75 Constant functions

• Inverse transform of the impulse function

∞∞ Fuv−12()2(00){δδ(,)} ===∫∫ (,) uvedudvejuxvyππ++ j xv 1 −∞ −∞

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

kxy(, )= 1∀ xy , ∞∞ Fuv( ,(,)) ==∫∫ e−juxvy2(π + ) dxdyδ uv −∞ −∞

76 Trigonometric functions

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

s( x , y )= cos(2π fx ) ∞∞ F{cos(2ππ fx )} ==∫∫ cos(2 fx ) e−j2(π ux+ vy ) dxdy −∞ −∞ ∞∞ j2(ππ fx )− j 2( fx ) ⎡⎤ee+ −j2(π ux+ vy ) = ∫∫⎢⎥e dxdy −∞ −∞ ⎣⎦2 ∞∞ 1 −−jufx2(πππ ) − jufx 2(+ )− jvy 2 =+∫∫⎣⎦⎡⎤eeedxdy = 2 −∞ −∞ ∞∞ ∞ 11−−−−jvy22()2()2()2()ππ j ufx j π ufx+−−− j π ufx j π ufx+ =+=+=∫∫edye⎣⎦⎣⎦⎡⎤⎡⎤ e dxe1 ∫ e dx 22−∞ −∞ −∞ 1 [δδ()()uf−+ uf +] 2 77 Vertical grating

ωy

0 ωx

78 Double grating

ωy

0 ωx

79 Smooth rings

ωy

ωx

80 Vertical grating

ωy

0 ω -2πf 2πf x

81 2D box 2D sinc

82 CTFT properties

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

−j2(π ux00+ vy ) ■ Shifting fx(,−−⇔ x00 y x ) e Fuv (,)

juxvy2(π 00+ ) ■ Modulation efxyFuuvv(, )⇔−− (00 , ) ■ fxy(, )*(, gxy )⇔ FuvGuv (,) (,)

■ Multiplication fxygxy(, )(, )⇔ Fuv (,)*(,) Guv

■ Separability fxy(, )= fxfy () ()⇔ Fuv (,)= FuFv () ()

83 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

∞∞ Fuv(,)==∫∫ f (, xye )−juxvy2(π + ) dxdy −∞ −∞ ∞∞ ∞ ∞ ∫∫fxye(, )−−juxjvy22ππ e dxdy== ∫ e − jvy 2 π dyfxye ∫ (, ) − jux 2 π dx −∞ −∞ −∞ −∞ ∞ ==∫ Fuye(, )− jvy2π dy F( uv ,) −∞

1D FT along 1D FT along 2D FT the rows the cols

84 Separability

• Separable functions can be written as fxy( , ) = fxgy( ) ( ) 2. The FT of a separable function is the product of the FTs of the two functions

∞∞ Fuv(,)==∫∫ f (, xye )−juxvy2(π + ) dxdy −∞ −∞ ∞∞ ∞ ∞ ∫∫hxg()( ye) −−juxjvy22ππ e dxdy== ∫ g( ye) − jvy 2 π dy ∫ hxe () − jux 2 π dx −∞ −∞ −∞ −∞ = HuGv( ) ( )

fxy( ,,) = hxgy( ) ( ) ⇒ Fuv( ) = HuGv( ) ( )

85 Discrete Time Fourier Transform (DTFT)

Applies to Discrete domain signals and time series - 2D

86 Fourier Transform: 2D Discrete Signals

■ Fourier Transform of a 2D discrete signal is defined as ∞∞ Fuv(,)= ∑∑ fmne [ ,]−jumvn2(π + ) mn=−∞ =−∞ −11 where ≤uv, < 22

■ Inverse Fourier Transform 1/2 1/2 f[,] m n= ∫∫ F (,) u v ej2(π um+ vn ) dudv −−1/2 1/2

87 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)

∞∞ −jukmvln2(π ( +++ ) ( )) Fu(,)++= kv l∑∑ fmne [,] 1 1 mn=−∞ =−∞ ∞∞ = ∑∑fmne[,]−jumvn2π ( +) e−−j22ππ km e j ln Arbitrary mn=−∞ =−∞

integers ∞∞ = ∑∑fmne[,]−jumvn2(π + ) mn=−∞ =−∞ = Fuv(,)

88 Fourier Transform: Properties

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

89 DTFT Properties

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

−j2(π um00+ vn ) ■ Shifting fm[,]−−⇔ m00 n n e Fuv (,)

jumvn2(π 00+ ) ■ Modulation efmnFuuvv[,]⇔−− (00 , )

■ Convolution fmn[,]*[,] gmn⇔ FuvGuv (,)(,)

■ Multiplication fmngmn[,][,]⇔ Fuv (,)*(,) Guv

■ Separable functions fmn[,]= fmfn [][]⇔ Fuv (,)= FuFv ()() ∞∞ ∞∞ 22 ■ Energy conservation ∑∑fmn[,]= ∫∫ Fuv (,) dudv mn=−∞ =−∞ −∞ −∞ 90 Fourier Transform: Properties

■ Define Kronecker delta function ⎧⎫1, for mn== 0 and 0 δ[,]mn = ⎨⎬ ⎩⎭0, otherwise

■ Fourier Transform of the Kronecker delta function

∞∞ Fuv(,)⎡⎤ [ mne ,]−jumvn2200ππ( +) e− juv( +) 1 ===∑∑⎣⎦δ mn=−∞ =−∞

91 Impulse Train

■ Define a comb function (impulse train) as follows

∞∞ comb[,] m n [ m kM , n lN ] MN, =∑∑δ −− kl=−∞ =−∞

where M and N are integers

comb2[] n 1

n 92 Impulse Train ∞ ∞ comb [m,n] [m kM ,n lN] M ,N  ∑ ∑δ − − k=−∞ l=−∞ ∞ ∞ comb (x, y) x kM , y lN M ,N  ∑ ∑δ ( − − ) k=−∞ l=−∞

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

∞∞1 ∞∞ ⎛⎞kl ∑∑δδ[m−−⇔ kM,, n lN] ∑∑ ⎜⎟ u −− v kl=−∞ =−∞MN kl =−∞ =−∞ ⎝⎠ M N

comb[,] m n comb11(,) u v MN, , MN

93 Impulse Train

1 comb2[] n comb1 () u 2 2

1 1 2

n u

1 2

94 Impulse Train

∞ ∞ comb (x, y) x kM , y lN M ,N = ∑ ∑δ ( − − ) k=−∞ l=−∞

• In the case of continuous signals:

∞∞1 ∞∞ ⎛⎞kl ∑∑δδ(x−−⇔ kM,, y lN) ∑∑ ⎜⎟ u −− v kl=−∞ =−∞MN kl =−∞ =−∞ ⎝⎠ M N

comb(, x y ) comb11(,) u v MN, , MN

95 Impulse Train

1 comb2 () x comb1 () u 2 2

1 1 2

x u

2 1 2

96 2D DTFT: constant

■ Fourier Transform of 1 f [k,l] =1,∀k,l ∞ ∞ − j2π uk+vl F[u,v] = $1× e ( ) ' = ∑ ∑%& () k=−∞ l=−∞ ∞ ∞ periodic with period 1 = ∑ ∑δ(u − k,v − l) along u and v k=−∞ l=−∞

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

97 Sampling theorem revisited

98 Sampling fx() Fu()

x u

combM () x comb1 () u M x u

1 M M

Fu()* comb1 () u fxcombx()M () M

x u 99 Sampling fx() Fu()

x u −W W

Fu()* comb1 () u fxcombx()M () M

u x W

M 1 M 1 Nyquist theorem: No aliasing if > 2W M

100 Sampling

Fu()* comb1 () u fxcombx()M () M

u x W

M 1 M 1 2M

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

101 Sampling fx() Fu()

x u −W W

Fu()* comb1 () u M fxcombx()M () u W

1 Aliased M

102 Sampling fx() Fu() Anti-aliasing filter x u −W W

1 2M fx()*() hx u −W W

[ fx()*() hxcombx] M () u

1 M 103 Sampling ■ Without anti-aliasing filter:

fxcombx()M () u W

■ With anti-aliasing filter: 1 M

[ fx()*() hxcombx] M () u

1 M

104 Sampling in 2D (images) y v fxy(, ) Fuv(,) Wv x u Wu

comb11(,) u v , y v MN combMN, (, x y )

x u 1 N N

M 1 M

105 Sampling v

Wv f(, x y ) combMN, (, x y ) u 1 N

1 Wu M

1 1 No aliasing if > 2 W and > 2W M u N v

106 Interpolation (low pass filtering) v

1 2N

u 1 N

1 2M 1 M Ideal reconstruction filter: ⎧ 11 ⎪MN, for u ≤≤ and v Huv(,)= ⎨ 22MN ⎩⎪ 0, otherwise

107 Anti-Aliasing

a=imread(‘barbara.tif’);

108 Anti-Aliasing

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

109 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));

110