247
WAVELETS AND FILTER BANKS Ildikó László, PhD ELTE UNIV., BUDAPEST, HUNGARY [email protected]

WAVELETS AND FILTER BANKS

  • Upload
    bazyli

  • View
    57

  • Download
    1

Embed Size (px)

DESCRIPTION

WAVELETS AND FILTER BANKS. Ildikó László, PhD ELTE UNIV., BUDAPEST, HUNGARY [email protected]. NEWER VERSION BUT STILL NEEDS IMPROOVMENTS AND CORRECTIONS !!!. BIBLIOGRAPHY: - G. Strang, T. Nguyen:Wavelets and Filter Banks, Wellesly-Cambridge Press - PowerPoint PPT Presentation

Citation preview

Page 1: WAVELETS AND  FILTER BANKS

WAVELETS AND FILTER BANKS

Ildikó László, PhDELTE UNIV., BUDAPEST,

HUNGARY [email protected]

Page 2: WAVELETS AND  FILTER BANKS

NEWER VERSION BUT STILL NEEDSIMPROOVMENTS AND CORRECTIONS!!!

Page 3: WAVELETS AND  FILTER BANKS

BIBLIOGRAPHY:- G. Strang, T. Nguyen:Wavelets and

Filter Banks, Wellesly-Cambridge Press- F. Schipp, W.R. Wade:Transforms on

Normed Fields- Ingrid Daubechies: Ten Lectures on

Wavelets- Stephane Mallat: A Wavelet tour of

Signal Processing- Charles K. Chui: An Introduction to

Wavelets etc.

Page 4: WAVELETS AND  FILTER BANKS

AT THE END YOU WILL HAVE TO BEABLE TO „GET” THINGS LIKE:

Page 5: WAVELETS AND  FILTER BANKS
Page 6: WAVELETS AND  FILTER BANKS
Page 7: WAVELETS AND  FILTER BANKS
Page 8: WAVELETS AND  FILTER BANKS
Page 9: WAVELETS AND  FILTER BANKS
Page 10: WAVELETS AND  FILTER BANKS
Page 11: WAVELETS AND  FILTER BANKS
Page 12: WAVELETS AND  FILTER BANKS
Page 13: WAVELETS AND  FILTER BANKS

Some rows (10...) of A4:

50 150 200100 250

50 150 200100 250

50 150 200100 250

Page 14: WAVELETS AND  FILTER BANKS

Some rows (10...) of A3:

50 150 200100 250

50 150 200100 250

50 150 200100 250

Page 15: WAVELETS AND  FILTER BANKS

Some rows (22...) of A4:

50 150 200100 250

50 150 200100 250

50 150 200100 250

Page 16: WAVELETS AND  FILTER BANKS

Some rows (48...) of A3:

50 150 200100 250

50 150 200100 250

50 150 200100 250

Page 17: WAVELETS AND  FILTER BANKS

1.INTRODUCTION

- the classical Fourier analysis where a signal isrepresented by its trigonometric Fourier transform, is one of the most widely spread toolsin signal and image processing;- at the end of the 19th century Du Bois-Reymondconstructed a continuous function with divergent Fourier series;- Hilbert: whether there exist any orthonormal system for which the Fourier series with respect tothis system do not posses this singularity?

Page 18: WAVELETS AND  FILTER BANKS

- Alfred Haar in 1909 constructed such an orthonormal system for which the Haar-Fourierseries of continuous functions converge uniformly:

otherwise

t

t

t

,0

12

1,1

2

