Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 7: CPU and Memory (3)
Lecture 13 The frequency Domain (1) Dr. Masri Ayob.
-
date post
20-Dec-2015 -
Category
Documents
-
view
252 -
download
0
Transcript of Lecture 13 The frequency Domain (1) Dr. Masri Ayob.
Lecture 13Lecture 13The frequency The frequency
Domain (1)Domain (1)
Dr. Masri AyobDr. 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.
3
Fourier TransformFourier Transform
Spatial Domain vs Frequency Domain
ft
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
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, …).
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
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.
8
Spatial FrequencySpatial Frequency
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
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”.
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
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
13
Fourier AnalysisFourier Analysis
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.
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
16
Fourier TheoryFourier Theory
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
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
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
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
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
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).
23
Fourier TheoryFourier Theory
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.
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
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
27
Discrete Fourier TransformDiscrete Fourier Transform
F(u,v) is a complex number:
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
29
Discrete Fourier TransformDiscrete Fourier Transform
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.
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.
32
DFT vs FFTDFT vs FFT
33
DFT vs FFTDFT vs FFT
34
DFT vs FFTDFT vs FFT
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”.
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
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.
38
FFT PackageFFT Package com.pearsoneduc.ip.opcom.pearsoneduc.ip.op
39
FFT Package FFT Package com.pearsoneduc.ip.opcom.pearsoneduc.ip.op
Thank youThank you
Q&AQ&A