Top Banner
• Filter implementation of the Haar wavelet • Multiresolution approximation in general • Filter implementation of DWT • Applications - Compression The Story of Wavelets Theory and Engineering Applications
25

Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Dec 17, 2015

Download

Documents

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: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

• Filter implementation of the Haar wavelet

• Multiresolution approximation in general

• Filter implementation of DWT

• Applications - Compression

The Story of WaveletsTheory and Engineering Applications

Page 2: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

DWT Using Filtering

a(j-1,2k)

a(j-1, 2k+1)

f(t)

fj-1(t)

fj(t)

a(j,k)

][2

1

12,12,12

1

12,12,1

,

kjkj

kj

aa

kjakjaa

Note that at the next finer level, intervals are half as long, so you need 2k to get the same interval.

h’[n]aj-1,k yj-1,k

]1[][2

1][' nnnh

1,1,1,1 2

1 njnjkj aay kjkj ya 2,1,

h’[n] 2aj-1,k

aj,kaj,2k

Approx. coefficients at any level j can be obtained by filtering coef. at level j-1 (next finer level) by h’[n] and downsampling by 2

Page 3: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Filter Implementation of Haar Wavelet

We showed that aj,k can be obtained from aj-1,k through filtering by using a filter

]1[][2

1][' nnnh

followed by a downsampling operation (drop every other sample). Similarly, d j,k can also be obtained from aj-1,k using the filter g’[n] followed by down sampling by 2…

]1[][2

1][' nnng

This is called decomposition in the wavelet jargon.

g’[n] 2aj-1,k

dj,kdj,2k

Detail coefficients at any level j can be obtained by filtering approximation coefficients at level j-1 (next finer level) by g’[n] and downsampling by 2

Page 4: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Decomposition Filters

If we take the FT of h’[n] and g’[n]…

)2/cos()('

)2/cos()('2/

2/

j

j

jejG

ejH

LPF HPF

Page 5: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Decomposition / Reconstruction Filters

We can obtain the coarser level coefficients aj,k or dj,k by filtering aj-1,k with h’[n] or g’[n], respectively, followed by downsampling by 2.

Would any LPF and HPF work? No! There are certain requirements that the filters need to satisfy. In fact, the filters are obtained from scaling and wavelet functions using dilation (two-scale) equations (coming soon…)

Can we go the other way? Can we obtain aj-1,k from aj,k and dj,k from a set of filters. YES!. This process is called reconstruction.Upsample a(k,n) and d(k,n) by 2 (insert zeros

between every sample) and use filters h[n]=[n]+ [n-1] and g[n]= [n]- [n-1]. Add the filter outputs !

Page 6: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

The Discrete Wavelet Transform

g`[n]

h`[n]

2

2 g`[n]

h`[n]

2

2

2

2

g[n]

h[n]

+

2

2

g[n]

h[n]

+

aj,k

dj+1,k

Decomposition Reconstruction

We have only shown the above implementation for the Haar Wavelet, however, as we willsee later, this implementation – subband coding – is applicable in general.

dj+2,k

aj+2,k

aj+1,kaj+1,k

aj,k

Page 7: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

We see that app. and detail coefficients can be obtained through filtering operations, but where do scaling and wavelet functions appear in the subband coding DWT implementation?

Clearly, these functions are somehow hidden in the filter coefficients, but how?

To find out, we need to know little bit more about these scaling and wavelet functions

j

j

j kkjkjkj tkjdatxtf

0

00)(),()()( ,,,

Page 8: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Let’s suppose that the function f(t) is sampled at N points to give the sequence f[n], and further suppose that kth resolution is the highest resolution (we will compute approximations at k+1, k+2, …etc. Then:

Multiplying and integrating

MRA on Discrete Functions

1

0,1,1

1

0,1,1

1

0,,

)()(

)(][

N

kkjkj

N

kkjkj

N

kkjkj

tdta

tanf

1

2

dttdtt kjkj )( )( ,1,1 1 2

N

kkjkjkjkj

N

kkjkjkjnj

dtttad

dtttaa

0),1(,,,1

0),1(,,1

)()(

)()(

h[k]

g[k]

1)()(

0)()(

11

11

dttt

dttt

kk

kk

Page 9: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

From MRA to Filters

This substitution gives us level j+1 approximation and detail

coefficients in terms of level j coefficients :

we can put the above expressions in convolution (filter) form as

k

kjkjk

kjkj kgadkhaa ][ and ][ ,),1(,),1(

m

mjkjm

mjkj mkgadmkhaa ]2[ and ]2[~

,),1(

~

,),1(

H~

aj,k

G~

2

21-level of DWT decomposition

h[n]=h[-n], and g[n]=g[-n]~ ~ So where do these filters really come from…?

aj+1,k

dj+1,k

Page 10: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Dilation / Two-scale Equations

Two scale (dilation) equations for the scaling and wavelet functions determine the filters associated with these functions. In particular:

The coefficients c(n) can be obtained as

Recall that

In some books, h[k]= c(k)/√2. Then the two-scale equation becomes

k

ktkct )2()()( or more generally

k

jj ktkct )2()()2( )1(

)2(),(2)( kttkc

)2(][~

2)( ktkhtk

dxxgxfgf )()(,

2/][][~

,][~

)()(][ ),1(,),1(, kckhkhdtttkh kjkjkjkj

Page 11: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Similarly, the two-scale equation for the wavelet function:

Then:

Dilation / Two-scale Equations

k

ktkbt )2()()(

k

jj ktkbt )2()()2( )1(

)2(][2)(~

ktkgtk

2/][][~,][~)()(][ ),1(,),1(, kbkgkgdtttkg kjkjkjkj

In some books, g[k]= b(k)/√2. Then the two-scale equation becomes~

Page 12: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Two-Scale Equations

These two equations determine the coefficients of all 4 filters:

h[n]: Reconstruction, lowpass filter

g[n]: Reconstruction, highpass filter

h[n]: Decomposition, lowpass filter

g[n]: Decomposition, highpass filter The following observations can therefore be made

)2(][2)(~

ntnhtn

)2(][2)(~

ntngtn

~

~

highpass isG 1)()( ,1)( 0,G(0)

lowpass is H 1)()( ,0)(,1)0(

][2

1)G(j 0][][

][2

1)H(j 2][][

22

22

~

~

jGjGG

jHjHHH

engngng

enhnhnh

n

nj

n

nj Note : |H(jw)|= |H(jw)|~

Page 13: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Quadrature Mirror Filters

It can be shown that

that is, h[] and g[] filters are related to each other:

in fact, that is, h[] and g[] are mirrors of each other, with every other coefficient negated. Such filters are called quadrature mirror filters. For example, Daubechies wavelets with 4 vanishing moments…..

1)()(1)()(

2~2~22 jGjHjGjH

][)1(]1[ ngnLh n

Page 14: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

DB-4 Wavelets

h = -0.0106 0.0329 0.0308 -0.1870 -0.0280 0.6309 0.7148 0.2304

g = -0.2304 0.7148 -0.6309 -0.0280 0.1870 0.0308 -0.0329 -0.0106

h = 0.2304 0.7148 0.6309 -0.0280 -0.1870 0.0308 0.0329 -0.0106

g = -0.0106 -0.0329 0.0308 0.1870 -0.0280 -0.6309 0.7148 -0.2304

~

~

][][ ],[][

][)1(]1[~~

ngngnhnh

ngnLh n

L: filter length (8, in this case)

Matlab command “wfilters()” Use freqz() to see its freq. response

Page 15: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

DWT implementation:Subband Coding

G

H

2

2 G

H

2

2

2

2

G

H

+

2

2

G

H

+

x[n]x[n]

Decomposition Reconstruction

~

~ ~

~

n

high kngnxky ]2[][][~

n

low knhnxky ]2[][][~

k

high kngky ]2[][

k

high kngky ]2[][

Page 16: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

DWT Decomposition

x[n] Length: 512B: 0 ~

g[n] h[n]

g[n] h[n]

g[n] h[n]

2

d1: Level 1 DWTCoeff.

Length: 256B: 0 ~ /2 Hz

Length: 256B: /2 ~ Hz

Length: 128B: 0 ~ /4 HzLength: 128

B: /4 ~ /2 Hz

d2: Level 2 DWTCoeff.

d3: Level 3 DWTCoeff.

…….

Length: 64B: 0 ~ /8 HzLength: 64

B: /8 ~ /4 Hz

2

2 2

22

|H(jw)|

w/2-/2

|G(jw)|

w- /2-/2

Page 17: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Applications

Detect discontinuities

Page 18: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Applications

Detect hiddendiscontinuities

Page 19: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Applications

Simpledenoising

Page 20: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Compression

DWT is commonly used for compression, since most DWT are very small, can be zeroed-out!

Page 21: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Compression

Page 22: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Compression

Page 23: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

Compression - ECG

Page 24: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

ECG - Compression

Page 25: Filter implementation of the Haar wavelet Multiresolution approximation in general Filter implementation of DWT Applications - Compression The Story of.

ECG- Compression