10,1

)(

- This was the first wavelet; (1910, Szeged, PhD)

Page 19: WAVELETS AND  FILTER BANKS

-The basic goal of Fourier series is to take asignal – considered as a function of time variable t, and decompose it into its various frequency components;-The basic building blocks are sin(nt) and cos(nt),which vibrate at a frequency of n times per interval.- Consider the following function:

2

).50sin(3.0)3cos(2)sin()( ttttf

Page 20: WAVELETS AND  FILTER BANKS

n

nn ntbntatf )sin()cos()(

- This function has three components that vibrate at frequency 1 – the sin(t) part,at frequency 3 – the 2cos(3t) part,at frequency 50 – the 0.3sin(50t) part;

- we can express a function f(t) in termsof the basis functions, sine and cosine:

Page 21: WAVELETS AND  FILTER BANKS

-One disadvantage of Fourier series is that its building blocks, sines and cosines, are periodicwaves that continue forever.

-A trigonometric expansion is a sum of theform:

kkk kxbkxaaxf )sin()cos()( 0

where the sum could be finite or infinite.

Page 22: WAVELETS AND  FILTER BANKS

- In many appl., given a signal one is interested in its frequency component locallyin time;(similar to music notation, which tells the playerwhich notes –frequency inf. –to play at any given moment)- The standard Fourier transform,

)(tf

dtetfFf ti

)(

2

1

also gives the frequency content of )(tf

Page 23: WAVELETS AND  FILTER BANKS

, .

Page 24: WAVELETS AND  FILTER BANKS
Page 25: WAVELETS AND  FILTER BANKS
Page 26: WAVELETS AND  FILTER BANKS

- but inf. concerning time-localization ofe.g., high frequency bursts cannot be read offeasily from Ff- time localization can be achieved by first windowing the signal .f

0

f(t)

g(t)1

Page 27: WAVELETS AND  FILTER BANKS

dsetsgsftfT siwin )()())((

- which is the windowed Fourier transform;- cuts off only a well-localized slice of ;f

-The wavelet transform provides a similartime-frequency description, with a fewimportant differences;

Page 28: WAVELETS AND  FILTER BANKS

Fourier transform:- represents the frequency comp. of a signal

- doesn‘t offer localization in time

Wavelet transform:

- cuts up a signal into frequency components- studies each component with a resolution

matched to its scale- offers localization in time

Page 29: WAVELETS AND  FILTER BANKS

- A wavelet is a function of zero average:

0)( dtt

- which is dilated by j and translated by k; - j is the scaling parameter;- k is the translation coeff.; allows us to movethe time localization centre; f is localized around k;

Page 30: WAVELETS AND  FILTER BANKS

Wavelets - compactly supported small waves (don‘t extend from –infty to +infty)

Each wavelet - is built up from the same „MOTHER“ wavelet by

translation and dilation

wjk(x) = 2j/2w(2jx - k)

)2(2)( 2/ kxx jjjk

Page 31: WAVELETS AND  FILTER BANKS

- the wavelet transform of f at the scale j and position k is computed by correlating f with the wavelet:

dtkttfkjWTf jj

)2(2)(),( *2

- have only recently been used – 1988 Ingrid Daubechies

Page 32: WAVELETS AND  FILTER BANKS

Wavelets:- basis functions - linearly indep. functions;

Fourier and Wavelet transforms:- representation of a signal

f(t) by basis functions

deFtf ti)()(

)()(,

twbtf jkkj

jk

Page 33: WAVELETS AND  FILTER BANKS

- The Fourier transform of a complex, two dimensional function f(x,y) is given by:

dxdyyfxfiyxfffF yxyx )](2exp[),(),(

- where and are referred to as frequencies;- the inverse Fourier transform

xf yf

yxyxyx dfdfyfxfiffFyxf )](2exp[),(),(

Page 34: WAVELETS AND  FILTER BANKS

- that is, f(x,y) is a linear combination of elementary functions, where the complex number is a weighting factor;

– when dealing with linearsystems – this can be used for decomposing a complicated input signal into more simple inputs;- that is, the response of the system can be calculated as the superposition of the responses given by the system toeach of these “elementary” functions of the form:

)](2exp[ yfxfi yx

)( , yx ffF

Page 35: WAVELETS AND  FILTER BANKS
Page 36: WAVELETS AND  FILTER BANKS

- Examples;- Fourier transform theorems;- Linear Systems. Invariant Linear Systems;- Sampling theory;

Page 37: WAVELETS AND  FILTER BANKS

Let us consider a rectangular lattice of samples of the function g(x,y) as defined: g_s(x,y)=comb(x/X) comb(y/Y)

X

Yx

y

Page 38: WAVELETS AND  FILTER BANKS

-The sampled function g consists of an array of functions, spaced at intervals of width X in the x direction and Y in the y direction.-The area under each function is proportional to the value of the g function at that particular point.

-The spectrum G_s of g_s can be found by convolving the transform of the comb function with the transform of g.

Page 39: WAVELETS AND  FILTER BANKS

G(f , f )x yfy

fx

1/Y

1/X

fx

fyG(f , f )x y

Page 40: WAVELETS AND  FILTER BANKS

X=

1.21.0-1

-1.2

1.21

-1-1.2

T =

1 1 0 0 1 -1 0 0 0 0 1 1 0 0 1 -1

y = T * x =

2.20.2-2.20.2

=

x = T^(-1) *y =

1.11.1-1.1-1.1

Compressed, reconstructed; y(1)=y(3)=0

Page 41: WAVELETS AND  FILTER BANKS

• Convolution – example:

n = 0, 1, 2

k = 0, 1, 2

n=0 x(2) x(1) x(0) y(0)=h(0)x(0)

h(0) h(1) h(2)

n=1 x(2) x(1) x(0) y(1)=h(0)x(1)+

h(0) h(1) h(2) h(1)x(0)

n=2 x(2) x(1) x(0)

h(0) h(1) h(2)

y(2)=h(0)x(2)+h(1)x(1)+h(2)x(0)

Page 42: WAVELETS AND  FILTER BANKS

FILTERS- A Filter – a linear time-invariant operator;

- can be characterized by its impulse response function;

- acts on an input vector x; the output y:

k

xhknxkhny .*)()()(

is a convolution of x and the impulse response of the system;

Page 43: WAVELETS AND  FILTER BANKS

- let us consider the input signal x(n) with the pure frequency : innx exp)( - then the output in the time domain is:

k k

ikinkni khkhny exp)(expexp)()( )(

- where the last term can be recognized as:the Fourier transform of the impulse responseof the system:

k

ikkhH exp)()(

Page 44: WAVELETS AND  FILTER BANKS

- the Fourier transform of the output signal:

n

innyY exp)()(

n k

inknikh expexp)( )(

)()( HX

Page 45: WAVELETS AND  FILTER BANKS

What is the connection between:WAVELETS, FILTERS and FILTER BANKS?- it is the High_Pass that leads to w(t)- the Low_Pass filter leads to a scaling function: ).(t

- the scaling function in continuous time comes from an infinite repetition of the lowpass filter, with rescaling at each repetition;- the wavelet follows from by just one application of the highpass filter.

)(t

Page 46: WAVELETS AND  FILTER BANKS

- averages come from the scaling functions;- details come from the wavelets.

signal at level j (local averages)

+ =signal at level (j+1)

details at level j (local differences)

Page 47: WAVELETS AND  FILTER BANKS

•LOW-PASS FILTER –or MOVING

AVERAGE

To build up the simplest lowpass filter,we use the Haar filter coefficients:

h(0)=1/2 and h(1)=1/2.- the output at time t=n is the average of theinput x(n) and that at time t=n-1 : x(n-1).

k

knxkhny ).()()(

Page 48: WAVELETS AND  FILTER BANKS

y(n)=1/2 x(n)+1/2 x(n-1)

Every linear operator acting on a signal

x can be represented by a matrix: y=H*x

=

.y(-1)y(0)y(1)

.

.x(-1)x(0)x(1)

.

½ 0 0 0 0 ½ ½ 0 0 0 0 ½ ½ 0 0 0 0 ½ ½ 0 0 0 0 . .

averaging filter=1/2 (identity) + 1/2 (delay)

Page 49: WAVELETS AND  FILTER BANKS

- with the simple input signal, with pure frequency: innx exp)(

.exp)exp21

21(

exp21exp2

1)( )1(

ini

niinny

- that is, the output can be written as: y(n)=SOMETHING * x(n)

- this “something” is expressing the effect ofour filter, or system on the input signal;

Page 50: WAVELETS AND  FILTER BANKS

- The frequency response or transfer function of the system:

).exp21

21()( iH

- because this is a periodic function, we want:

.exp)()( )( iHH- it results:

.exp)2(cos)( 2 i

H

Page 51: WAVELETS AND  FILTER BANKS

- the first term is the amplitude, or magnitudeof the transfer function:

2cos)(0 H

- the second term is its phase:

2)(

Page 52: WAVELETS AND  FILTER BANKS

Low-Pass Filter –H_0 (Frequency response function, or transfer function)

0-pi pi

|H_0|

The magnitude

0-pi

pi

The phase of H_0

IMPORTANT: our filters are CASUAL, that isthe output cannot arrive earlier than the input!!!

1

Page 53: WAVELETS AND  FILTER BANKS

High-PASS FILTER –or MOVING DIFFERENCE

Ex. with the Haar coeff.: h(0)=1/2; h(1)=-1/2

The output at t=n:

y(n)=1/2 x(n)-1/2 x(n-1)

=

.y(-1)y(0)y(1)

.

.x(-1)x(0)x(1)

.

½ 0 0 0 0 -½ ½ 0 0 0 0 -½ ½ 0 0 0 0 -½ ½ 0 0 0 0 . .

The number of the coefficients is finite! It results: the impulse response is also finite – FIR!

Page 54: WAVELETS AND  FILTER BANKS

- a highpass filter takes differences, i.e.: picks out the bumps in the signal;

difference filter=1/2(identity)-1/2(delay).

.exp)(

exp)exp21

21(

exp21exp2

1)(

1

)1(

in

ini

niin

H

ny

Page 55: WAVELETS AND  FILTER BANKS

- the quantity:

)exp21

21()(1

iH

- is the highpass response, or the transfer function of the highpass filter.- it results:

.exp)2(sin)( 21

iiH

Page 56: WAVELETS AND  FILTER BANKS

- the magnitude of this periodic highpass filter is:

.2sin)(1 H

- the second term is the phase of the highpass transfer function:

.0exp

0expexp

2

2)(

fori

forii

ii

Page 57: WAVELETS AND  FILTER BANKS

High-Pass Filter – H_1

0-pi pi

|H_1|

The magnitude and phase of the High-Pass filter

0

-pi pi

1 pi/2

Page 58: WAVELETS AND  FILTER BANKS

H_0 ( ) C( ) = H_0( )

H_1 ( ) D( ) = H_1( )2

2

- although there is a discontinuity in the phase at: we still say, that: this is a linear phase filter;

,0

Page 59: WAVELETS AND  FILTER BANKS

C

D

Input signal: x(n) 2

2

Output at level j=1Scaling coeff. ajk

Wavelet coefficientsat level j=1 : bjk

kjk

kja 11

FILTER BANK: LOW_PASS and HIGH_PASS+DOWNSAMPLING

Page 60: WAVELETS AND  FILTER BANKS

-THE OUTPUT OF THE LOW_PASS FILTER IS NOT A FINAL OUTPUT

- the result: an average of the original signal

-THIS IS THAT OUTPUT WHICH CAN (WILL) BEFILTERED AGAIN :

-GOES TO THE NEXT LEVEL:- filtered by the lowpass:

-results in an even coarser average of the original signal;

- filtered by the highpass:- fine details of the previously

averaged signal;

Page 61: WAVELETS AND  FILTER BANKS

-the output of the HIGH_PASS FILTER ISFINAL OUTPUT

– WILL NOT BE FILTERED AGAIN; - these are the WAVELET

COEFFICIENTS at the FINEST SCALE:

- HIGHEST FREQUENCY COMPONENTS!!!

Page 62: WAVELETS AND  FILTER BANKS

Some rows (139...) of A1:

50 150 200100 250

Some rows (48...) of A3:

15 45 6030

N/2

N/2

L_P

H_P

A1

N =256

128

0

0 1

A3

LH

1

0

0

32

Page 63: WAVELETS AND  FILTER BANKS

-the filter bank built up with the Haarcoefficients - IS ORTHOGONAL

- scaling functions come from the iteration of the LOW_PASS FILTER

-they are RESCAILED at each ITERATINON

- this results in COARSER AND COARSER AVERAGING OF THE INPUT SIGNAL

Page 64: WAVELETS AND  FILTER BANKS

Some rows (10...) of A3:

15 45 6030 65

Some rows (5...) of A4:

5 15 2010 25

L_P:1-32

L_P:1-16

Page 65: WAVELETS AND  FILTER BANKS
Page 66: WAVELETS AND  FILTER BANKS
Page 67: WAVELETS AND  FILTER BANKS

c(0)=c(1)= 2*h(0)

L=( 2) C = 2*

½ ½ 0 0 0 0 0 . . 0 0 ½ ½ 0 0 0 . . 0 0 0 0 ½ ½ 0 . . 0 0 0 0 0 0 ½ . .

d(0)= 2/2, d(1)= - 2/2

B=( 2) D = 2*

- ½ ½ 0 0 0 0 0 . . 0 0 -½ ½ 0 0 0 . . 0 0 0 0 -½ ½ 0 . . 0 0 0 0 0 0 -½ . .

Because of causality theupper triangleconsists of zeros only!

H1

Page 68: WAVELETS AND  FILTER BANKS

( 2) C( 2) D

= =LB

1 1 0 0 0 0 . .0 0 1 1 0 0 . . . .-1 1 0 0 0 0 . .0 0 -1 1 0 0 . . . .

THIS MATRIX REPRESENTS THE WHOLE ANALYSIS BANK

1/ 2

L_P

H_P

THE ORTHOGONAL HAAR SYSTEM - FB

Page 69: WAVELETS AND  FILTER BANKS

C

D

2

2 X

2 H 0

2 H 1

v = ( 2) C x = L x 0

v = ( 2) D x = B x 1

Page 70: WAVELETS AND  FILTER BANKS

-The Analysis Matrix, or Analysis Bank builtup by the Haar coefficients is an orthogonalFilter Bank;-For an orthogonal system, the inverse matrix=the transpose;

-That is: S=A-1=AT

Page 71: WAVELETS AND  FILTER BANKS

TLB

= = 1//2L B

1 0 . -1 0 .1 0 . 1 0 .0 1 . 0 -1 . 0 1 . 0 1 . . .

THIS MATRIX REPRESENTS THE WHOLE SYNTHESIS BANK

-1

T

N/2 N/2

WHEN THE MATRIX IS ORTHOGONAL:THE INVERSE IS THE TRANSPOSE

Page 72: WAVELETS AND  FILTER BANKS

DOWNSAMPLING - UPSAMPLING

( 2)

.x(0)x(1)x(2) .

=

.x(0)x(2)x(4) .

( 2)

.x(0)x(2)x(4) .

=

x(0) 0x(2) 0x(4)

Page 73: WAVELETS AND  FILTER BANKS

.x(0)x(1)x(2) .

=

.x(0)x(2)x(4) .

1 0 0 0 0 00 0 1 0 0 00 0 0 0 1 0. . . . . .

- Repr. of the down- sampling op. by matrix multiplication:

- as if every second row of a unitary matrix would be missing!

Page 74: WAVELETS AND  FILTER BANKS

DOWNSAMPLING - UPSAMPLING

y(n) = ( 2) x(n) = x(2n)

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

u(n) = ( 2) v(n)

x(n)

y(n)

v(n)

u(n)

Page 75: WAVELETS AND  FILTER BANKS

x(-1)x(0)x(1)x(2)x(3)x(4)x(5)x(6)

=

x(0)+x(-1)x(2)+x(1)x(4)+x(3)x(6)+x(5)x(0)-x(-1)x(2)-x(1)x(4)-x(3)x(6)-x(5)

1 1 0 0 0 0 0 00 0 1 1 0 0 0 00 0 0 0 1 1 0 00 0 0 0 0 0 1 11-1 0 0 0 0 0 00 0 1 -1 0 0 0 00 0 0 0 1 -1 0 00 0 0 0 0 0 1 -1

21

21

Page 76: WAVELETS AND  FILTER BANKS

v = ( 2) Cx = Lx

v = ( 2) Dx = Bx

Lx = 1/ 2

. x(0)+x(-1)x(2)+x(1)x(4)+x(3) . Bx = 1/ 2

. x(0)-x(-1)x(2)-x(1)x(4)-x(3) .

0

1

Low_Pass part High_Pass part

Page 77: WAVELETS AND  FILTER BANKS

u = 1/ 20 u = 1/ 2

1

x(0)+x(-1) 0x(2)+x(1) 0x(4)+x(3) .

x(0)-x(-1) 0x(2)-x(1) 0x(4)-x(3) .

RECONSTRUCTION

u =( 2)v 0 0 u =( 2)v 1 1

- the Low_Pass partof the synthesis matrix;

- the High_Pass partof the synthesis matrix;

Page 78: WAVELETS AND  FILTER BANKS

FILTERING AFTER UPSAMPLINGRECOVERS THE INPUT -

DELAYED: x(n-1)

F filters 1/ 2

x(0)+x(-1) 0x(2)+x(1) 0x(4)+x(3) .

x(0)+x(-1)x(0)+x(-1)

x(2)+x(1)x(2)+x(1)x(4)+x(3) .

to give 1/2 = w0

Low_PassOf the Synthesis

Page 79: WAVELETS AND  FILTER BANKS

G filters 1/ 2

x(0)-x(-1) 0x(2)-x(1) 0x(4)-x(3) .

-x(0)+x(-1) x(0)-x(-1)

-x(2) +x(1) x(2)-x(1) x(4) -x(3) .

to give = w1

w x(n-1) w

0

1

High_PassFor the Synthesis

21

Page 80: WAVELETS AND  FILTER BANKS

w_0(n) = ½ (u_0(n) + u_0(n-1)

w_1(n) = ½ (u_1(n) - u_1(n-1)

x(0)+x(-1)x(0)+x(-1)

x(2)+x(1)x(2)+x(1)x(4)+x(3) .

= w0

-x(0)+x(-1) x(0)-x(-1)

x(1) -x(0) x(2)-x(1) x(3) -x(2) .

= w11/2 1/2

w x(n-1) w

0

1

w0(n) + w1(n) =1/2[x(0)+x(-1) + x(0)-x(-1) ]=x(n-1)

Page 81: WAVELETS AND  FILTER BANKS

L

H

2

2

ANALYSIS

F

G

2

2 =x(n-1)

SYNTHESIS

x(n)

Page 82: WAVELETS AND  FILTER BANKS

L

H

Signal at level j-1 2

2

Signal at level j

Wavelet coefficientsAt level j : bjk

kjk

kja 11

Discret Wavelet Transform - DWT

Page 83: WAVELETS AND  FILTER BANKS

L

H

Signal atlev.: j-1 2

2

Wavelet coeff.at lev. j: b

L

H

2

2

Wavelet coeff.at j+1 : b

Sign. at j+1:a

Fast Wavelet Transform - FWT

j,k

j+1,k

j+1,k

aj,k

Page 84: WAVELETS AND  FILTER BANKS

N/2

N/2

L

H

A1

0

0 1

A2

L

HA = …

N

Page 85: WAVELETS AND  FILTER BANKS

THE TRANSFORM OF A SIGNAL – IN THE FREQUENCY DOMAIN

y(n) =

h(k)x(n-k)

Y( ) = X( ) H( )

THE EFFECT OF THE DOWNSAMPLINGIN THE FREQUENCY DOMAIN

Y( ) = ½ {X( /2) + X( /2 + )} = V( )

Page 86: WAVELETS AND  FILTER BANKS

DOWNSAMPLING - UPSAMPLING

y(n) = ( 2) x(n) = x(2n)

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

u(n) = ( 2) v(n)

x(n)

y(n)

v(n)

u(n)

Page 87: WAVELETS AND  FILTER BANKS

- if our input signal is:innx exp)(

then the output is: )2()( nxny

- ? the effect of the downsampling in the frequency domain is?

n

innyY exp)()(

Page 88: WAVELETS AND  FILTER BANKS

m

im

m

im

m

imm

evenm

mi

n

in

mxmx

mx

mx

nxY

)2(2

2

""

2

exp)(exp)(21

exp)())1(1(21

exp)(

exp)2()(

Page 89: WAVELETS AND  FILTER BANKS

- From where it results:

.)2()2(21)()( XXVY

- that is, two input signals, that of frequency

22 and

give the same output!- This means that the recovery of the input signal from this output wouldn’t be possible.

Page 90: WAVELETS AND  FILTER BANKS

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

x(n)

y(n) u(n)

- again: downsampling in time domain;

Page 91: WAVELETS AND  FILTER BANKS

--2 2 --2 2

1 1X( ) X( /2+ )

X( /2)

Period: 2 Period: 4

Thus the result of this output, would be:V( )

--2 2

1

1/2

That is, a constant!We could not recover the originalsignal from this!

Page 92: WAVELETS AND  FILTER BANKS

--2 2

1X( )

--2 2

1Aliasing)2(X

)2( X

- a high frequency component: overlaps the low frequency component:

2

.2

Page 93: WAVELETS AND  FILTER BANKS

FIRST FILTER THEN DOWNSAMPLE

--2 2

1X( )

--2 2

1

- /2 /2

--2 2

X( /2+ )X( /2)

1/2

X( )

IS FILTERED

2

-do not overlap

Page 94: WAVELETS AND  FILTER BANKS

--2 2

1

- /2 /2

X( )

--2 2

X( /2+ )X( /2)

1/2

)2()2(21)( XXV

- as can be seen, if the signal is filtered before downsampling, that is, is band limited, then the alias doesn’t overlap the original signal;- that is, the original signal can be recovered;

Page 95: WAVELETS AND  FILTER BANKS

-RECONSTRUCTION

- the output of the filtered and downsampled signal, is denoted by:)(Y )(V

- when we reconstruct a signal, first comes upsampling, then filtering;

- when we analyze a signal, first comes filtering, then downsampling;

Page 96: WAVELETS AND  FILTER BANKS

- in the time domain the upsampled signalis denoted by u and takes the form:

.0)12(

)()2()2(

ku

kvkuvu

- in the frequency domain this becomes simple, as only the even indices enter the sum:

).2(exp)(

exp)2(exp)()(

2

2

Vkv

kunuU

k

ik

k

ki

n

in

Page 97: WAVELETS AND  FILTER BANKS

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

x(n)

y(n) u(n)

y(n)=v(n)=x(2n)

u(2k)=v(k)u(2k+1)=0

- downsampling and upsampling (and filtering) in the time domain

Page 98: WAVELETS AND  FILTER BANKS

UPSAMPLING after DOWNSAMPLING- the analysis bank includes downsampling;- the synthesis bank includes upsampling;-the two operations:

.)2)(2(give)2(then)2( xuvuxv - in the frequency domain:

.)()(2

1)2()(

)2()2(21)(

XXVU

XXV

Page 99: WAVELETS AND  FILTER BANKS

--2 2

1

- /2 /2

X( )

--2 2

X( /2+ )X( /2)

1/2

V( ) =½ {X( /2) + X( /2+ )}

-

1/2X( ) X( + )

U( ) =V(2 ) =½ {X( ) + X( + )}

/2 /2

Page 100: WAVELETS AND  FILTER BANKS

AT RECONSTRUCTION:

u =( 2)v U( ) =V(2 ) =½ {X( ) + X( + )}

IMAGING: ONE INPUT – TWO OUTPUTS!

IF WAS FILTERED BEFORE ( 2):

--2 2

1

- /2 /2

X( )

--2 2

X( /2+ )X( /2)

1/2

V( ) =½ {X( /2) + X( /2+ )}

Page 101: WAVELETS AND  FILTER BANKS

-

1/2X( ) X( + )

U( ) =V(2 ) =½ {X( ) + X( + )}

/2 /2

THE OUTPUTS V( ) AND U( )FROM DOWNSAMPLING AND UPSAMPLING STILL CONTAIN THE ALIASING PART. BUT A NON-OVERLAPPING ALIAS CAN BE FILTERED AWAY.

Page 102: WAVELETS AND  FILTER BANKS

- SAMPLING OPERATIONS IN THE z-DOMAIN:

.)()(2

1)()(

)()(21)(

2

21

21

zXzXzVzU

zXzXzV

- denoting:

.)()(

exp

n

n

i

znxzX

z the Fourier transform

of x(n):

Page 103: WAVELETS AND  FILTER BANKS

Φ(t) = Φ(2t) + Φ(2t-1)

Φ(t) =2 h_0(k) Φ(2t-k)

w(t) =2 h_1(k) Φ(2t-k)

w(t) = Φ(2t) - Φ(2t-1)

SCALING FUNCTIONS AND WAVELETS

Then, for the Haar case we get:

Dilation eq. for the scaling function:

Wavelet eq.:

Page 104: WAVELETS AND  FILTER BANKS

Scaling Function - Haar coeff.: h0 , h1

0

1

1 0

1

1 2

0

1

1/20

1

1/2

1

Φ(t) Φ(t-1)

Φ(2t)

-Φ(2t-1)

Φ(t) = Φ(2t) + Φ(2t-1)

k=1

j=1

0

1

1/2

Φ(2t-1)

11

j=0

Page 105: WAVELETS AND  FILTER BANKS

0

1

1 2

Φ(t-1)

k=1j=0

1 2

0

1

1.5

Φ(2t-2)

11

1 2

0

1

1.5

Φ(2t-3)

1 2j=1 k=1

)32()22()1( ttt

2k=2;2k+1=3

Page 106: WAVELETS AND  FILTER BANKS

0

1

1/2

10

1

1/20

1

1/2

1

w(t) = Φ(2t) - Φ(2t-1)

0)2()( twtw 0)12()( twtw

w(t) w(2t) w(2t-1)

The Haar Wavelets

!!!That is, the Haar wavelet basis is an orthogonl basis.

Page 107: WAVELETS AND  FILTER BANKS

1 2

0

1

1.5

Φ(2t-2)

11

1 2

0

1

1.5

Φ(2t-3)

1 2j=1 k=1

0

1

21

w(t-1)

)32()22()1( tttw

Page 108: WAVELETS AND  FILTER BANKS

Averages (lowpass filter) - scaling coefficient:

)(2

112,2,,1 kjkjkj aaa

)(2

112,2,,1 kjkjkj aab

Differences (highpass filter) – wavelet coefficient:

Page 109: WAVELETS AND  FILTER BANKS

)()()( kktwtw

0)12()( twtw

)()()( kktt 1 if k=0

0 otherwise

Haar scaling functions and wavelets at the same scaling level (same j) do not overlap. They are orthogonal.

Page 110: WAVELETS AND  FILTER BANKS

wjk(x) = 2j/2w(2jx - k)

The rescaled Haar wavelets:

form an orthonormal basis:

).()()()( KkJjdttwtw JKjk

Page 111: WAVELETS AND  FILTER BANKS

N

k

ktkhtw0

1 )2()(2)(

N

k

ktkht0

0 )2()(2)(

Generally (for the Haar):

Page 112: WAVELETS AND  FILTER BANKS

N

k

ktkct0

)2()(2)(

Different forms of the scaling function or – DILATION EQUATION:

N

k

ktkht0

0 )2()(2)(

-with the original coeff.

- after downsampling

Page 113: WAVELETS AND  FILTER BANKS

The wavelet equation: (wavelets from filters)

N

k

ktkdtw0

)2()(2)(

N

k

ktkhtw0

1 )2()(2)(

Page 114: WAVELETS AND  FILTER BANKS

N

kjk ktkat

0

)2()()(

dttwtfb jkjk )()(

Analysis of a function

kj

jkjk twbtf,

)()(Synthesis of a function

Page 115: WAVELETS AND  FILTER BANKS

Perfect reconstruction:

- we will have causal filters only, i.e.: - at the output

- PR with delay;

- Perfect reconstruction means, that the synthesisbank is the inverse of the analysis bank;- in the Haar ex.:

the synthesis bank is the transpose of the analysis bank;

]1[][ˆ nxnx

TAAS 1

Page 116: WAVELETS AND  FILTER BANKS

- Two channel FB – Haar ex.:

are generally low_pass and high_pass filters, but they are not ideal;

)()( 10 zHandzH

0 2

2

)(1 H )(1 H)(0 H1

- Downsampling operation can produce aliasing;

- aliasing

Page 117: WAVELETS AND  FILTER BANKS

- if , that is the input has all frequencies,than: after downsampling, at the output of the low_pass channel we have:

1)( X

)}()()()({)( 22022021 XHXHV

)}()()()({)( 21

21

21

21

0021 zXzHzXzHzV

- in the z domain:

- where: )()( XzX

)()( 221 XzX

Page 118: WAVELETS AND  FILTER BANKS

- the goal is, to design the synthesis filters in such a way, that there is no aliasing;

- only an overall delay to be allowed;

.)()(2

1)2()(

)2()2(21)(

XXVU

XXV

.)()(

exp

n

n

i

znxzX

z

Page 119: WAVELETS AND  FILTER BANKS

--2 2

1

- /2 /2

X( )

--2 2

X( /2+ )X( /2)

1/2

V( ) =½ {X( /2) + X( /2+ )}

-

1/2X( ) X( + )

/2 /2

Page 120: WAVELETS AND  FILTER BANKS

L

H

2

2

F

G

2

2 =x(n-1)

x(n)

A Filter Bank is a set of filters, linked by sampling operators and delays.

Without ( 2) and ( 2) and delay, PERFECTRECONSTRUCTION would mean:

F (z)H (z) + F (z)H (z) = I (the identity matrix)0 1 10

Page 121: WAVELETS AND  FILTER BANKS

F (z)H (z) + F (z)H (z) =I z 0 1 10-l

Without ( 2) and ( 2) – with delay: l

We expect an overall delay z as every filter iscausal.Let’s follow the signal through the filter:

-l

Y( ) = ½ {X( /2) + X( /2 + )} = V( ) After upsampling:

U( ) =V(2 ) =½ {X( ) + X( + )}

Page 122: WAVELETS AND  FILTER BANKS

In the z domain: V( z ) = ½[X(z ) + X(-z )]After upsampling: ½[X(z) + X(-z) ]

1/21/2

So, at the output of the Lowpass filter we have:½[H (z)X(z) + H (-z)X(-z)]-the „-“ sign comes from: + which = -z

After filtering by the lowpass filter of the synthesis we have:½F (z)[H (z)X(z) + H (-z)X(-z)]0

00

0 0

U(z)=

Page 123: WAVELETS AND  FILTER BANKS

1½F (z)[H (z)X(z) + H (-z)X(-z)]

1 1

For the highpass part we get a similar rel.:

We find the output by adding up these two terms.

).()()()()(

)()()()()(

110021

110021

zXzHzFzHzF

zXzHzFzHzF

Page 124: WAVELETS AND  FILTER BANKS

½F (z)H (-z)X(-z)00 ½F (z)H (-z)X(-z)11+ =0

F (z)H (-z)00 F (z)H (-z)11+ =0

From where it results:

1.

The sampling operators introduced ALIASING:These are the last terms.ALIAS CANCELLATION CONDITION:

- For perfect reconstruction with a time delay l,the output must be:-that is, the “distortion term” must be the alias term must be zero.

).(zXz l

,lz

Page 125: WAVELETS AND  FILTER BANKS

If the alias cancellation eq. is fulfilled, then at the output we have:

½F (z)H (z)X(z) + ½F (z)H (z)X(z)00 11

To get PR, the output has to be: x(n-l) which in the z is: X(z) = z X(z) -l

-l

It results:½[F (z)H (z)+F (z)H (z)]X(z)0 0 1 1 =z X(z)Finally, the NO DISTORTION CONDITION:

-lF (z)H (z)+F (z)H (z)0 0 1 1 =2z 2.

Page 126: WAVELETS AND  FILTER BANKS

The „extra 2“ is the result of that, that we built up the FB from 2 filters.

These two conditions, in matrix form:

=F (z) F (z) 0

0 0

1

1 1

H (z) H (-z)

H (z) H (-z)2z 0-l

The question is: how to design filters that meetthese conditions?There are many ways!One of them: to determine some of the filtersfrom the others!

Page 127: WAVELETS AND  FILTER BANKS

From the Alias Cancellation cond. we choose:

F (z) = H (-z) and F (z) = - H (-z)11 00

Define the product filter: P (z) = F (z) H (z)and P (z) = F (z) H (z)

00

11

0

1

P (z) it is: lowpass filter product,P (z) highpass filter product

1

0

Page 128: WAVELETS AND  FILTER BANKS

- from the alias cancellation condition results:

)()()()()()( 000101 zPzFzHzHzHzP

Then, the No Distortion cond.:

F (z)H (z)+F (z)H (z)0 0 1 1 F (z)H (z)-F (z)H (-z)0 0 0 0= =

.2)()( 00lzzPzP

(cond. on odd powers)!!!

Page 129: WAVELETS AND  FILTER BANKS

-l=2z P (z) – P (-z) 00

Example:

a, b, c

-a, b, -cp, q, r, s, t

p, -q, r, -s, tH

H 1

0

1

1

0

0F (z) = H (-z)

F (z) = - H (-z)

2.

STEPS: - Design a lowpass prod. Filter which satisfies eq. 2. - Factor P into F and H . Then find F and H .1

00

1

0

Page 130: WAVELETS AND  FILTER BANKS

F (z)H (-z)00 F (z)H (-z)11+ =0 1.

-lF (z)H (z)+F (z)H (z)0 0 1 1 =2z 2.

P (z) = F (z) H (z)

P (z) = F (z) H (z)00 0

1 1 1

F (z) = H (-z) and F (z) = - H (-z)11 00

-l=2z P (z) – P (-z) 002. – (4.9)

Page 131: WAVELETS AND  FILTER BANKS

- There are many ways to design P in step 1. and there are many ways to factor it in step 2.

-The length of P determines the sum of the length of F and H .

0

0

0

0

IMPORTANT: EQ. 2. IS A CONDITION ON THE ODD POWERS!Those odd powers MUST HAVE coefficient zeroexcept z .-l Which has coefficient one.

Eq. 2. can be made a little more convenient.The left side is an odd function, so l is odd!

Page 132: WAVELETS AND  FILTER BANKS

Normalize P (z) by z to center it:The normalized product filter is P(z) = z P (z).

l0

0

l

THE PERFECT RECONSTRUCTIONCONDITION THEN:

P(z) + P(-z) =2

Or: +P( ) + P( ) =2

3.

4.

P(-z)=(-z) P (-z) = -z P (-z)l l

0 0

- cond. on the even power

Page 133: WAVELETS AND  FILTER BANKS

FILTER BANKS – PERFECT RECONSTRUCTION

From 3. and 4. it results that:

P(z) must be „halfband filter“!

That is, all even powers in P(z) are zero, except the constant term, z which is 1!0

The odd powers cancel, when P(z) combines with P(-z).

Page 134: WAVELETS AND  FILTER BANKS

In practice, many times we first determine:

Ex.:

a, b, c, d

-a, b, -c, dd, -c, b, -a

d,c,b,aH

H 1

0

1

1

0

0F (z) = H (-z)

F (z) = - H (-z)

Order flip

Alternating flip Alternating sign

H 0 H 1

and

Page 135: WAVELETS AND  FILTER BANKS

Example:

)()1()( 410 zQzzP

We have to choose the polynomial )(zQin such a way to satisfy PR condition. That is, the odd powers must have coefficientzero, except

lz has coefficient one.

A possible choice for :)(zQ2141)( zzzQ

Page 136: WAVELETS AND  FILTER BANKS

Results:

).91691(16

1)(

)41()1()(

64320

21410

zzzzzP

zzzzP

- it results:3

00 2)()( zzPzP

Page 137: WAVELETS AND  FILTER BANKS

The central term is: lzz 3

The centering operation gives P(z):

)()( 03 zPzzP

).9169(16

1)( 313 zzzzzP

Page 138: WAVELETS AND  FILTER BANKS

This is halfband: the only term with even power is 0z with coefficient 1. So, the PR

condition is verified. The odd powers cancel in the sum.

- that is: 2)()( zPzP

- in the frequency domain:

2)()( PP

- halfband condition;

Page 139: WAVELETS AND  FILTER BANKS

300 2)()( zzPzP

2)()( zPzP

- condition on the odd powers;

- condition on the even powers;

Page 140: WAVELETS AND  FILTER BANKS

- How to factor - There are a variety of factorizations in:

)()()( 000 zFzHzP

?)(0 zP

- the polinomial – prewious ex., has 6 roots. - the 2 roots from Q(z) are:

- the other 4 roots are at: z=-1.

32z

)(0 zP

Page 141: WAVELETS AND  FILTER BANKS

Ex.: 21)1( z ).21(4/1)( 21

0 zzzF

Then H0 : )2621(4/1)( 43210

zzzzzH

- note: 32

132

z=-1

-4th orderzero;

1

32

32

Re

Im

Page 142: WAVELETS AND  FILTER BANKS

z=-1

-2nd orderzero;

132

Re

Im

1

32

-2nd orderzero;

-1

- filter length =3¼ {1,2,1}

- filter length =5¼ {-1,2,6,2,-1}

- symmetric filters, (linear phase);

Page 143: WAVELETS AND  FILTER BANKS

1

32

-1 1-1

-2nd orderzero;

32

-2nd orderzero;

Orthogonal filters; (min. phase/max. phase)

- filter length =4 - filter length =4

31,33,33,3124

1

31,33,33,3124

1

Page 144: WAVELETS AND  FILTER BANKS

- in this case one filter is the transpose of the other;

- in the time domain:

- in the z domain:]3[][ 00 nhnf

)()( 10

30

zHzzF

- the Haar filter bank: )1()( 1

21

0 zzH

)1()( 1

21

1 zzH

Page 145: WAVELETS AND  FILTER BANKS

)1()()( 1

21

10 zzHzF

)1()()( 1

21

01 zzHzF

1

212121

21

00

2

)21()21(

)()(

z

zzzz

zPzP

- from the alias cancellation cond.:

- the product filter:

- the perfect reconstruction cond.:

2121

000 )1()()()( zzHzFzP

Page 146: WAVELETS AND  FILTER BANKS

)1)(1()()( 121

01 zzzPzzP

z=-1

-2nd orderzero;

1Re

Im

- zeros of P(z):

01

011

z

z

Page 147: WAVELETS AND  FILTER BANKS

Orthonormal Filter Banks

C

D

2

2

C

D

2

2 =x(n-1)

x(n)

T

T

Page 148: WAVELETS AND  FILTER BANKS

L

B

ORTHOGONALITY CONDITION orCONDITION „O“

=

c(3) c(2) c(1) c(0) 0 0 0 . 0 0 c(3) c(2) c(1) c(0) 0 . ..... d(3) d(2) d(1) d(0) 0 0 0 0 d(3) d(2) d(1) d(0) 0.....

Page 149: WAVELETS AND  FILTER BANKS

L B =

c(3) 0 . d(3) 0 c(2) 0 . d(2) 0 c(1) c(3) . d(1) d(3) c(0) c(2) . d(0) d(2) . c(1) . 0 d(1) . c(0) . 0 d(0)

T T

Page 150: WAVELETS AND  FILTER BANKS

PR condition – for orthogonal filter banks.

TLB

=L B

T I 0

0 I

It results:

LL = I :

LB = 0 :

BB = I :

T

T

T

c(n)c(n-k) = (k)

c(n)d(n-k) = 0

d(n)d(n-k) = (k)

Page 151: WAVELETS AND  FILTER BANKS

This condition above, is called Cond. O or double shift orthogonality.

c(0) +c(1) + c(2) + c(3) = 1and c(0)c(2) + c(1)c(3) = 0

2222

- Cond. O, imposes two constraints on four coeff.- For the high_pass coeff. similar relations hold.

Page 152: WAVELETS AND  FILTER BANKS

- From these cond. results:

THE FILTER LENGTH CANNOT BE ODD!!! (Example!!!)

d(0) +d(1) + d(2) + d(3) = 1and d(0)d(2) + d(1)d(3) = 0

2222

Page 153: WAVELETS AND  FILTER BANKS

If the filter length would be odd (N+1),then:

L

B=

c(4) c(3) c(2) c(1) c(0) 0 0 0 0 0 0 0 0 c(4) c(3) c(2) c(1) c(0) 0 0 0 0 0 0 0 0 c(4) c(3) c(2) c(1) c(0) 0 0 0 0 0 0 0 0 c(4) c(3) c(2) c(1) c(0) ..... d(4) d(3) d(2) d(1) d(0) 0 0 0 0 0 d(3) d(2) d(1) d(0) 0 0.....

Page 154: WAVELETS AND  FILTER BANKS

For the orthogonality cond.:

c(4)*0+c(3)*0+c(2)*0+c(1)*0+c(0)*c(4)=0

which would mean: c(0)*c(4)=0 !!!

That is: N cannot be even, so the length ofthe Filter cannot be odd!!!

Page 155: WAVELETS AND  FILTER BANKS

The PR, or halfband cond., or Cond. OFor the filters in the frequency and z Domain:

|C(z)| + |C(-z)| = 2

+|C( )| + |C( )| =22 2

22

iez -where :

Page 156: WAVELETS AND  FILTER BANKS

|D(z)| + |D(-z)| = 2

+|D( )| + |D( )| =22 2

22

The highpass filter coeff. can be expressedby the lowpass filter coeff.:

d(k)=(-1) c(N-k) k

Which is the alternating flip.

Page 157: WAVELETS AND  FILTER BANKS

L

B=

c(3) c(2) c(1) c(0) 0 0 0 . 0 0 c(3) c(2) c(1) c(0) 0 . ..... -c(0) c(1) -c(2) c(3) 0 0 0 0 -c(0) c(1) -c(2) c(3) 0.....

The alt. flip cond. for the filters:

D(z)=(-z) C(-z ) where z=e -N -1 i

- In reality because of time reversal there is a change in sign: c(0), -c(1)...

Page 158: WAVELETS AND  FILTER BANKS

It results, that the main problem is, to design the lowpass filter C!!!

It would be ideal to have:- symmetric- orthogonal filters

But: this is possible only in the Haar case!

Page 159: WAVELETS AND  FILTER BANKS

Let us denote: P( ) = |C( )| 2

Power Spectral Response it is an autocorrelation function:> 0 = C( ) C( )

That is, C( ) or C(z) is a spectral component of a HALFBAND FILTER!

It is real and nonnegative.

A similar relation holds for P( ) =|D( )|12

Page 160: WAVELETS AND  FILTER BANKS

N

N

Nik

Nikin ekcekcenpP ))()()(()()(

00

This is a real and nonnegative filter: p(n)=p(-n)Or: )()()( nkckcnp

That is, p(n) is the autocorrelation of the coeff. c(k).That is, P is symmetric, it is the autocorrelationfilter.

Page 161: WAVELETS AND  FILTER BANKS

-C is the start of an orthogonal filter bank if andonly if the autocorrelation filter, P is a HALFBAND FILTER!

- in the z domain the halfband filter cond.:

P(z)+P(-z)=2 - from where it results:

.00

01)2()()(

mif

mifmkckcmp

Page 162: WAVELETS AND  FILTER BANKS

Example:

P( ) = 1 + cos

Or, in the z domain:

P(z) = 1+ z + z 2

-1

This is never negative!The PR cond. is satisfied

P( ) =|C( )| = (1+ e )(1+e ) /2 =1+cos

i-i

The requirement P( ) > 0 is crucial!

2

Page 163: WAVELETS AND  FILTER BANKS

That is:

2cos1cos1

)()(

zPzP

Is a halfband filter.

It is positive and =0 when or z=-1;When as well.

0)( C

Page 164: WAVELETS AND  FILTER BANKS

- for it results:)(C

.2/)1()( ieC

- the coefficients come from the familiar averaging filter:

.2/1)1()0( cc

Page 165: WAVELETS AND  FILTER BANKS

Another example: the famous Daubechies Orthogonal filter.

P( ) = ( 1+ cos ) (1- ½ cos )=2

Has a double zero at = - If we would keep the first term only – the square of the previous ex., - they would lead to the hat function. - This would not yield a halfband filter.

32 cos21cos231)cos211)(coscos21(

Page 166: WAVELETS AND  FILTER BANKS

- In the z-domain we are squaring:

)(1 12

1 zz

which produces the even power:term.

22 orz

- This is not halfband!Daubechies extra factor must be included to cancelthis term.

)(1)(

cos1)(1

41

21

zzzQ

Q

Page 167: WAVELETS AND  FILTER BANKS

In the z domain:P(z) =1/16[ -z + 9z +16 + 9z -z ]-3-113

From where:C(z)=1/4 2[(1+ 3)+(3+ 3)z +(3- 3)z +(1- 3)z ]-3-2-1

- Thanks to this factor, we got a halfband filter.In the z-domain is missing.2z

)(411*)()(411

)](411[)](211[)(1121

121

zzzzzz

zzzzzP

Page 168: WAVELETS AND  FILTER BANKS

1

32

-1 1-1

-2nd orderzero;

32

-2nd orderzero;

Orthogonal filters; (min. phase/max. phase)

- filter length =4 - filter length =4

31,33,33,3124

1

31,33,33,3124

1

Page 169: WAVELETS AND  FILTER BANKS

- These are the 4 coeff. of the famous Daubechiesfilter D4.

1.- The halfband filter has P(z)+P(-z)=2.The factor C(z) goes into an orthonormal filter bank. D(z) comes from C(z) by an alternating flip.

2. – The response C(z) has a double zero at z=-1.In the frequency domain C( ) has a double Zero at = .The response is flat at because of (1+cos ) .

2

Page 170: WAVELETS AND  FILTER BANKS

1

2 |P( )|

|C( )|

P( /2) =1

Page 171: WAVELETS AND  FILTER BANKS

Spectral Factorization:

- Two questions arise immediately:- can every polynomial with

be factored into

- how can this spectral factorization be done?

- The answer to the first question is: YES,Féjer-Riesz Theorem;

- The answer to the second question is not so easy;-- there are different methods;

0)( P

?)(2C

Page 172: WAVELETS AND  FILTER BANKS

- real coeff. ensure that the complex conjugate is a root when z is a root;- the complex roots of the unit circle come 4 at a time;

z

- Method A: - zeros of a polynomial- with real symmetric coeff. p(n), we have

- If

-When is inside the unit circle, is outside.- The roots on the unit circle must have even multiplicity.

)/1()( zPzP

./1__,__ ii zissorootaisz

iz iz1

Page 173: WAVELETS AND  FILTER BANKS

- to get real filters, z and must stay together;

- to get orthogonal filters z and must goseparately:

- this is the spectral factorization C(z)C( );

z

iz1

iz1

Page 174: WAVELETS AND  FILTER BANKS

MAXFLAT (DAUBECHIES) FILTERS

- these filters (and wavelets) are orthogonal - the frequency responses have maximum flatness at = 0 and = - the highpass coefficients come from the lowpass by alternating flip.

Condition „O“ for a maxflat filter:

is a normalized halfband filter;

- that is: p(0)=1 and p(2)=p(4)=...=0

2)(CP

Page 175: WAVELETS AND  FILTER BANKS

Condition Ap :

C( ) has a zero of order p at: that is:

.0)(...)()()( )1( pCCCC

- The eq.: says that 0)( C .0)1)(( nnc

,

Page 176: WAVELETS AND  FILTER BANKS

- That is, the odd-numbered coefficients havethe same sum as the even-numbered coeff.:

nodd neven

ncnc_ _

).()(

Cond. A1 on c(n):

Page 177: WAVELETS AND  FILTER BANKS

- Cond. Ap on c(n):

12

0

0)()1(p

n

kn ncn

for k=0,1,...,p-1.- factor comes from the k-th derivative of

- comes from substituting

- Because: P also vanisheswhen

kn.)( inenc

n)1( . ,)()(

2 CP .

Page 178: WAVELETS AND  FILTER BANKS

The odd sum must be 1, since the only nonzero even-numbered coeff. is p(0)=1:

nodd neven

pnpnp_ _

.1)0()()(

The sum over all n is P(0)=2. This yields:

2)0( C so the DC term at 0is not reversed in sign.

Page 179: WAVELETS AND  FILTER BANKS

The p zeros at mean that has a factor

)(Cpie )1(

Condition Ap on :)(C

).(2

1)(

Re

Cpi

From where it results, that has a factor:

)(P.

2

cos1p

Page 180: WAVELETS AND  FILTER BANKS

1+cos 2

p p+k-1 k

1-cos 2

kk

Example:

P( )=2( ) ( )( ).

How to design Maxflat Filters:-The coeff. of the H_P Filter come fromthe L_P Filter coeff. by Alternating-Flip.The degree of the product Filter P is: 2N=4p-2

)(2

1)( 22

21

0 zQz

zP p

p

Page 181: WAVELETS AND  FILTER BANKS

- Let us take the binomial series: truncated after p terms:

py )1(

).()1(

1

22...

2

)1(1)( 12

pp

pp

yOy

yp

py

pppyyB

- the remainder O, has order because this is the first term to be dropped.

py

Page 182: WAVELETS AND  FILTER BANKS

).(2

)]()1[()1(2)()1(2)(~

p

pppp

p

yO

yOyyyByyP

py)1( -we combine B(y) with the factor: that has p zeros at y=1.- the variable y on [0,1] will correspond to the frequency on ].,0[

- this product has exactly the flatness we want at y=0.

Page 183: WAVELETS AND  FILTER BANKS

- It is a polinomial of degree 2p-1, with 2p coeff.,and satisfies p cond. at each endpoint:

- it’s first p-1 derivatives are zero aty=0 and y=1, except .2)0(

~ P

- if we go from ordinary polinomials in y to trigonometric polinomials in the change from into is:

10 y 0

2

cos11

2

cos1

y

y

Page 184: WAVELETS AND  FILTER BANKS

Then, we get:

.2

cos11

2

cos12)(

1

0

p

k

kp

k

kpP

- In the z-domain: .2

cos211

zz

y

.2

1

2

11

2

1

2

12)(

1

0

11

p

k

kkppzz

k

kpzzzP

Page 185: WAVELETS AND  FILTER BANKS
Page 186: WAVELETS AND  FILTER BANKS
Page 187: WAVELETS AND  FILTER BANKS

0 50 100 150 200 250 300-2

0

2

0 50 100 150 200 250 300-2

0

2

0 50 100 150 200 250 300-2

0

2

0 50 100 150 200 250 300-2

0

2

Some columns (163,...) of S: Some basis vectors: wavelets

Page 188: WAVELETS AND  FILTER BANKS

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

Rows 2,4,6,129,131,133 of the Analysis Matrix: Lev 1

Daubechies – orthogonal wavelets

Page 189: WAVELETS AND  FILTER BANKS

Wrap around – 3. (row:127);4. (row:128)

Page 190: WAVELETS AND  FILTER BANKS

Biorthogonal PR:Theorem: In a biorthogonal linear-phase FilterBank with two channels, the filter lengths areall odd or all even! The analysis filter can bea) – both symmetric of odd length;b) - one symmetric and the other antisymmetric of even length.

Page 191: WAVELETS AND  FILTER BANKS

How to design orthogonal or biorthogonalfilters? - to have real valued filters: z and z MUST stay together; - for biorthogonal filters: z and z MUST stay together; - for orthogonal filter: z and z MUST go into different filters; this gives C(z)C(z )

-1

-1

-for an orthogonal FB, the filter length cannotbe odd!!!

Page 192: WAVELETS AND  FILTER BANKS

The space L2

Definition: For an interval the space is the set of all squareintegrable functions defined on In other words,

,bta ]),([2 baL

.bta

.)(;],[:]),([22

b

a

dttfCbafbaL

Page 193: WAVELETS AND  FILTER BANKS

-funcions that are discontinuous are allowed as members of this space;- all the ex. used are or cont., or discontinuous at a finite set of points;

- the condition:

physically means that the total energy of the signal is finite;

b

a

dttf2

)(

Page 194: WAVELETS AND  FILTER BANKS

]),([2 baL- the space is infinite dimensional;- ex.:if a=0 and b=1, then the set of functions {1, t, t2, t3, ...}is linearly independent and belongs to

- the function f(t)=1/t is an ex. of a function that does not belong to since:

])1,0([2L

])1,0([2L

.)/1(1

0

2 dtt

Page 195: WAVELETS AND  FILTER BANKS

L2 Inner Product:

Definition: The L2 inner product onis defined as

]),([2 baL

b

aLbaLgffordttgtfgf ]).,([,)()(, 2

2

- remember: for two vectors, X=(x1,x2,x3), andY=(y1,y2,y3) in R3, the standard (Euclidian)inner product of X and Y is defined as

., 332211 yxyxyxYX

Page 196: WAVELETS AND  FILTER BANKS

Multiresolution Analysis- recall that: the sampling theorem approximatelyreconstructs a signal f from samples taken uniformly at intervals of length T. - if the signal is band limited and its Nyquistfrequency is less than 1/T , then the reconstructionis perfect;- the smaller T is, the better we can approximate or resolve the signal;- the size of T measures our resolution of the signal f.

Page 197: WAVELETS AND  FILTER BANKS

- A typical FFT analysis of the samples taken from f works at one resolution T.- if the signal has bursts where it varies rapidlywith periods where it is slowly varying, this single resolution analysis does not work well;- to solve this problem:

- replace the space of band limited functionswith one tailored to the signal;

- analyze the signal using the scaled versions of the same space, at resolutions T/2, and so on;- Hence the term multiresolution analysis.

22/T

Page 198: WAVELETS AND  FILTER BANKS

DEFINITION: Let , j= ..., -2,-1,0,1,2,3,...be a sequence of subspaces of functions in The collection of subspaces is called a multiresolution analysis with scalingfunction if the following conditions hold:

jV).(2 RL

ZjV j ,

1. (nested) 2. (density) 3. (separation) 4. (scaling) The function f(x) belongs to if and only if the function belongs to

1 jj VV)(2 RLV j

0jVjV

)2( xf j

.0V

Page 199: WAVELETS AND  FILTER BANKS

5. (orthonormal basis) The function belongs to and the set is an orthonormal basis (using the inner product) for

0V Zkkx ),(

2L.0V

- there may be several choices of corresponding to a system of approximationspaces;- different choices for may yield different multiresolution analysis;- don’t have to be orthonormal;

Page 200: WAVELETS AND  FILTER BANKS

- all that is needed is a for which the set is a basis.

Zkkx ),(

-the most useful class of scaling functions are those that have compact or finite support;- the Haar scaling function is a good example of a compactly supported function;- the scaling functions associated with Daubechie’s wavelets are not only compactly supported, but also continuous;

Page 201: WAVELETS AND  FILTER BANKS

- the two sharp spikes: noise- the signal can be approximated using Haar building blocks;

Page 202: WAVELETS AND  FILTER BANKS

Haar Decomposition and ReconstructionAlgorithms

- DecompositionDefinition:Suppose, j is any nonnegative integer. The spaceof step functions at level j, denoted by is defined to be the space spanned by the set:

jV

)22(),12(),2(),12( xxxx jjjj

over the real numbers.

Page 203: WAVELETS AND  FILTER BANKS

is the space of piecewise constant functions of finite support whose discontinuities are contained in the set:

jV

,...2/3,2/2,2/1,0,2/1..., jjjj- a function in is a piecewise constant function with discontinuities contained in the set of integers;

0V

,...2/3,2/2,2/1,0,2/1..., 0000

Page 204: WAVELETS AND  FILTER BANKS

-any function in is also contained in which consists of piecewise const. fun. whose discont. are contained in a set of half integers

0V 1V

,...2/3,1,2/1,0,2/1...,

Page 205: WAVELETS AND  FILTER BANKS

- the same applies for and 1V .: 212 VVV

.11210 jjj VVVVVV

- this containment is strict;- for ex. the fun. belongs to but does not belong to - since is discont.at x=1/2.

)2( x 1V0V )2( x

Page 206: WAVELETS AND  FILTER BANKS

0 1-1 2 3 4

0a

4a

3a

2a

1a

1a

x

y

Graph of typical element in .0V0VA fun. in may not have disc. if for ex. 21 aa

Page 207: WAVELETS AND  FILTER BANKS

1

1/2

Graph of )2( x

-The graph of the function:

)32()22(2

)12(2)2(4)(

xx

xxxf

4

1 2 3

-1

Page 208: WAVELETS AND  FILTER BANKS

jV- contains all relevant information up to a resolution scale of order - as j gets larger, the resolution gets finer;- One way to decompose a signal efficiently is to construct an orthonormal basis for

- is generated by and its translates andhave unit norm in that is:

.2 j

.jV

0V ;2L

1

2211)()( 2

k

kL

dxdxkxkx

Page 209: WAVELETS AND  FILTER BANKS

- if j is different from k then:

0)()()(),( 2 dxkxjxkxjxL

kj

- so the set is an orthonormal basis for

Zkkx ),(.0V

Page 210: WAVELETS AND  FILTER BANKS

- the idea is to decompose as an orthogonal sum of and its complement;- if j=1, the orthogonal complement of in is generated by the translates of some function

1jV0V

1V ;

jV

Page 211: WAVELETS AND  FILTER BANKS

1. - is a member of and so can be expressed as: for somechoice of (And only a finitenumber of the al are nonzero.)

2. - is orthogonal to V0. This is equivalent to for all integers k.

1V

l l lxax )2()( .Ral

0)()( dxkxx

Page 212: WAVELETS AND  FILTER BANKS

.0)()(

dxxx

- the first requirement means that is built from blocks of width ½.- the second requirement with k=0 implies:

- the smallest satisfying both of these requirements is the function whose graph is:

Page 213: WAVELETS AND  FILTER BANKS

1

1/2

1

-1

- This graph consists of two blocks of width one-half and can be written as:

)12()2()( xxx - satisfying the first requirement.- in addition:

.011)()(21

0

1

21

dxdxdxxx

Page 214: WAVELETS AND  FILTER BANKS

- thus, is orthogonal to - If then the support of and the support of do not overlap, so:

.,0k )(x

)( kx

.0)()( dxkxx

- therefore, belongs to and is orthogonal to 1V .0V

Page 215: WAVELETS AND  FILTER BANKS

MULTIRESOLUTION:- wavelets produce a natural multi- resolution of every image;- coarser and coarser approx. of func. f(t); - averaging for bigger and bigger int.

THE SMOOTH SIGNAL at one level + DETILS at the same level:

COMBINE INTO A MULTI-RESOLUTION at the next FINER LEVEL

Page 216: WAVELETS AND  FILTER BANKS

))

) 11

