Introduction to Wavelet - Oregon State...

45
Introduction to Wavelet Based on A. Mukherjee’s lecture notes

Transcript of Introduction to Wavelet - Oregon State...

Page 1: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Introduction to Wavelet

Based on A. Mukherjee’s lecture notes

Page 2: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

ContentsHistory of WaveletProblems of Fourier TransformUncertainty Principle The Short-time Fourier TransformContinuous Wavelet TransformFast Discrete Wavelet Transform Multiresolution Analysis Haar Wavelet

Page 3: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Wavelet Definition“The wavelet transform is a tool that cuts up data, functions or operators into different frequency components, and then studies each component with a resolution matched to its scale”

---- Dr. Ingrid Daubechies, Lucent, Princeton U

Page 4: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Wavelet Coding MethodsEZW - Shapiro, 1993

Embedded Zerotree coding.

SPIHT - Said and Pearlman, 1996Set Partitioning in Hierarchical Trees coding. Also uses “zerotrees”.

ECECOW - Wu, 1997Uses arithmetic coding with context.

EBCOT – Taubman, 2000Uses arithmetic coding with different context.

JPEG 2000 – new standard based largely on EBCOT

Page 5: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Comparison of Wavelet Based JPEG 2000 and DCT Based JPEG

JPEG2000 image shows almost no quality loss from current JPEG, even at 158:1 compression.

Page 6: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Introduction to Wavelets"... the new computational paradigm [wavelets] eventually may swallow Fourier transform methods..."

" ...a new approach to data crunching that, if successful, could spawn new computer architectures and bring about commercial realization of such difficult data-compression tasks as sending images over telephone lines. "

---- from "New-wave number crunching" C. Brown, Electronic Engineering Times, 11/5/90.

Page 7: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle
Page 8: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle
Page 9: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Model and PredictionCompression is PREDICTION.There are many decomposition approaches to modeling the signal.

Every signal is a function.Modeling is function representation/approximation.

CompressedBit Stream

Transmission System

Model Model

Probability Distribution

Probability Estimates

Probability Estimates

Probability Distribution

Encoder DecoderSourceMessages

Original SourceMessages

Page 10: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Methods of Function ApproximationSequence of samples

Time domain

Pyramid (hierarchical)PolynomialPiecewise polynomials

Finite element method

Fourier Transform Frequency domainSinusoids of various frequencies

Wavelet TransformTime/frequency domain

Page 11: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

The Fourier TransformAnalysis, forward transform:

Synthesis, inverse transform:

Forward transform decomposes f(t) into sinusoids.

F(u) represents how much of the sinusoid with frequency u is in f(t).

Inverse transform synthesizes f(t) from sinusoids, weighted by F(u).

2( ) ( ) j utF u f t e dtπ−= ∫2( ) ( ) j utf t F u e duπ= ∫

Page 12: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

The Fourier Transform PropertiesLinear Transform.Analysis (decomposition) of signals into sines and cosines has physical significance

tones, vibrations.

Fast algorithms exist. The fast Fourier transform requires O(nlogn) computations.

Page 13: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Problems With the Fourier TransformFourier transform well-suited for stationarysignals – statistics of the signals do not vary with time. This model does not fit real signals well.For time-varying signals or signals with abrupt transitions, the Fourier transform does not provide information on whentransitions occur.

Page 14: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Problems With the Fourier Transform

Fourier transform is a “global” analysis. A small perturbation of the function at any one point on the time-axis influences all points on the frequency-axis and vise versa.

A qualitative explanation of why Fourier transform fails to capture time information is the fact that the set of basis functions ( sines and cosines) are infinitely long and the transform picks up the frequencies regardless of where it appears in the signal.

Need a better way to represent functions that are localized in both time and frequency.

Page 15: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Uncertainty Principle--- Preliminaries for the STFT

The time and frequency domains are complimentary.

If one is local, the other is global. For an impulse signal, which assumes a constant value for a very brief period of time, the frequency spectrum is infinite.If a sinusoidal signal extends over infinite time, its frequency spectrum is a single vertical line at the given frequency.

We can always localize a signal or a frequency but we cannot do that simultaneously.

If the signal has a short duration, its band of frequency is wide and vice versa.

Page 16: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Uncertainty PrincipleHeisenberg’s uncertainty principle was enunciated in the context of quantum physics which stated that the position and the momentum of a particle cannot be precisely determined simultaneously.

This principle is also applicable to signal processing.

Page 17: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Uncertainty Principle-- In Signal Processing

Let g(t) be a function with the property .

Then

where denote average values of t and f ,and G(f) is the Fourier transform of g(t).

