You are on page 1of 17

Haar Wavelet Analysis

Why Wavelets?
Wavelets were first applied in geophysics to analyze data from seismic
surveys, which are used in oil and mineral exploration to get pictures of
layering in subsurface rock.
In fact, mathematicians had developed them to solve some abstract
problems some twenty years earlier but had not anticipated their applications
in signal processing.

2011/1/3

Da-Chuan Cheng, PhD

Haar Wavelets
Wavelet can keep track of time and frequency information.
There are two functions that play a primary role in wavelet analysis, the
scaling function (father wavelet) and the wavelet (mother wavelet).
The simplest wavelet analysis is based on Haar scaling function.

2011/1/3

Da-Chuan Cheng, PhD

Haar Wavelets
The Haar scaling function is defined as

1, if 0 x < 1
( x) =
0, otherwise.
The Haar Wavelets mother function is defined as

( x) = (2 x) (2 x 1)

1, 0 x < 1/2,

( x) = 1, 1 / 2 x < 1,
0, otherwise.
Haar Wavelet's properties:
(1) Any function can be the linear combination of

( x), (2 x), (2 2 x),L (2 k x),L

and their shifting functions

(2) Any function can be the linear combination of constant function,

( x), (2 x), (2 2 x), L , (2 k x),L and their shifting functions


2011/1/3

Da-Chuan Cheng, PhD

Haar Wavelets
(3) The set of functions

{2 j / 2 (2 j x k ); k Z }

is an orthonormal

basis.
Proof:

(2

(( x)) dx = 1dx = 1
2

1/ 2

( 2(2 x)) dx = ( 2 1) 2 dx = 1

j/2

j=0

j=1

1/ 2 j

(2 x)) dx =
j

(2 j / 2 1) 2 dx = 1

for any integer j


k is integer and it is only a translation, it does not affect the
integration.
2011/1/3

Da-Chuan Cheng, PhD

1-level Haar Transform


How to do Haar transform:
n
Assumption: 1D signal f of the length N = 2

1-level Haar-Transform for

f = ( x1 , x2 , K, xN )

H1
f
( a1 | d 1 )

where

x N 1 + x N
x1 + x2 x3 + x4
a =(
,
,L,
)
2
2
2
x x
x x x x
d 1 = ( 1 2 , 3 4 , L , N 1 N )
2
2
2
1

2011/1/3

Da-Chuan Cheng, PhD

1-level Haar Transform


Example:

f = (9,7,3,5)
16 8
a1 = (
)
,
2 2
2 2
d1 = (
,
)
2 2

The transformation H1 is reversible. That means, f can be reconstructed


via (a1,d 1 )
a1 = (a1 , K , a N / 2 )
d 1 = (d1 , K , d N / 2 )
a + d N / 2 aN / 2 d N / 2
a +d a d
f = ( 1 1 , 1 1 ,K, N / 2
,
)
2
2
2
2

2011/1/3

Da-Chuan Cheng, PhD

1-level Haar Transform


The energy after Haar transform is not changed.

The energy of a signal f = (x1,x2 ,K ,x N ) is defined as :


E f = x12 + x22 + L + x N2
The energy of (a1 | d 1 ) is
a12 + L + a N2 / 2 + d12 + L + d N2 / 2
( x N 1 + x N ) 2 ( x N 1 x N ) 2
( x1 + x2 ) 2 ( x1 x2 ) 2
=
+
+L+
+
2
2
2
2
= x12 + x22 + L + x N2 1 + x N2
= Ef

2011/1/3

Da-Chuan Cheng, PhD

1-level Haar Transform


Energy distribution

Example : f = (9, 7, 3, 5), a1 = ( 162 ,

8
2

), d 1 = (

2
2

, 22 )

Ea1 = ( 162 ) 2 + ( 82 ) 2 = 160


Ed 1 = ( 22 ) 2 + ( 22 ) 2 = 4
Ea1 + Ed 1 = E f = 164
Energy from a1 : 160
= 97.6%
164

2011/1/3

Da-Chuan Cheng, PhD

Multilevel Haar Transform


