<<

Fourier Transform

1 The idea A signal can be interpreted as en electromagnetic . This consists of lights of different “color”, or , 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 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 x is of the form:

a: real part, b: imaginary part

• Addition

• Multiplication

6

Mathematical Background: Complex Numbers (cont’d)

• Magnitude- (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: 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 periodic function 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 . +∞ 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 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 – ….

20 Example: Removing undesirable

noisy signal frequencies

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

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

22 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

23 Continuous Time Fourier Transform (CTFT)

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

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

25 Continuous Time Fourier Transform (CTFT)

T=1

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

27 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π ω 28 CTFT of real signals

• Real signals: each signal sample is a • 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ˆ ∗ (−ω) −∞ −∞ 29 Sinusoids

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

Signal domain

Frequency domain (spectrum, absolute value of the transform)

30 Gaussian

Time domain

Frequency domain

31 rect

Time domain

Frequency domain

sinc function

32 Example

33 Properties

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 • 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 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 ) 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 (as DFT) • A discrete cosine transform (DCT) expresses a 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 Sampling

From continuous to discrete time

57 Impulse Train

■ Define a comb function (impulse train) as follows

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

where M and N are

comb2[] n 1

n 58 Impulse Train

1 comb2[] n comb1 () u 2 2

1 1 2

n u

1 2

59 Impulse Train

1 comb2 () x comb1 () u 2 2

1 1 2

x u

2 1 2

60 Consequences

Sampling (Nyquist) theorem

61 Sampling fx() Fu()

x u

combM () x comb1 () u M x u

1 M M

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

x u 62 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

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

64 Sampling fx() Fu()

x u −W W

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

1 Aliased M

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

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

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

1 M 66 Sampling ■ Without anti-aliasing filter:

fxcombx()M () u W

■ With anti-aliasing filter: 1 M

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

1 M

67 2D Continuous FT

68 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

69 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

70 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 71 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 −∞ −∞ −∞ −∞

72 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 −∞ −∞

73 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 −∞ −∞

74 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 75 Vertical grating

ωy

0 ωx

76 Double grating

ωy

0 ωx

77 Smooth rings

ωy

ωx

78 Vertical grating

ωy

0 ω -2πf 2πf x

79 2D box 2D sinc

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

81 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

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

83 Discrete Time Fourier Transform (DTFT)

Applies to Discrete domain signals and time series - 2D

84 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

85 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(,)

86 Fourier Transform: Properties

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

87 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=−∞ =−∞ −∞ −∞ 88 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=−∞ =−∞

89 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 90 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

91 Impulse Train

1 comb2[] n comb1 () u 2 2

1 1 2

n u

1 2

92 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

93 Impulse Train

1 comb2 () x comb1 () u 2 2

1 1 2

x u

2 1 2

94 2D DTFT: constant

■ Fourier Transform of 1 fkl[,]= 1,∀ kl , ∞∞ Fuv[,]⎡⎤ 1 e−jukvl2π ( +) ==∑∑⎣⎦ kl=−∞= −∞ ∞∞ (,)ukvl periodic with period 1 =∑∑δ −−along u and v kl=−∞= −∞

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

95 Consequences

Sampling (Nyquist) theorem

96 Sampling fx() Fu()

x u

combM () x comb1 () u M x u

1 M M

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

x u 97 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

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

99 Sampling fx() Fu()

x u −W W

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

1 Aliased M

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

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

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

1 M 101 Sampling ■ Without anti-aliasing filter:

fxcombx()M () u W

■ With anti-aliasing filter: 1 M

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

1 M

102 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

103 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

104 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

105 Anti-Aliasing

a=imread(‘barbara.tif’);

106 Anti-Aliasing

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

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

108