1)( 2 =∫∞

∞−

dttg

2 22 22

1( ( ) ( ) )( ( ) ( ) )16m mt t g t dt f f G f dt

∞ ∞

−∞ −∞

− − ≥Π∫ ∫

mm ft ,

dttgttm2|)(|∫=

dttGffm2|)(|∫=

Page 18: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Gabor’s ProposalShort-time Fourier Transform.

The STFT is an attempt to alleviate the problems with FT.

It takes a non-stationarysignal and breaks it down into “windows” of signals for a specified short period of time and does Fourier transform on the window by considering the signal to consist of repeated windows over time.

TimeFr

eque

ncy

STFT

Time

Am

plitu

de

Page 19: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

The Short-time Fourier Transform Time-frequency Resolution

Page 20: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

The Short-time Fourier TransformAnalysis:

Synthesis:

where w(t) is a window function localized in time and frequency.Analysis functions are sinusoids windowed by w(t).Common window functions

Gaussian (Gabor), Hamming, Hanning, Kaiser.

* 2( , ) ( ) ( ) j utSTFT u f t w t e dtπτ τ −= −∫

2( ) ( , ) ( ) j utf t STFT u w t e d duπτ τ τ= −∫

Page 21: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

The Short-time Fourier Transform Properties

Linear transform.Time resolution (∆t) and frequency resolution (∆u) are determined by w(t), and remain fixed regardless of τor u.Biggest disadvantage:

since ∆t and ∆u are fixed by choice of w(t), need to know a priori what w(t) will work for the desired application.

Page 22: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Basic Idea of the Wavelet Transform -- Time-frequency Resolution

Basic idea:∆t, ∆u vary as a function of scale (scale = 1/frequency).

Page 23: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Wavelet Transformation Analysis

Synthesis

where is the mother wavelet.admissibility condition

,1( , ) , ( ) ( ) ( )s

tWT s f t f t dtssτττ ψ ψ −

= = ∫

0

1( ) ( , ) ( ) ( )s

tx t WT s dsd c tsC sψ

ττ ψ τ>

−= + Φ∫∫

2

0

( )fC df

∞ Ψ= < ∞∫

( )tψ

, ( ) 0s tτψ∞

−∞=∫

s : scale

τ: position

WT: coefficient

Page 24: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

ScalingScaling = frequency band

Small scaleRapidly changing details, Like high frequency

Large scaleSlowly changing detailsLike low frequency

Sca

leWavelet Basis functionsat 3 different scales

Page 25: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

More on ScaleIt lets you either narrow down the frequency band of interest, or determine the frequency content in a narrower time interval

Good for non-stationary data

Low scale a Compressed wavelet Rapidly changing details High frequency.

High scale a Stretched wavelet Slowly changing, coarse features Low frequency.

Page 26: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Shifting• Shifting a wavelet simply means delaying (or hastening)

its onset.

• Mathematically, shifting a function f(t) by k is represented

by f(t-k).

Page 27: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

The Wavelet Transform PropertiesLinear transform.All analysis functions are shifts and dilations of the mother wavelet

Time resolution and frequency resolution vary as a function of scale.

Continuous wavelet transform (CWT)s and τare continuous.

Discrete wavelet transform (DWT)s and τare discrete.

, ( )st

sττψ ψ −

=( )tψ

Page 28: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Different Types of Mother Wavelets

Haar Meyer Daubechies

Battle-Lemarie Chui-Wang

Page 29: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Calculate the CWT CoefficientsThe result of the CWT are many wavelet coefficients WT

Function of scale and position.

How to calculate the coefficient?

,1( , ) , ( ) ( ) ( )s

tWT s f t f t dtssτττ ψ ψ −

= = ∫

for each SCALE sfor each POSITION t

WT (s, t) = Signal x Wavelet (s, t)end

end

Page 30: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Calculate the CWT Coefficients

1 2

1. Take a wavelet and compare it to a section at the start of the original signal.

2. Calculate a correlation coefficient WT

3. Shift the wavelet to the right and repeat steps 1 and 2 until you've covered the whole signal.

4. Scale (stretch) the wavelet and repeat steps 1 through 3.

5. Repeat steps 1 through 4 for all scales.

3

4

Page 31: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Discrete Wavelet TransformCalculating wavelet coefficients at every possible scale is a fair amount of work, and it generates an awful lot of data.

What if we choose only a subset of scales and positions at which to make our calculations?

It turns out, rather remarkably, that if we choose scales and positions based on powers of two --- so-called dyadicscales and positions --- then our analysis will be much more efficient and just as accurate.

Page 32: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Discrete Wavelet TransformIf (s, τ) take discrete value in R2, we get DWT. A popular approach to select (s, τ) is

So,

0

1ms

s=

0

0m

nsττ =

01 1 1 12 1, , , , , m: integer

2 2 4 8ms s= → = =< >K

0 02 , 1, n, m: integer2m

ns τ τ= = =

( )2 2, ,

1 2( ) ( ) 2 ( ) 2 212

mm m ms m n

m

nttt t t nssττψ ψ ψ ψ ψ

⎛ ⎞−⎜ ⎟−= = = = −⎜ ⎟

⎜ ⎟⎝ ⎠

Page 33: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Discrete Wavelet TransformWavelet Transform:

Inverse Wavelet Transform

If f(t) is continuous while (s, τ) consists of discrete values, the series is called the Discrete Time Wavelet Transform (DTWT).

If f(t) is sampled (that is, discrete in time, as well as (s, τ) are discrete, we get Discrete Wavelet Transform(DWT).

2, ,( ), ( ) 2 ( ) (2 )

m mm n m nDWT f t t f t t n dtψ ψ=< >= −∫

, ,( ) ( ) ( )m n m nm n

f t DWT t c tψ= + Φ∑∑

Page 34: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Normalized 1D Haar Wavelet

0,0

11 0 t2( )

11 12

tt

ψ

⎧ ≤ <⎪⎪= ⎨⎪− ≤ <⎪⎩

1,0 ( ) 2 (2 )t tψ ψ=

1,1( ) 2 (2 1)t tψ ψ= −

2,0 ( ) 2 (4 )t tψ ψ=

2,1( ) 2 (4 1)t tψ ψ= −

2,2 ( ) 2 (4 2)t tψ ψ= −

-1

1

0.5 1

-1.414

1.414

0.5 1

-1.414

1.414

0.5 1

2

2

0.5 1

-2

2

0.5 1

-2

2

0.5 1

Page 35: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Haar Scaling functionThe Haar transform uses a scaling function and wavelet functions.

Scaling function Calculate scaling function

Synthesis the original signal

-1

1

0.5 1( ), ( ) ( ) ( )c f t t f t t dt=< Φ >= Φ∫

, ,( ) ( ) ( )m n m nm n

f t DWT t c tψ= + Φ∑∑

Page 36: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Example of Fast DWT, Haar Wavelet

Given input value {1, 2, 3, 4, 5, 6, 7, 8}Step #1

Output Low Frequency {1.5, 3.5, 5.5, 7.5}Output High Frequency {-0.5, -0.5, -0.5, -0.5}

Step #2 Refine Low frequency output in Step #1

L: {2.5, 6.5}H: {-1, -1}

Step #3Refine Low frequency output in Step #2

L: {4.5}H: {-2}

Page 37: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Fast Discrete Wavelet TransformBehaves like a filter bank

signal incoefficients out

Recursive application of a two-band filter bank to the lowpass band of the previous stage.

Page 38: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Fast Discrete Wavelet Transform

Page 39: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Fast Wavelet Transform PropertiesAlgorithm is very fast

O(n) operations.Discrete wavelet transform is not shift invariant.

A deficiency.Key to the algorithm is the design of h(n) and l(n).

Can h(n) and l(n) be designed so that wavelets and scaling function form an orthonormal basis? Can filters of finite length be found?YES.

Daubechies Family of WaveletsHaar basis is a special case of Daubechies wavelet.

Page 40: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Daubechies Family of Wavelets Examples

Page 41: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Two Dimensional Transform

Page 42: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Two Dimensional Transform(Continued)

Page 43: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

1D Haar WaveletMother Wavelet

Wavelet basis function

0,0

11 0 t2 ( )

11 12

tt

ψ

⎧ ≤ <⎪⎪= ⎨⎪− ≤ <⎪⎩

-1

1

0.5 1

, ( ) (2 )jj i t t iψ ψ= −

Page 44: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

1D Haar Wavelet

0,0

11 0 t2( )

11 12

tt

ψ

⎧ ≤ <⎪⎪= ⎨⎪− ≤ <⎪⎩

1,0 ( ) (2 )t tψ ψ=

1,1( ) (2 1)t tψ ψ= −

2,0 ( ) (4 )t tψ ψ=

2,1( ) (4 1)t tψ ψ= −

2,2 ( ) (4 2)t tψ ψ= −

-1

1

0.5 1

-1

1

0.5 1

-1

1

0.5 1

-1

1

0.5 1

-1

1

0.5 1

-1

1

0.5 1

Page 45: Introduction to Wavelet - Oregon State Universityweb.engr.oregonstate.edu/~thinhq/teaching/ece599/chapter3.pdf · History of Wavelet Problems of Fourier Transform Uncertainty Principle

Wavelet Transformed ImageThree levels of Wavelet transform.

One low resolution subband.Nine detail subband.