wavelets & wavelet algorithms: 2d haar wavelet transform

Post on 26-Jul-2015

150 Views

Category:

Science

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Wavelets & Wavelet Algorithms

2D Haar Wavelet Transform

Vladimir Kulyukin

www.vkedco.blogspot.comwww.vkedco.blogspot.com

Outline

● 2D Approximation with Step Functions● From 1D Wavelets to 2D Wavelets with Tensor

Products● Basic 2D Haar Wavelet Transform

2D Approximation with Step Functions

Square Step Functions

● In 1D, signal functions are approximated with simple step functions of one variable

● In 2D, signal functions are approximated with square step functions of two variables

● A square step function has a value of 1 over a specific square on the 2D plane and 0 everywhere else

Basic Square Step Function

otherwise 0

10 and 10 if 1,0

0,0

yxyxΦ

yxΦ ,00,0

Obtaining 1st Square Step Function from Basic Square Step Function

otherwise 0

10 and 10 if 1,0

0,0

yxyxΦ

yxΦyxyx

yxΦ ,otherwise 0

2/10 and 2/10 if 1

otherwise 0

120 and 120 if 12,2 1

0,000,0

otherwise 0

2/10 and 2/10 if 1,1

0,0

yxyxΦ

1st Square Step Function yxΦ ,10,0

otherwise 0

2/10 and 2/10 if 12,2, 0

0,010,0

yxyxΦyxΦ

1st Square Step Function yxΦ ,10,0

otherwise 0

2/10 and 2/10 if 12,2, 0

0,010,0

yxyxΦyxΦ

Obtaining 2nd Square Step Function from Basic Square Step Function

otherwise 0

10 and 10 if 1,0

0,0

yxyxΦ

yxΦyxyx

yxΦ ,otherwise 0

12/1 and 2/10 if 1

otherwise 0

1120 and 120 if 112,2 1

1,000,0

otherwise 0

12/1 and 2/10 if 1,1

1,0

yxyxΦ

2nd Square Step Function yxΦ ,11,0

otherwise 0

12/1 and 2/10 if 112,2, 0

0,011,0

yxyxΦyxΦ

Obtaining 3rd Square Step Function from Basic Square Step Function

otherwise 0

10 and 10 if 1,0

0,0

yxyxΦ

yxΦyxyx

yxΦ ,otherwise 0

2/10 and 12/1 if 1

otherwise 0

120 and 1120 if 12,12 1

0,100,0

otherwise 0

2/10 and 12/1 if 1,1

0,1̀

yxyxΦ

3rd Square Step Function yxΦ ,10,1

otherwise 0

2/10 and 12/1 if 12,12, 0

0,010,1

yxyxΦyxΦ

Obtaining 4th Square Step Function from Basic Square Step Function

otherwise 0

10 and 10 if 1,0

0,0

yxyxΦ

yxΦyxyx

yxΦ ,otherwise 0

12/1 and 12/1 if 1

otherwise 0

1120 and 1120 if 112,12 1

1,111,1

otherwise 0

12/1 and 12/1 if 1,1

1,1̀

yxyxΦ

4th Square Step Function yxΦ ,11,1

otherwise 0

1/21 and 12/1 if 112,12, 0

0,011,1

yxyxΦyxΦ

All Square Step Functions Side by Side

yxΦ ,11,1

yxΦ ,10,1

yxΦ ,10,0

yxΦ ,11,0

yxΦ ,00,0

Example 01

? of ~

ion approximat step square theisWhat

;12

1,

2

1;30,

2

1;5

2

1,0;70,0

: valuessample following thehas function signal theSuppose

ff

ffff

f

Example 01

? of ~

ion approximat step square theisWhat

;12

1,

2

1;30,

2

1;5

2

1,0;70,0

: valuessample following thehas function signal theSuppose

ff

ffff

f

Example 01

.,1,3,5,7,~

? of ~

ion approximat step square theisWhat

