Top Banner
Lecture 13 Lecture 13 The frequency Domain The frequency Domain (1) (1) Dr. Masri Ayob Dr. Masri Ayob
40
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

Lecture 13Lecture 13The frequency The frequency

Domain (1)Domain (1)

Dr. Masri AyobDr. Masri Ayob

Page 2: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

2

The Twilight ZoneThe Twilight Zone

Image data can be represented in either the spatial domain or the frequency domain. The frequency domain contains the same information as the spatial domain but in a vastly different form.

Useful for data compressionMore efficient for certain image operations

Spatial Domain

For each location in the image, what is the value of the light intensity at that location?

Spatial Domain

For each location in the image, what is the value of the light intensity at that location?

Frequency Domain

For each frequency component in the image, what is power or its amplitude?

Frequency Domain

For each frequency component in the image, what is power or its amplitude?

Various frequency domain representations exist but the two predominant representations are the Fourier and Discrete Cosine representations.Frequency domain - an alternative representation of an image based on the frequencies of brightness or colour variation in the image.

Page 3: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

3

Fourier TransformFourier Transform

Spatial Domain vs Frequency Domain

ft

Page 4: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

4

Fourier TransformFourier Transform

Why?• alternative description• efficient calculation• less sensitive for disturbances• Obey the convolution thorem

More efficient, easier:• convolution• correlation• filtering• differentiating• shifting• compression

Page 5: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

5

Fourier TransformFourier Transform

Applications wide ranging and ever present in modern lifeApplications wide ranging and ever present in modern life

• TelecommsTelecomms - GSM/cellular phones,

• Electronics/ITElectronics/IT - most DSP-based applications,

• EntertainmentEntertainment - music, audio, multimedia,

• Accelerator controlAccelerator control (tune measurement for beam steering/control),

• Imaging, image processing,Imaging, image processing,

• Industry/researchIndustry/research - X-ray spectrometry, chemical analysis (FT spectrometry), PDE solution, radar design,

