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

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

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

WAVELETS AND FILTER BANKS

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

HUNGARY [email protected]

NEWER VERSION BUT STILL NEEDSIMPROOVMENTS AND CORRECTIONS!!!

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.

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

Some rows (10...) of A4:

50 150 200100 250

50 150 200100 250

50 150 200100 250

Some rows (10...) of A3:

50 150 200100 250

50 150 200100 250

50 150 200100 250

Some rows (22...) of A4:

50 150 200100 250

50 150 200100 250

50 150 200100 250

Some rows (48...) of A3:

50 150 200100 250

50 150 200100 250

50 150 200100 250

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?

- 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)

-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

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:

-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.

- 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

, .

- 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

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;

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

- 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;

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

- 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

Wavelets:- basis functions - linearly indep. functions;

Fourier and Wavelet transforms:- representation of a signal

f(t) by basis functions

deFtf ti)()(

)()(,

twbtf jkkj

jk

- 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[),(),(

- 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

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

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

-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.

G(f , f )x yfy

fx

1/Y

1/X

fx

fyG(f , f )x y

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

• 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)

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;

- 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)()(

- the Fourier transform of the output signal:

n

innyY exp)()(

n k

inknikh expexp)( )(

)()( HX

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

- 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)

•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 ).()()(

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)

- 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;

- 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

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

2cos)(0 H

- the second term is its phase:

2)(

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

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!

- 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

- 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

- 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

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

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

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

-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;

-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!!!

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

-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

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

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

( 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

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

-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

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

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)

.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!

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)

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

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

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;

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

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

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)

L

H

2

2

ANALYSIS

F

G

2

2 =x(n-1)

SYNTHESIS

x(n)

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

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

N/2

N/2

L

H

A1

0

0 1

A2

L

HA = …

N

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( )

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)

- 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)()(

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()(

- 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.

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;

--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!

--2 2

1X( )

--2 2

1Aliasing)2(X

)2( X

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

2

.2

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

--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;

-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;

- 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

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

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

--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

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+ )}

-

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.

- 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):

Φ(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.:

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

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

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.

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

Averages (lowpass filter) - scaling coefficient:

)(2

112,2,,1 kjkjkj aaa

)(2

112,2,,1 kjkjkj aab

Differences (highpass filter) – wavelet coefficient:

)()()( 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.

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

The rescaled Haar wavelets:

form an orthonormal basis:

).()()()( KkJjdttwtw JKjk

N

k

ktkhtw0

1 )2()(2)(

N

k

ktkht0

0 )2()(2)(

Generally (for the Haar):

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

The wavelet equation: (wavelets from filters)

N

k

ktkdtw0

)2()(2)(

N

k

ktkhtw0

1 )2()(2)(

N

kjk ktkat

0

)2()()(

dttwtfb jkjk )()(

Analysis of a function

kj

jkjk twbtf,

)()(Synthesis of a function

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

- 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

- 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

- 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

--2 2

1

- /2 /2

X( )

--2 2

X( /2+ )X( /2)

1/2

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

-

1/2X( ) X( + )

/2 /2

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

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( + )}

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)=

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

½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

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.

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!

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

- 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)!!!

-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

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)

- 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!

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

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).

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

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

Results:

).91691(16

1)(

)41()1()(

64320

21410

zzzzzP

zzzzP

- it results:3

00 2)()( zzPzP

The central term is: lzz 3

The centering operation gives P(z):

)()( 03 zPzzP

).9169(16

1)( 313 zzzzzP

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;

300 2)()( zzPzP

2)()( zPzP

- condition on the odd powers;

- condition on the even powers;

- 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

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

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);

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

- 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

)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

)1)(1()()( 121

01 zzzPzzP

z=-1

-2nd orderzero;

1Re

Im

- zeros of P(z):

01

011

z

z

Orthonormal Filter Banks

C

D

2

2

C

D

2

2 =x(n-1)

x(n)

T

T

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.....

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

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)

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.

- 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

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.....

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!!!

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 :

|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.

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)...

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!

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

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.

-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

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

That is:

2cos1cos1

)()(

zPzP

Is a halfband filter.

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

0)( C

- for it results:)(C

.2/)1()( ieC

- the coefficients come from the familiar averaging filter:

.2/1)1()0( cc

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(

- 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

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

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

- 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

1

2 |P( )|

|C( )|

P( /2) =1

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

- 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

- 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

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

Condition Ap :

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

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

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

,

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

nodd neven

ncnc_ _

).()(

Cond. A1 on c(n):

- 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 .

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.

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

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

- 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

).(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.

- 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

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

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

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

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

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.

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!!!

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

-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

)(

]),([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

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

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.

- 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

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

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;

- 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;

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

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.

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

-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...,

- 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

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

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

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

- if j is different from k then:

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

kj

- so the set is an orthonormal basis for

Zkkx ),(.0V

- 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

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

.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:

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

- 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

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

))

) 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

dx(x)xfa jkjk )(

dttwtfb jkjk )()(

Where:

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

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)

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

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

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

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

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

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

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

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

- 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;

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;

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

A signal

256

128

6432

Finest scale

Coarser level

Even coarser16

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

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

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)))

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.

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.

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];

b=[-1 -1 -1];

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

% 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

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)

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

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

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

j=1, k=0

j=1, k=5

j=2, k=0

j=2, k=5

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 !!!