(xw(x)b(x)(xa

(x)(xa

jkk

jkjkk

jk

kjk

kj

coarse aver. at lev. j + details at lev. j (wave. coef.)

= signal at the finer level j-1

Page 217: WAVELETS AND  FILTER BANKS

dx(x)xfa jkjk )(

dttwtfb jkjk )()(

Where:

Page 218: WAVELETS AND  FILTER BANKS

x=a (t) =a (t) + b w (t) = =a (t) + b w (t)+ b w (t) = = a (t) + b w (t)+ b w (t) +b w (t)

3k3k

2k

2k2k2k 2k

2k

1k

1k1k1k 1k

1k0k 2k2k0k 0k 0k

V0

V2 W2

W0 W1 W2

Page 219: WAVELETS AND  FILTER BANKS

Some Applications:

- ECG Analysis (Laszlo, Schipp);

- Construction of Haar-like systems (Laszlo, Schipp);

- Storage, compression, reconstruction... (László);

- Fusion (Kozaitis, László) etc. - Edge detection from a noisy image

(Kozaitis)

Page 220: WAVELETS AND  FILTER BANKS
Page 221: WAVELETS AND  FILTER BANKS

h1(x) = (-1)n h0(N - n), f0(n) = h0(N - n), Orthogonal case

f1(n) = (-1)n+1 h0(n),

Page 222: WAVELETS AND  FILTER BANKS

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

0 2 4 6 8 10 12 14 16 18 20-2

0

2

Rows 2,4,6,129,131,133 of the Analysis Matrix: Lev 1

Page 223: WAVELETS AND  FILTER BANKS

0 50 100 150 200 250 300-1

0

1

0 50 100 150 200 250 300-1

0

1

0 50 100 150 200 250 300-1

0

1

0 50 100 150 200 250 300-1

0

1

Some rows (101...) of A: Some basis vectors: wavelets

Page 224: WAVELETS AND  FILTER BANKS

0 50 100 150 200 250 300-2

0

2

0 50 100 150 200 250 300-2

0

2

0 50 100 150 200 250 300-2

0

2

0 50 100 150 200 250 300-2

0

2

Some columns (163,...) of S: Some basis vectors: wavelets

Page 225: WAVELETS AND  FILTER BANKS

Part1: Level 4 WT

50 100 150 200 250

50

100

150

200

250

Part1: Level 3 WT

50 100 150 200 250

50

100

150

200

250

Part1: Level 2 WT

50 100 150 200 250

50

100

150

200

250

Part1: Level 1 WT

50 100 150 200 250

50

100

150

200

250

Page 226: WAVELETS AND  FILTER BANKS

WT WT

bh1

bh2

b1v

b2v

bh3 b3v

horizontal edge vertical edgeinput image

threshold

edge location filter

modulusedge result

b4vbh4

M

Mv

Mh

WcvWch

inverted result

Wh Wv

X

X

Page 227: WAVELETS AND  FILTER BANKS
Page 228: WAVELETS AND  FILTER BANKS

1. HWDesign a Filter Bank (FB) with two channels,Lowpass (LP) and Highpass (HP) using the Haarcoefficients: - for LP: h(0)=1/2 and h(1)=1/2but because of downsampling you put in: 2/2!

- for HP: h(0)=1/2 and h(1)= - 2/2Build up 8 levels!!!Show: - by putting on the same figure 5 neighbouring rows, show the wavelets at least at 3 different Levels! Mandatory: the finest level and the coarsest level

Page 229: WAVELETS AND  FILTER BANKS

- the first (10-12) rows and columns of the (colored picture) analysis matrix A=A8*A7*...A1 - represent (colored picture) the coefficients; show that the lowpass and highpass coefficients are at the right place –at least for two different levels - put in a signal in the time domain (for ex. at the finest level) and show that your FB performs perfect reconstruction; (first one signal at the finest level, then 2 and 3 at the same level; then show this at least at one more level.) - show that the wavelets and the scaling functions as well are the same in the synthesis matrix as in the analysis matrix;

Page 230: WAVELETS AND  FILTER BANKS

Extra: - put in 3 signals into the wavelet domain at 3 consecutive places(this is done in the same way as when you put in in the time domain, the difference is that then you will multiply by the synthesis matrix and not by the analysis matrix)and show the effect of the downsampling;-once at the finest level, then on another two levels;

Page 231: WAVELETS AND  FILTER BANKS

clcclear

x = zeros(size(1:256));x(150) = 1;x = x';[row col]=size(x);r=1/sqrt(2);

S=A'; % synthesis matrix

figure subplot(5,1,1) plot(A(1,:),'m');

figure imagesc(A6(1:10,1:10)) colorbar

Page 232: WAVELETS AND  FILTER BANKS

A signal

256

128

6432

Finest scale

Coarser level

Even coarser16

Page 233: WAVELETS AND  FILTER BANKS

HW_2.Maxflat Filter design:Write a program to compute and plot the magnitude of the frequency response for the maxflat filters for p= 3, 5, 7, 9, 11.Verify the filters are halfband (take the IFT).

1

0

.2

cos11

2

cos1)(

p

k

kpi

k

kpeH

Page 234: WAVELETS AND  FILTER BANKS

HW_2: Part II. Orthogonal FiltersGiven eq.:

.3133333124

1

3131124

1)(

321

121

zzz

zzzC

You have the filter coeff. That produce a wavelet.Graph both its impulse, and magnitude of the frequency response.Generate the orthogonal high-pass filter using

Page 235: WAVELETS AND  FILTER BANKS

the alternating-flip method and plot its impulse and magnitude of the frequency response as well as the Power Spectral Response.Help: IFFT_C=real(fftshift(ifft(C)))

Page 236: WAVELETS AND  FILTER BANKS

3. HWDesign a biorthogonal Filter Bank (FB) with two channels, Lowpass (LP) and Highpass (HP) using the coefficients of the polinomial:

P=[3 0 -25 0 150 256 150 0 -25 0 3];

Except of the effect of the downsampling, show all those, you had to in the first HW. (This part is considered as the second homework.)Then, draw a picture in black-and-white to see theHorizontal, vertical and diagonal components in the Wavelet domain.

Page 237: WAVELETS AND  FILTER BANKS

Then, take a nice picture you‘d like and show itsTransforms in the wavelet domainAt each (4 )level!!!Show at the reconstruction as well at each level.So, this time you need to build up 4 levels only!!!Show the reconstruction of the picture.

Page 238: WAVELETS AND  FILTER BANKS

clearclcformat long e

p=[-1 0 9 16 9 0 -1]Roots = roots(p)

% Po(z) = Fo(z)*Ho(z)% Filter bank 1:BIORTHOGONAL The roots c and 1/c are in the same polinomial% This gives a linear phase filter bank (bi-orthogonal).% Roots are 3.7321, .2679, -1 in one filter and -1 -1 -1 in the other%a=[-1 3.7321 .2679];

Page 239: WAVELETS AND  FILTER BANKS

b=[-1 -1 -1];

Ho_B=poly(b) % 1 3 3 1Fo_B=real(deconv(p,Ho_B)) % -1 3 3 -1

Page 240: WAVELETS AND  FILTER BANKS

% Filter bank 2: ORTHOGONAL The roots c and 1/c are in different polynomials. This gives an % orthogonal filter bank.% Roots .2679, -1, -1 in one filter and -1 -1 3.7327 in the othera2=[-1 -1 .2679];b2=[-1 -1 3.7327];

Ho_O = poly(b2) % 1 -1.7327 -6.4654 -3.7327Fo_O=real(deconv(p,Ho_O)) % -1 -1.7327 -0.46764 0.2544

Page 241: WAVELETS AND  FILTER BANKS

z=[Roots_P(1,1) Roots_P(2,1) Roots_P(3,1) Roots_P(4,1) Roots_P(10,1)];

Fo_B=poly(z) Ho_B =real(deconv(P,Fo_B))

% Create synthesis matrix for each level S_Lev1 = pinv(A1);

P=[3 0 -25 0 150 256 150 0 -25 0 3]; % the coefficients of the polinomialRoots_P = roots(P)

Page 242: WAVELETS AND  FILTER BANKS

inputimage_orig = imread('c:\MATLAB6p1\Project\f3.bmp','bmp');inputimage=double(inputimage_orig(140:395,170:425)); %for the box2: (140:395,120:375); [r,c]=size(inputimage); figure imagesc(inputimage) title('original image') colormap(gray)

The name of the picture used, ex.: f3.bmp

Page 243: WAVELETS AND  FILTER BANKS

h1(n) = (-1)n f0(n), Biorthogonal case

f1(n) = (-1)n+1 h0(n)

Perfect Reconstruction cond.: - PR

Alias cancellation:F0(z)H0(-z)+F1(z)H1(-z)=0

No distortion:F0(z)H0(z)+F1(z)H1(z)=2z-l

Page 244: WAVELETS AND  FILTER BANKS

Perfect Reconstruction cond.:

P(z)+ P(-z)=2(PR cond. In the z domain)

Where: z= eiω

Next slides: - ex. of scaling functions and wavelets

Page 245: WAVELETS AND  FILTER BANKS

j=1, k=0

j=1, k=5

j=2, k=0

j=2, k=5

Page 246: WAVELETS AND  FILTER BANKS

Command: - sort - coef. in the matrix

- ex.: using a compression 16:1 more then 61.000 coef. could be set to zero – from the total 65.436 !!!

Page 247: WAVELETS AND  FILTER BANKS