2 level Haar transform will be defined as :
H2
(a 2 , d 2 , d 1 )
f
where
H1
f
( a1 , d 1 )
H1
a1
(a 2 , d 2 )
Example : f = (9, 7, 3, 5), a1 = ( 162 ,

8
2

), d 1 = (

a 2 = 12
d2 = 4
H2
f
(12 | 4 |

2011/1/3

Da-Chuan Cheng, PhD

2
2

2
2
,
2
2

2
)
2

Multilevel Haar Transform


Example : f = (4, 6, 10, 12, 8, 6, 5, 5)
2 2 2
10 22 14 10
1
1
a =(
,0)
,
,
,
), d = (
,
,
2 2 2 2
2 2 2
a 2 = (16, 12),
d 2 = (6, 2)
4
28
3
3
a =
d =
,
2
2
That means
f

2011/1/3

H3

(a 3 | d 3 | d 2 | d 1 )
2 2 2
28 4
=(
,6, 2,
,
,
,0)
,
2 2 2
2 2

Da-Chuan Cheng, PhD

10

Haar Wavelets
1 level Haar wavelets :
1
1
1
,
W1 = (
,0,0, L ,0)
2
2
1
1
1
W2 = (0,0,
,
, L ,0)
2
2
M
1
1
WN1 / 2 = (0,0,0,0, L ,
,
)
2
2
Therefore, d 1 can be represented as :
d 1 = ( fW11 , fW21 , K , fWN1 / 2 )

2011/1/3

Da-Chuan Cheng, PhD

11

Haar Wavelets
1 level Haar scaling functions :
1 1
1
,
V1 = (
,0,0,L ,0)
2 2
1 1
1
V2 = (0,0,
,
, L ,0)
2 2
M
1 1
VN1 / 2 = (0,0,0,0, L ,
,
)
2 2
Therefore, a1 can be represented as :
a1 = ( fV11 , fV21 , K , fVN1 / 2 )

2011/1/3

Da-Chuan Cheng, PhD

12

Haar Wavelets
Reconstruction from 1 - level Haar transform
aN / 2 + d N / 2 aN / 2 d N / 2
a1 + d1 a1 d1
,
,L,
,
)
f =(
2
2
2
2
aN / 2 aN / 2
dN /2 dN /2
a1 a1
d1
d1
=(
,
,L,
,
)+(
,
,L,
,
)
2 2
2
2
2
2
2
2
= (a1V11 + L + a N / 2 VN1 / 2 ) + (d1W11 + L + d N / 2 WN1 / 2 )
= ( fV11 )V11 + L + ( fVN1 / 2 )VN1 / 2 + ( fW11 ) W11 + L + ( fWN1 / 2 ) WN1 / 2
14444
4244444
3 1444442444443
= A1 + D1

2011/1/3

A1

D1

Da-Chuan Cheng, PhD

13

Haar Wavelets
V11 , V21 , L, VN1 / 2 , W11 , W21 , L , WN1 / 2 construct an orthonormal basis in
an N - dimensional space
Vi1 V1j = 0, Wi1 W1j = 0, i j; Vi1 Wi1 = 0
| Vi1 |=| Wi1 |= 1
They form a new coordinate system.

Example : f = (4,6,10,12,8,6,5,5)
10 22 14 10
2 2 2
1
1
,
,
,
), d = (
,
,
,0)
a =(
2 2 2 2
2 2 2
Therefore,
10 1 22 1 14 1 10 1 2
2
2
1
1
V1 +
V2 +
V3 +
V4
W1
W2 +
W31
f =
2
2
2
2
2
2
2
2011/1/3

Da-Chuan Cheng, PhD

14

Haar Wavelets

2011/1/3

Da-Chuan Cheng, PhD

15

Haar Wavelets
For 2 - level Haar transform : a 2 = ( fV12 , fV22 , L, fVN2 / 4 )
1 1 1 1
2
V1 = ( , , , ,0,0,0,0, L,0,0,0,0)
2 2 2 2
1 1 1 1
1 1 1 1
2
2
V2 = (0,0,0,0, , , , , L,0,0,0,0) L VN / 4 = (0,0,0,0,0,0,0,0, L, , , , )
2 2 2 2
2 2 2 2

and
d 2 = ( fW12 , fW22 , L , fWN2 / 4 )
1 1 1 1
W12 = ( , , , ,0,0,0,0, L,0,0,0,0)
2 2 2 2
1 1 1 1
2
W2 = (0,0,0,0, , , , , L ,0,0,0,0)
2 2 2 2
1 1 1 1
2
WN / 4 = (0,0,0,0,0,0,0,0, L , , , )
2 2 2 2
2011/1/3

Da-Chuan Cheng, PhD

16

Haar Wavelets
Reconstruction from 2 - level Haar transform :
H2
f
(a 2 | d 2 | d 1 )
f = A 2 + D 2 + D1
D1 = ( fW11 ) W11 + ( fW21 ) W21 + L + ( fWN1 / 2 ) WN1 / 2
D 2 = ( fW12 ) W12 + ( fW22 ) W22 + L + ( fWN2 / 4 ) WN2 / 4
A2 = ( fV12 )V12 + ( fV22 )V22 + L + ( fVN2 / 4 )VN2 / 4

2011/1/3

Da-Chuan Cheng, PhD

17

You might also like