Top Banner
Wavelets & Wavelet Algorithms 2D Haar Wavelet Transform Vladimir Kulyukin www.vkedco.blogspot.com www.vkedco.blogspot.com
65

Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Jul 26, 2015

Download

Science

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Wavelets & Wavelet Algorithms

2D Haar Wavelet Transform

Vladimir Kulyukin

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

Page 2: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Outline

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

Products● Basic 2D Haar Wavelet Transform

Page 3: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

2D Approximation with Step Functions

Page 4: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 5: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Basic Square Step Function

otherwise 0

10 and 10 if 1,0

0,0

yxyxΦ

yxΦ ,00,0

Page 6: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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Φ

Page 7: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

1st Square Step Function yxΦ ,10,0

otherwise 0

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

0,010,0

yxyxΦyxΦ

Page 8: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

1st Square Step Function yxΦ ,10,0

otherwise 0

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

0,010,0

yxyxΦyxΦ

Page 9: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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Φ

Page 10: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

2nd Square Step Function yxΦ ,11,0

otherwise 0

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

0,011,0

yxyxΦyxΦ

Page 11: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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Φ

Page 12: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

3rd Square Step Function yxΦ ,10,1

otherwise 0

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

0,010,1

yxyxΦyxΦ

Page 13: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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Φ

Page 14: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

4th Square Step Function yxΦ ,11,1

otherwise 0

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

0,011,1

yxyxΦyxΦ

Page 15: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

All Square Step Functions Side by Side

yxΦ ,11,1

yxΦ ,10,1

yxΦ ,10,0

yxΦ ,11,0

yxΦ ,00,0

Page 16: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 17: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 18: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 19: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

From 1D Wavelets to 2D Wavelets with

Tensor Products

Page 20: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 21: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Tensor Product: Definition

ygxfyxgf

ygxf

,

as defined is

productor Their tens reals.on functionsarbitrary twobe and Let

Page 22: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Derivation of Basic Unit Step Function in 2Dwith

Tensor Products

Page 23: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 24: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Basic Unit Step Function on X Axis in 2D

otherwise 0

10 if 1

as defined isfunction stepunit Basic

[1,0[

xx

Page 25: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Basic Unit Step Function on Y Axis in 2D

otherwise 0

10 if 1

as defined isfunction stepunit Basic

[1,0[

yy

Page 26: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

?

Page 27: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 28: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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[

Page 29: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 30: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Measuring Horizontal Change in 2D

Derivation of 2D Horizontal Haar Waveletwith

Tensor Products

Page 31: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Review: Basic Unit Step Function & Basic Wavelet

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

x

x

y y

Page 32: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

?

Page 33: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 34: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 35: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Measuring Vertical Change in 2D

Derivation of 2D Vertical Haar Waveletwith

Tensor Products

Page 36: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

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

?

Page 37: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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[

Page 38: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 39: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Measuring Diagonal Change in 2D

Derivation of 2D Diagonal Haar Waveletwith

Tensor Products

Page 40: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

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

?

Page 41: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

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

Page 42: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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[

Page 43: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 44: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Basic Wavelets on X & Y in 2D

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

Page 45: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 46: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Example 02

., of valueseappropriat allfor

,,, Compute .1 Suppose ,,

,,

,,,

cr

ΨΨΨΦf fdcr

fvcr

fhcr

fcr

Page 47: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Example 02

frequency. the

toingcorrespond plane 2D thedraw First we

Page 48: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

ΨΨΨ

Φ

ΦΦΦΦ

Page 49: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Example 02

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

1[1,0[

10

10

10,0

Page 50: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Example 02

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

1[1,0[

11

10

11,0

Page 51: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Example 02

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

1[2,1[

10

11

10,1

Page 52: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Example 02

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

1[2,1[

11

11

11,1

Page 53: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 54: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Example 03

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

Page 55: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 56: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

Basic 2D Haar Wavelet Transform

Page 57: Wavelets & Wavelet Algorithms: 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

Page 58: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 59: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 60: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 61: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 62: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 63: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Page 64: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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

Ψ

Ψ

Ψ

Φ

Page 65: Wavelets & Wavelet Algorithms: 2D Haar Wavelet Transform

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.