DWT 6
DWT 6
4-2020-? Lecture 6
Fourier Transformation
x1 ( t ) cos( 2 5t )
x 2 ( t ) cos( 2 25 t )
x3 ( t ) cos( 2 50t )
1D-Signal
• Stationary Signal
– Signals with frequency content unchanged in time
– All frequency components exist at all times
• Non-stationary Signal
– Frequency changes in time
– One example: the “Chirp Signal”
Chirp Signals
0.8 0.8
0.6 0.6
e
Magnitud
0.4
Magnitud
e
0.4
e
Magnitud
100 100
e
Magnitud
0.2 0.2
0 0
-0.2 -0.2
50 50
-0.4 -0.4
-0.6 -0.6
-0.8 -0.8
-1 0 -1 0
0 0.5 1 0 5 10 15 20 25 0 0.5 1 0 5 10 15 20 25
Time Frequency (Hz) Time Frequency (Hz)
!!At
Atwhat
whattime
timethe
thefrequency
frequencycomponents
componentsoccur?
occur? FT
FTcan
cannot
nottell
tell
Stationary Vs. Non-Stationary Signals
• Stationary signals’ spectral characteristics do not change with time
x 4 ( t ) cos( 2 5 t ) X4(ω)
cos( 2 25 t )
cos( 2 50 t )
Per
f
exis ect kn
o
the t, but n wledg
se f e
req o infor of wh
uen m
cies ation at freq
are abo uen
loca u t wh cies
• Non-stationary signals have time varying spectra ted e
i n t i re
me
x5 ( t ) [ x1 x2 x3 ]
Concatenation X5(ω)
5
Stationary & Non-Stationary Signals
• FT identifies all spectral components present in the signal,
however it does not provide any information regarding the
temporal (time) localization of these components. Why?
• Stationary signals consist of spectral components that do not
change in time
– all spectral components exist at all times
– no need to know any time information
– FT works well for stationary signals
• However, non-stationary signals consists of time varying
spectral components
– How do we find out which spectral component appears
when?
– FT only provides what spectral components exist, not
where in time they are located.
– Need some other ways to determine time localization of
spectral components.
Short Time Fourier Transform(STFT)
• Dennis Gabor (1946) Used STFT
– To analyze only a small section of the signal at a time
-- a technique called Windowing the Signal.
• The Segment of Signal is Assumed Stationary
STFTX t , f x t * t t e j 2 ft dt
t
t : the window function
A function of time and frequency
Time
Frequency parameter Signal to
FT Kernel
parameter be analyzed
(basis function)
signal in window
Introduce basis functions which are compact in time and frequency domains.
Let us divide the input signal into time sub-intervals, and perform DFT for
every time sub-interval.
~ Gabor transfortm is a special
x(t )e
(t ) 2 / 2 2 it
X ( , ) e dt case of STFT
Window is a Gaussian function
(Drawbacks of Stft)
• Unchanged Window of Resolution
– Narrow window -> poor frequency resolution
– Wide window -> poor time resolution
• Heisenberg Uncertainty Principle
– Cannot know what frequency exists at what time intervals
1
t
4
t
Time resolution: How well two Frequency resolution: How well two
spikes in time can be separated spectral components can be separated
from each other in the transform from each other in the transform
domain domain
1
t
4
1
Const t ~
Heisenberg cell
Time Frequency Grid in CWT
Scale
a=1/4 4Δf
Δt/4
Δt/2
a=1/2 2Δf
Δt
a=1 Δf
a=2 2Δt
Δf/2
4Δt
Time
½ ≥ Δt * Δf
Resolution of Time & frequency
Better time • Each box represents a equal portion
;resolution
Poor frequency • Resolution in STFT is selected once
Frequency
Better frequencyTime
;resolution
Poor time
resolution
Comparison of
Transformations
1 t
x t
CWTx ( , s ) x ( , s ) dt
s t s
Continuous wavelet transform of the The mother wavelet. All kernels are obtained by
signal x(t) using the analysis wavelet translating (shifting) and/or scaling the mother
(.) wavelet
Scale = 1/frequency
•b – shift coefficient ( ) 1 t b
•a – scale coefficient CWTx ( a , b ) W ( a , b ) x (t ) dt
a a
1 t
CWTx ( , s)
x ( , s ) x t dt
s t s
• Wavelet
– Small wave
– Means the window function is of finite length
• Mother Wavelet
– A prototype for generating the other window functions
– All the used windows are its dilated or compressed and shifted versions.
• Scale
– S>1: dilate the signal
– S<1: compress the signal
• Low Frequency -> High Scale -> Non-detailed Global View of Signal -> Span Entire
Signal
• High Frequency -> Low Scale -> Detailed View Last in Short Time
• Only Limited Interval of Scales is Necessary
Translation () and Scaling(s)
1 t
s , (t )
s s
Scaling(a)
Computation of CWT
1 * t
CWT , s , s
x
x x t dt
s s
Step 1: The wavelet is placed at the beginning of the signal, and set
s=1(the most compressed wavelet);
Step 2: The wavelet function at scale “1” is multiplied by the signal, and
integrated over all times; then multiplied by
Step 3: Shift the wavelet to t= , and get the transform value at t= and
s=1;
Step 4: Repeat the procedure until the wavelet reaches the end of the
signal;
Step 5: Scale s is increased by a sufficiently small value, the above
procedure is repeated for all s;
Step 6: Each computation for a given s fills the single row of the time-
scale plane;
Step 7: CWT is obtained if all s are calculated.
WT
WT
Properties of Wavelets
• Simultaneous localization in time and scale
- The location of the wavelet allows to explicitly represent the
location of events in time.
- The shape of the wavelet allows to represent different detail or
resolution.
Properties of Wavelets
• Sparsely: for functions typically found in practice, many of the
coefficients in a wavelet representation are either zero or very small.
• Linear-time complexity: many wavelet transformations can be
accomplished in O(N) time.
• Adaptability: wavelets can be adapted to represent a wide variety of
functions (e.g., functions with discontinuities, functions defined on
bounded domains etc.).
– Well suited to problems involving images, open or closed curves, and
surfaces of just about any variety.
– Can represent functions with discontinuities or corners more
efficiently (i.e., some have sharp corners themselves).
• It represents and analyzes signals at more than one resolution.
• 2 related operations with ties to MRA(Multi Resolution Analysis):
Subband coding
Haar transform
• MRA is just a concept, and the wavelet-based transformation is one
method to implement it.
Multiresolution Representation using
a jk f (t ) *jk (t ) f (t ) a jk jk (t ) high
t k j
resolution
(more details)
…
low
resolution
)less details(
Discretization of CWT
• It is Necessary to Sample the Time-Frequency (scale) Plane.
• At High Scale s (Lower Frequency f ), the Sampling Rate N can be
Decreased.
• The Scale Parameter s is Normally Discretized on a Logarithmic Grid.
• The most Common Value is 2.
• The Discretized CWT is not a True Discrete Transform
1 t k .2 j j
t k .2 j
s , (t ) j j
2
2
j
jk (t ) )dyadic/octave grid(
2 2 2
1 t k .2 j j
t k .2 j
s , (t ) j j
2 2
j
jk (t )
2 2 2
j
jk (t ) 2 2 j t k
2 high
resolution
scale/frequency j
localization
low
time localization resolution
Discrete Wavelets
Ψ j , k (t ) 2 j 2 Ψ (2 j t k )
• f(t) is written as a linear combination of φ(t-k) and ψ(2jt-k)
f (t ) ck (t k ) d j ,k (2 t k )
j
k k j
φ0,2(x)
i j ( x ) i , j ( x )
φ1,2(x)
φ2,2(x)
φ0,1(x)
φ3,2(x)
φ1,1(x)
ψ1,1(x)
i j ( x ) i , j ( x )
i j ( x ) i , j ( x)
φ0,0(x)
ψ0,1(x)
i j ( x ) i , j ( x ) i j ( x) i , j ( x)
ψ1,1(x)
Discrete Wavelet Transform
• The continuous wavelet transform was computed by changing the scale
of the analysis window, shifting the window in time, multiplying by the
signal, and integrating over all times.
• In the discrete case, filters of different cutoff frequencies are used
to analyze the signal at different scales. The signal is passed through a
series of highpass filters to analyze the high frequencies, and it is
passed through a series of lowpass filters to analyze the low
frequencies.
– The resolution of the signal, which is a measure of the amount of
detail information in the signal, is changed by the filtering
operations.
– The scale is changed by upsampling and downsampling operations.
CWTx ( , s )
1
x ( , s ) s x t
t
t dt
s
:Similarly, we get
:The coefficients
:Scaling function
:Substituting j0 = j+1, k = m
Fast Wavelet Transform
:By definition
Forward FWT
analysis bank
(MRA)-Subband Coding
• Since the bandwidth of the resulting subbands is smaller than that of the
original image, the subbands can be downsampled without loss of information.
• We wish to select h0 n , h1 n , g 0 n , g1 n so that the input can be perfectly
reconstructed.
Biorthogonal
Orthonormal
• Calculating the wavelets coefficients at every possible scale is too much
work
• It also generates a very large amount of data
T
DW
Solution: choose only a subset of scales and positions, based on power of
two (dyadic choice)
Fast Wavelet Transform
g[n] h[n]
w
Length: 256 /2- /2
Length: 256 2 2 B: 0 ~ /2 Hz
B: /2 ~ Hz
a1 |G(jw)|
d1: Level 1
DWT
.Coeff g[n] h[n]
Length: 128
Length: 128 2 2 w
B: 0 ~ /4 Hz - /2- /2
B: /4 ~ /2 Hz a2
d2: Level 2
DWT g[n] h[n]
.Coeff
2 2 Length: 64
Length: 64
B: 0 ~ /8 Hz
B: /8 ~ /4 Hz
d3: Level 3 .…a3… Level 3 approximation
DWT Coefficients
.Coeff
V1 basis functions
]5 3 7 9[
,low-pass
down-sampling ,high-pass
down-sampling
] 5 3 7 9[
,low-pass ,high-pass
down-sampling down-sampling
V1 basis functions
(8+4)/2 (8-4)/2
Fast Wavelet Transform
-
Fast Wavelet Transform
~
LL Ak 1
COLUMNS
H 2 1
ROWS ~
H 1 2
……
COLUMNS
~ D ( h)
G 2 1 LH k 1
ROWS
……
INPUT COLUMNS
IMAGE ~
H 2 1 HL Dk(v)1
~ 1 2
G
ROWS
~ D (d )
G 2 1 HH k 1
COLUMNS
columns columns
rows H 2 a a 2 u1
x0 y1 H rows
H 2 y1 x1
+ 2 H
LPF G 2 h h 2 G u2 + x0
H 2 v v 2 u3
y2 H
G 2 y2
+ 2 G x2
HPF G 2 d d 2 G u4
1-level 2D-DWT
FWT in 2D
A H
LL LH
.Ver D
HL HH
FWT in 2D:Example
8 7 6 5 4 3 2 1 -
8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
3/2 3 3 3 3 3 3 3 3/2
2√/7 2√/7 2√/7 2√/7 2√/7 2√/7 2√/7 2√/7 x
7/2 7/2 7/2 7/2 7/2 7/2 7/2 7/2 2√/1
7/2 7/2 7/2 7/2 7/2 7/2 7/2 7/2 1/√2
7/2 7 7 7 7 7 7 7 7/2
7 -- 7 -- 7 -- 7 ---
11/2 11 11 11 11 11 11 11 11/2
11 -- 11 -- 11 -- 11 ---
After decimation the result by two
15 11 7 3
=a1 15 11 7 3 LL
15 11 7 3
Each column of y1 is passed through HPF 15 11 7 3
3/2 0 0 0 0 0 0 0 -3/2
7/2 0 0 0 0 0 0 0 -7/2
After decimation the result by two 0 0 0 0
=h1
0
0
0
0
0
0
0
0
LH
0 0 0 0
8 7 6 5 4 3 2 1 x
-8/√2 -7/√2 -6/√2 2√/5- -4/√2 -3/√2 2√/2- 2√/1- -1/√2
8/√2 7/√2 6/√2 5/√2 4/√2 3/√2 2/√2 1/√2 1/√2
The above process is done for all each row in the matrix X 0. After decimation the
result by two
-1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
-1/2 -1 -1 -1 -1 -1 -1 -1 -1/2
The above process is done for each column in matrix Y 2. After decimation the
results by two 1- 1- 1- -
1
=v1
1- 1- 1- -
1
HL
1- -1- 1-
Each column of y2 is passed through
1 HPF
1- 1- 1- -
2√/1- 2√/1- 2√/1- 2√/1- 2√/1- 2√/1- 2√/1- 2√/1- x
1
1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 -1/√2
1/2- 1/2- 1/2- 1/2- 1/2- 1/2- 1/2- 1/2- 1/√2
-1/2 0 0 0 0 0 0 0 1/2
The above process is done for each column in matrix Y2. After decimation the
results by two
0 0 0 0
HH
=d 1 0 0 0 0
0 0 0 0
0 0 0 0
Further N-level of decomposition are applied over the a (low-low) subband.
Inverse FWT in 2D
1.The result of interpolation a1 by 2 is:
0 0 0 0
15 11 7 3
0 0 0 0
15 11 7 3
0 0 0 0
15 11 7 3
0 0 0 0
15 11 7 3
7 0 7 0 7 0 7 0 x
7/√2 0 7/√2 0 7/√2 0 7/√2 0 1/√2
7/√2 0 7/√2 0 7/√2 0 7/√2 0 1/√2
0 0 0 0 0 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
=U 2
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
15/√2 11/√2 7/√2 3/√2
15/√2 11/√2 7/√2 3/√2
15/√2 11/√2 7/√2 3/√2
U1+U2= Y1 = 15/√2 11/√2 7/√2 3/√2
15/√2 11/√2 7/√2 3/√2
15/√2 11/√2 7/√2 3/√2
15/√2 11/√2 7/√2 3/√2
15/√2 11/√2 7/√2 3/√2
0 0 0 0
-1 -1 -1 -1
0 0 0 0
-1 -1 -1 -1
0 0 0 0
-1 -1 -1 -1
0 0 0 0
-1 -1 -1 -1
-1 0 -1 0 -1 0 -1 0 x
-1/√2 0 -1/√2 0 -1/√2 0 -1/√2 0 1/√2
-1/√2 0 -1/√2 0 -1/√2 0 -1/√2 0 1/√2
=u4 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
Then
-1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
= U4+U3= Y2 -1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
-1/√2 -1/√2 -1/√2 -1/√2
The result of interpolation y2 by 2 is.6
8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
x1+x2=x0= 8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
Each of these columns is passed through HPF
0 0 0 0 0 0 0 0 x
0 0 0 0 0 0 0 0 1/√2
0 0 0 0 0 0 0 0 -1/√2
0 0 0 0 0 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
Each of these rows is passed through LPF
15/√2 0 11/√ 0 7/√2 0 3/√2 0 x
2
15/2 0 11/2 0 7/2 0 3/2 0 1/√2
15/2 0 11/2 0 7/2 0 3/2 0 1/√2
• Noise filtering
• Image compression
– Fingerprint compression
• Image fusion
– Face recognition
• Recognition/Classification
• Image retrieval
Denoising
Matlab Wavelet
• MATLAB has a wavelet toolbox
– Continuous and discrete wavelets
– coefs = cwt(x,scales,'wname')
– wname is the name of the wavelet transform and
includes: Morlet, Daubechies, Haar, Mexican Hat,
Gaussian, etc
– scales is the range of scales the wavelet transform is
stretched or compressed
– [cA,cD] = dwt(X,'wname')
• dwt is the discrete wavelet function
The end