;12

1,

2

1;30,

2

1;5

2

1,0;70,0

: valuessample following thehas function signal theSuppose

11,1

10,1

11,0

10,0 yxΦyxΦyxΦyxΦyxf

ff

ffff

f

From 1D Wavelets to 2D Wavelets with

Tensor Products

Tensor Products

● We have managed to extend step functions from 1D to 2D with square step functions

● Our next step is to extend 1D wavelets to 2D wavelets● One method of such extension is through products of

basic wavelets in the 1st dimension (X dimension) and basic wavelets in the 2nd dimension (Y dimension)

● Tensor products of functions is a mathematical formalism to accomplish this task

Tensor Product: Definition

ygxfyxgf

ygxf

,

as defined is

productor Their tens reals.on functionsarbitrary twobe and Let

Derivation of Basic Unit Step Function in 2Dwith

Tensor Products

Basic Unit Step Function

b[.[a, intervalarbitrary an tocontracted

or dilated becan that Recall

otherwise 0

10 if 1

as defined isfunction stepunit Basic

[1,0[

[1,0[

x

xx

Basic Unit Step Function on X Axis in 2D

otherwise 0

10 if 1

as defined isfunction stepunit Basic

[1,0[

xx

Basic Unit Step Function on Y Axis in 2D

otherwise 0

10 if 1

as defined isfunction stepunit Basic

[1,0[

yy

Tensor Product of Unit Functions on X & Y in 2D

otherwise 0

10 if 1[1,0[

xx

otherwise 0

10 if 1[1,0[

yy

?

Tensor Product of Unit Functions on X & Y in 2D

otherwise 0

10 if 1[1,0[

xx

otherwise 0

10 if 1[1,0[

yy yxΦ

yx,

otherwise 0

10 and 10 if 1 00,0

Tensor Product of Unit Functions on X & Y in 2D

otherwise 0

10 if 1[1,0[

xx

otherwise 0

10 if 1[1,0[

yy yxΦ

yx,

otherwise 0

10 and 10 if 1 00,0

yxΦyx

yxyx ,otherwise 0

10 and 10 if 1,

:Derivation

00,0[1,0[[1,0[[1,0[[1,0[

Basic Square Step Function

Basic Square Step Function is the tensor product of unit functions and in 2D

yxΦ ,00,0 x[1,0[ y[1,0[

yxΦ ,00,0

Measuring Horizontal Change in 2D

Derivation of 2D Horizontal Haar Waveletwith

Tensor Products

Review: Basic Unit Step Function & Basic Wavelet

x[1,0[ xxx [1,2/1[[2/1,0[[1,0[

x

x

y y

Basic Unit Step Function & Basic Wavelet on X & Y in 2D

otherwise if 0

12/1 if 1

2/10 if 1

[1,0[ y

y

y

otherwise 0

10 if 1[1,0[

xx

otherwise 0

10 if 1[1,0[

xx

otherwise 0

10 if 1[1,0[

xx

?

Basic Unit Step Function & Basic Wavelet on X & Y in 2D

otherwise if 0

12/1 if 1

2/10 if 1

[1,0[ y

y

y yxΨyx

yxh ,

otherwise 0

12/1 and 10 if 1

2/10 and 10 if 10,

0,0

otherwise 0

10 if 1[1,0[

xx

otherwise 0

10 if 1[1,0[

xx

otherwise 0

10 if 1[1,0[

xx

0,0,0[1,0[[1,0[[1,0[[1,0[ , :Derivation hΨyxyx

Basic Unit Step Function on X & Basic Wavelet on Y in 2D

y[1,0[ yxΨ h ,0,0,0 x[1,0[

The tensor product of the basic unit step function on X & the basic wavelet on Y in 2D results in the 2D Haar Wavelet for horizontal change, i.e., changealong the X axis

Measuring Vertical Change in 2D

Derivation of 2D Vertical Haar Waveletwith

Tensor Products

Basic Wavelet on X & Basic Unit Step Function on Y in 2D

y[1,0[ x[1,0[

?

Basic Wavelet on X & Basic Unit Step Function on Y in 2D

y[1,0[ yxΨ v ,0,0,0

x[1,0[

yxΦyx

yx

yxyx v ,

otherwise 0

10 and 12/1 if 1

10 and 1/20 if 1

,

:Derivation

0,0,0[1,0[[1,0[[1,0[[1,0[

Basic Wavelet on X & Basic Unit Step Function on Y in 2D

y[1,0[ yxΨ v ,0,0,0

x[1,0[

The tensor product of the basic wavelet on X & the basic unit step function on Y in 2D results in the 2D Haar Wavelet for vertical change, i.e., changealong the Y axis

Measuring Diagonal Change in 2D

Derivation of 2D Diagonal Haar Waveletwith

Tensor Products

Tensor Product of Basic Wavelets on X & Y in 2D

y[1,0[ x[1,0[

?

Tensor Products of Basic Wavelets on X & Y in 2D

y[1,0[ yxΨ d ,0,0,0 x[1,0[

Derivation of Tensor Product of Basic Wavelets on X & Y in 2D

yxΨ

yx

yx

yx

yx

yxyx d ,

otherwise 0

12/1 and 2/10 if 1

2/10 and 12/1 if 1

12/1 and 12/1 if 1

2/10 and 2/10 if 1

, 0,0,0[1,0[[1,0[[1,0[[1,0[

Tensor Products of Basic Wavelets on X & Y in 2D

y[1,0[ yxΨ d ,0,0,0 x[1,0[

The tensor product of the basic wavelets on X & on Y in 2D results in the 2D Haar Wavelet for diagonal change i.e., changefrom the top-left-to-bottom-right diagonal and the top-right-to-bottom-left diagonal

Basic Wavelets on X & Y in 2D

y[1,0[ yxΨ d ,0,0,0 x[1,0[

Generalized Definitions

fc

fr

fdcr

fc

fr

fvcr

fc

fr

fhcr

fc

fr

fcr

yxΨ

yxΨ

yxΨ

yxΦ

,

,

,

,

,,

,,

,,

,

f2

1i.e., frequency, is this

plane 2D in the cell a

of colum and row are ,cr

(diagonal) ,(vertical)

l),(horizonta direction

dv

h

Example 02

., of valueseappropriat allfor

,,, Compute .1 Suppose ,,

,,

,,,

cr

ΨΨΨΦf fdcr

fvcr

fhcr

fcr

Example 02

frequency. the

toingcorrespond plane 2D thedraw First we

Example 02

.,, compute

toally, theoreticneed, wefunction stepeach For

,,,, :are funtions step The

compute. toneed we

wavelets theand steps theall define weSecond,

1,,

1,,

1,,

1,

11,1

10,1

11,0

10,0

dcr

vcr

hcr

cr

ΨΨΨ

Φ

ΦΦΦΦ

Example 02

yxyxyxΦ ,,,:functions step thecompute uslet Now 1[1,0[

1[1,0[

10

10

10,0

Example 02

yxyxyxΦ ,,,:functions step thecompute uslet Now 1[2,1[

1[1,0[

11

10

11,0

Example 02

yxyxyxΦ ,,,:functions step thecompute uslet Now 1[1,0[

1[2,1[

10

11

10,1

Example 02

yxyxyxΦ ,,,:functions step thecompute uslet Now 1[2,1[

1[2,1[

11

11

11,1

Example 02

yxyxyxΨ

yxyxyxΨ

yxyxyxΨ

d

v

h

,,,

,,,

,,,

: wavelets theof some compute uslet Now

1[2,1[

1[1,0[

11

10

1,1,0

1[2,1[

1[1,0[

11

10

1,1,0

1[2,1[

1[1,0[

11

10

1,1,0

Example 03

signify? , does What .5 Suppose 5,3,2 yxΨf d

Example 03

4[. [3, are axis-Y on the

scooridnate whoseand 3[ [2, are axis-X on the scoordinate

whosesquare in the change diagonal a signifieswhich

,,,,

.of valueeappropriat somefor ,2x 2at is cellevery

wheresquare 32 x 32 a asit ofcan think weSimilarly,

.2 x 2 is cellevery wheresquare 1 x 1 a have We

5[4,3[

5[3,2[

53

52

5,3,2

-5-5

yxyxyxΨ

i

d

ii

Basic 2D Haar Wavelet Transform

2D Square-Step Approximations

1111

1

,22,12,02

0,20,10,0

1111

1

...

...

...

2

1,

2

1 ...

2

1,

2

1 0,

2

1

...

2

1,0 ...

2

1,0 0,0

~

:follows as ~

function

step-square aby edapproximat be function signal someLet

n-n-n-n-

n-

sss

sss

fff

fff

f

f

f

nnnn

n

2D Basic Haar Wavelet Transform

column.

each toTransformet Haar Wavel Basic 1D theapplying the

and roweach toTransformet Haar Wavel Basic 1D the

applyingby computed is Transformet Haar Wavel

Basic 2D theion,approximat step square 2 x 2 aGiven nn

Example 04

1,11,0

0,10,0

2

1,

2

1 0,

2

1

2

1,0 0,0

~

:follows as ~

function

step-square aby edapproximat be function signal someLet

ss

ss

ff

ff

f

f

f

Example 04

;

2

2

2

2

:roweach toBWT 1D Applying

.

2

1,

2

1 0,

2

1

2

1,0 0,0

~

: toTransformet Haar Wavel Basic 2D apply the usLet

1,11,01,11,0

0,10,00,10,0

1,11,0

0,10,0

1,11,0

0,10,0

ssss

ssss

ss

ss

ss

ss

ff

ff

f

Example 04

;

4

4

4

4

2

222

2

2

222

22

2

result above in thecolumn each toBWT 1Dapply Now

;

2

2

2

2

:roweach toBWT 1D Applying

1,11,01,11,01,11,00,10,0

1,11,00,10,01,11,00,10,0

1,11,00,10,01,11,00,10,0

1,11,00,10,01,11,00,10,0

1,11,01,11,0

0,10,00,10,0

1,11,0

0,10,0

ssssssss

ssssssss

ssssssss

ssssssss

ssss

ssss

ss

ss

Example 05

0 2

1 4

2

1-1

2

262

11

2

26

1 2

1 6

;1 2

1 6

2

1-3

2

132

5-7

2

57

1 3

5 7

.1 3

5 7 toBHWT 2DApply

BHWT 1

BHWT 1

BasedColumD

BasedRowD

Example 05

.0 2

1 4

0214

1216

13571 3

5 7

~

0[1,0[

0[1,0[

0[1,0[

0[1,0[

0[1,0[

0[1,0[

0[1,0[

0[1,0[

01,1

00,1

01,0

00,0

11,1

10,1

11,0

10,0

ΨΨΨΦ

ΦΦΦΦf

Example 05

.D

H

0 2

1 4

1 3

5 7

BHWT 2

V

AD

sample in the change diagonal theis 00442

35

2

170

sample in the change vertical theis 24262

13

2

572

sample in the change horizontal theis 12352

15

2

37 1

sample theof average theis 44

16

4

15374

01,0

01,0

01,0

00,0

Ψ

Ψ

Ψ

Φ

References

● Y. Nievergelt. “Wavelets Made Easy.” Birkhauser, 1999.● C. S. Burrus, R. A. Gopinath, H. Guo. “Introduction to

Wavelets and Wavelet Transforms: A Primer.” Prentice Hall, 1998.

● G. P. Tolstov. “Fourier Series.” Dover Publications, Inc. 1962.

top related