• MedicalMedical - (PET scanner, CAT scans & MRI interpretation for sleep disorder & heart malfunction diagnosis,

• Speech analysisSpeech analysis (voice activated “devices”, biometry, …).

Page 6: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

6

Fourier AnalysisFourier Analysis

Many different transforms are used in image processing (far too many begin with the letter H: Hilbert, Hartley, Hough, Hotelling, Hadamard, and Haar). The Fourier representation of any function is possible by determining

The fundamental frequencyThe coefficient of each harmonic

Fourier coefficients are typically Complex-valuedFundamental frequency is determined by the resolution of a discrete image

Page 7: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

7

Spatial FrequencySpatial Frequency

L = length of the cycle (period of the function).If the variation is spatial and L is a distance, then 1/L is termed the spatial frequency of the variation.

Page 8: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

8

Spatial FrequencySpatial Frequency

Page 9: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

9

Spatial FrequencySpatial Frequency

N=100, u=3, A=127

N=100, u=6, A=127

N=100, u=3, A=50

N=100, u=3, A=127, phase = 90

Variation in thex – direction (u)

Sin

Cosine

Page 10: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

10

Fourier TheoryFourier Theory

Techniques for the analysis and manipulation of spatial frequency.Developed a representation of functions based on frequency.The idea is “any periodic function can be represented as a sum of these simpler sinusoids”.

Page 11: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

11

Fourier AnalysisFourier Analysis

Any function can be represented as the sum of sine and cosine waves having different amplitudes and wavelengths.Fourier analysis is a way of determining the individual sin/cosine waves that, when added together, construct the desired signalConsider a square wave. Can it be represented as the sum of sin and cosine waves?

2 4 6 8 10

-0.4

-0.2

0.2

0.4

2 4 6 8 10

-0.4

-0.2

0.2

0.4

Page 12: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

12

Fourier TheoryFourier Theory

A set of sine and cosine functions having particular frequencies are choose for the representation. basic function

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

Page 13: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

13

Fourier AnalysisFourier Analysis

Page 14: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

14

Fourier TheoryFourier Theory

A weighted sum of these basic function is called a Fourier Series.

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

Add a 3rd “harmonic” to the fundamental frequency. The amplitude is less than that of the base and the frequency is 3 times that of the base.

Page 15: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

15

Fourier TheoryFourier Theory

The weighting factors for each sine and cosine function are known as the Fourier coefficients.

The summation of basic function

No. of terms

Page 16: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

16

Fourier TheoryFourier Theory

Page 17: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

17

Fourier TheoryFourier Theory

Add a 3rd “harmonic” to the fundamental frequency. The amplitude is less than that of the base and the frequency is 3 times that of the base.

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

Page 18: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

18

Fourier TheoryFourier Theory

Add a 5th “harmonic” to the fundamental frequency. The amplitude is less than that of the base and the frequency is 5 times that of the base.

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

2 4 6 8 10

-1

-0.75

-0.5

-0.25

0.25

0.5

0.75

1

Page 19: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

19

Fourier TheoryFourier Theory

Add a 7th and 9th“harmonic” to the fundamental frequency.

2 4 6 8 10

-1

-0.5

0.5

1

2 4 6 8 10

-1

-0.5

0.5

1

Page 20: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

20

Fourier TheoryFourier Theory

Adding all harmonics up to the 100th.

2 4 6 8 10

-0.75

-0.5

-0.25

0.25

0.5

0.75

2 4 6 8 10

-0.75

-0.5

-0.25

0.25

0.5

0.75

Page 21: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

21

Fourier TheoryFourier Theory

Adding all harmonics up to the 200th.

2 4 6 8 10

-0.75

-0.5

-0.25

0.25

0.5

0.75

2 4 6 8 10

-0.75

-0.5

-0.25

0.25

0.5

0.75

Page 22: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

22

Fourier TheoryFourier Theory

L: period; u and v are the number of cycles fitting into one horizontal and vertical period, respectively of f(x,y).

Page 23: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

23

Fourier TheoryFourier Theory

Page 24: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

24

Discrete Fourier TransformDiscrete Fourier Transform

Fourier theory provides us with a means of determining the contribution made by any basic function to the representation of some function f(x).The contribution is determined by projecting f(x) onto that basis function.This procedure is described as a Fourier transform.

Page 25: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

25

Discrete Fourier TransformDiscrete Fourier Transform

When applying the procedure to images, we must deal explicitly with the fact that an image is:

Two-dimensionalSampledOf finite extent

These consideration give rise to the Discrete Fourier Transform (DFT).The DFT of an NxN image can be written:

1

0

/)(21

0

),(1

),(N

x

NvyuxjN

y

eyxfN

vuF or

1

0

1

0

)(2sin

)(2cos),(

1),(

N

x

N

y N

vyuxj

N

vyuxyxf

NvuF

(8.5)

Processing the image in frequency domainComplex number

Page 26: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

26

Discrete Fourier TransformDiscrete Fourier Transform

For any particular spatial frequency specified by u and v, evaluating equation 8.5 tell us how much of that particular frequency is present in the image. There also exist an inverse Fourier Transform that convert a set of Fourier coefficients into an image.

1

0

/)(21

0

),(1

),(N

x

NvyuxjN

y

evuFN

yxf

Processing the image in spatial domain

Page 27: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

27

Discrete Fourier TransformDiscrete Fourier Transform

F(u,v) is a complex number:

Page 28: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

28

Discrete Fourier TransformDiscrete Fourier Transform

The magnitudes correspond to the amplitudes of the basic images in our Fourier representation.The array of magnitudes is termed the amplitude spectrum (or sometime ‘spectrum’).The array of phases is termed the phase spectrum.The power spectrum is simply the square of its amplitude spectrum:

),(),(),(),( 222vuIvuRvuFvuP

Page 29: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

29

Discrete Fourier TransformDiscrete Fourier Transform

Page 30: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

30

Discrete Fourier TransformDiscrete Fourier Transform

If we attempt to reconstruct the image with an inverse Fourier Transform after destroying either the phase information or the amplitude information, then the reconstruction will fail.

Page 31: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

31

FFTFFT

The Fast Fourier Transform is one of the most important algorithms ever developed

Developed by Cooley and Tukey in mid 60s.Is a recursive procedure that uses some cool math tricks to combine sub-problem results into the overall solution.

Page 32: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

32

DFT vs FFTDFT vs FFT

Page 33: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

33

DFT vs FFTDFT vs FFT

Page 34: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

34

DFT vs FFTDFT vs FFT

Page 35: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

35

PeriodicityPeriodicity

The DFT assumes that an image is part of an infinitely repeated set of “tiles” in every direction. This is the same effect as “circular indexing”.

Page 36: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

36

Periodicity and WindowingPeriodicity and Windowing

Since “tiling” an image causes “fake” discontinuities, the spectrum includes “fake” high-frequency components

Spatial discontinuities

Windowing minimizes the artificial discontinuities by pre-processing pixel values prior to computing the DFT.

Pixel values are modulated so that they gradually fall to zero at the edges.

Three well-known windowing functions:•Bartlett•Hanning•Blackman

Page 37: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

37

Windowing FunctionsWindowing Functions

max

maxmax

0

)/(1)(

rr

rrrrrw

20

10

0

10

20x

20

10

0

1020

Y

0

0.25

0.5

0.75

1

Wx,y

20

10

0

10

20x

20

10

0

1020

Y

Bartlett

20

10

0

10

20x

2010

010

20

Y

0

0.25

0.5

0.75

1

Wx,y

20

10

0

10

20x

2010

010

20

Y

max1cos5.05.0)(r

rrw

Hanning

20

10

0

10

20x

20

100

1020

Y

0

0.25

0.5

0.75

1

Wx,y

20

10

0

10

20x

20

100

1020

Y

maxmax12cos08.01cos5.042.0)(r

r

r

rrw

Blackman

R is a distance from the centre of the image and rmax is its maximum value.

Page 38: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

38

FFT PackageFFT Package com.pearsoneduc.ip.opcom.pearsoneduc.ip.op

Page 39: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

39

FFT Package FFT Package com.pearsoneduc.ip.opcom.pearsoneduc.ip.op

Page 40: Lecture 13 The frequency Domain (1) Dr. Masri Ayob.

Thank youThank you

Q&AQ&A