You are on page 1of 21

Time Frequency Analysis and Wavelet Transform Tutorial

Haar Transform and Its Applications


Pei-Yu Chao D00945005

Abstract
The Haar transform is one of the simplest and basic transformation from the space/time domain to a local frequenc domain! "hich re#eals the space/time-#ariant spectrum$ The attractin% features of the Haar transform! includin% fast for implementation and able to anal se the local feature! ma&e it a potential candidate in modern electrical and computer en%ineerin% applications! such as si%nal and ima%e compression$ 'n this tutorial! the mathematics and applications of Haar transform "ill be e(plored$

Chapter 1 Introduction
The Haar transform "as proposed in )9)0 b a Hun%arian mathematician *lfred Haar +),$ The Haar transform is one of the earliest transform functions proposed$

Con#entionall ! -ourier transform has been used e(tensi#el to anal se the spectral content of a si%nal$ Ho"e#er! -ourier transform is not able to represent a nonstationar si%nal adequatel . "hereas time-frequenc anal sis function! e$%$! Haar transform! is found effecti#e as it pro#ides a simple approach for anal sin% the local aspects of a si%nal$

The Haar transform uses Haar function for its basis$ The Haar function is an orthonormal! rectan%ular pair$ Compared to the -ourier transform basis function "hich onl differs in frequenc ! the Haar function #aries in both scale and position$

The Haar transform is compact! d adic and orthonormal$ The Haar transform ser#es as a protot pe for the "a#elet transform! and is closel related to the discrete Haar "a#elet transform +/,$

Chapter 2 The Haar Transform


2.1 The Haar Function
The famil of N Haar functions are defined on the inter#al +0,$ The

shape of the Haar function! of an inde( k! is determined b t"o parameters1 p and q! "here
2

and & is in a ran%e of

2hen

! the Haar function is defined as a constant

. "hen

the Haar function is defined as

-rom the abo#e equation! one can see that p determines the amplitude and "idth of the non-3ero part of the function! "hile q determines the position of the non-3ero part of the Haar function +0,$

2.2 The Haar Matrix


The discrete Haar functions formed the basis of the Haar matri( H

"here

and

is the 4ronec&er product$

The 4ronec&er product of

! "here

is an

matri( and

is a

matri(! is e(pressed as

2hen

"here

is a

matri(! and

is a Haar function$

The Haar matri( is real and ortho%onal! i$e$!

! i$e$!

*n un-normali3ed 5-point Haar matri(

is sho"n belo" +/,

-rom the definition of the Haar matri( H! one can obser#e that! unli&e the -ourier transform! H matri( has onl real element 6i$e$! )! -) or 07 and is non-s mmetric$

The first ro" of H matri( measures the a#era%e #alue! and the second ro" H matri( measures a lo" frequenc component of the input #ector$ The ne(t t"o ro"s are sensiti#e to the first and second half of the input #ector respecti#el ! "hich corresponds to moderate frequenc components$ The remainin% four ro"s are

sensiti#e to the four section of the input #ector! "hich corresponds to hi%h frequenc components$ -i%$ ) sho"s the Haar function at each ro" of H matri($ 8otice the "idth and location of the Haar function is chan%ed$ The Haar function "ith narro"er "idth is responsible for anal sin% the hi%her frequenc content of the input si%nal$

-i%$ ) Haar functions for composin% 5-point Haar transform matri( +0,$

The in#erse 0&-point Haar matri( is described as

+/,

-or

! un-normalised in#erse 5-points Haar transform$

2.3 The Haar Transform


The Haar transform of an N-input function is the element #ector

The Haar transform cross multiplies a function "ith Haar matri( that contains Haar functions "ith different "idth at different location$

-or e(ample1

The Haar transform is performed in le#els$ *t each le#el! the Haar transform decomposes a discrete si%nal into t"o components "ith half of its len%th1 an appro(imation 6or trend7 and a detail 6or fluctuation7 component$ The first le#el of

appro(imation

is defined as

for

! "here

is the input si%nal$ The multiplication of

ensures

that the Haar transform preser#es the ener% of the si%nal$ The #alues of

represents

the a#era%e of successi#e pairs of

#alue$

The first le#el detail

is defined as

for

$ The #alues of

represents the difference of successi#e pairs

of

#alue$

The first le#el Haar transform is denoted as be achie#ed b

$ The in#erse of this transformation can

The successi#e le#el of Haar transform! the appro(imation and detail component are calculate in the same "a ! e(cept that these t"o components are calculated from the pre#ious appro(imation component onl $

*n e(ample1 components are

! the first le#el appro(imation and detail

Chapter 3 Application
3.1 Si nal Compression
9et:s define the ener% E of a si%nal ; as the sum of the square of its #alue! i$e$!

-or

-rom this e(ample! "e can see that Haar transform preser#e ener% ! i$e$!

and

$ -urthermore! "e can see

that the ener% of the appro(imation component is much hi%her than the ener% of

detail component$ 'n the first le#el of transformation! the ener% of the appro(imation

is about

of the ener% of the si%nal ! and in the second le#el of

transformation! the ener%

of the appro(imation

is about

2hich means that! after first le#el of Haar transform!

of ener% is concentrated

into a si%nal

that is half of the len%th of ! and after the second Haar transform!

of the ener% is concentrated into a si%nal

that is quarter of the len%th of $

This is called the compaction of ener% +4,! and it "ill occur "hene#er the ma%nitude of the detail component is si%nificantl smaller than the appro(imation component$ Thus! compression "ithout seriousl affectin% the information of the ori%inal si%nal can be achie#ed$
9

There are t"o basic cate%ories of compression techniques +4,$ The first cate%or is the lossless compression$ *s the name stand! the de-compressed si%nal is error-free$ T pical lossless methods are Huffman compression! 9<2 compression! arithmetic compression and run-len%th compression$

The other t pe is the loss

compression$ =#en thou%h this t pe of compression

method produces error in the de-compressed si%nal! the error should onl b mar%inal$ The ad#anta%e of loss techniques is that hi%her compression ratio can be achie#ed! "hen compared to the lossless compression technique$ The Haar transform is a t pe of loss compression$

The steps in#ol#ed in a simple si%nal compression are described in -i%$ 0$

-i%$ 0 >loc& dia%ram illustrate si%nal compression This al%orithm is applied to a si%nal sho"n in -i%$ /6a7! and the outcome of a )0-le#el Haar transform is sho"n in -i%$ /6b7$ * threshold of 0$/5/? is chosen based on the cumulati#e ener% distribution of the Haar transformed si%nal$ Thereafter! compressed si%nal is obtained #ia in#erse Haar transform! "hich is sho"n in -i%$ /6c7$ The compressed si%nal is almost identical to the ori%inal si%nal$ The ma(imum error
10

calculated o#er all #alues of appro(imated si%nal is no more than Hence! a compression factor of 00 "ith minimal error is achie#ed$

+4,$

-i%$ / @i%nals durin% the steps of compression$ 6a7 The ori%inal si%nal! 6b7 )0-le#el Haar transform of the ori%inal si%nal! and 6d7 is the compressed si%nal 6in#erse Haar transform7

2hen the same al%orithm is applied to the si%nal sho"n in -i%$ 46a7! performance of the si%nal compression is poorer$ The compressed si%nal! as sho"n in -i%$ 46c7! has

11

hi%her error "ith lo"er compression ratio 6)01)7$

-i%$ 4 @i%nals durin% the steps of compression$ 6a7 The ori%inal si%nal! 6b7 )0-le#el Haar transform of the ori%inal si%nal! and 6d7 is the compressed si%nal 6in#erse Haar transform7

3.2 !e"noisin
2hen si%nal is recei#ed after transmission o#er some distance! it is often distorted b noise$ De-noisin% is a process "hich is used to reco#er the noise-buried speech! "hich enhances the reco%nisabilit of the speech si%nal$

The steps in#ol#ed in a simple de-noisin% process are described in -i%$ 5$ *fter Haar transform is performed! a thresholdin% is used! i$e$! an #alues of the transformed
12

si%nal lie belo" the noise threshold is set to 0$ Thereafter! in#erse Haar transform is performed to re#eal the appro(imated si%nal$

-i%$ 5 >loc& dia%ram illustrate de-noisin% T"o si%nal from -i%$ 46a7 and -i%$ 56a7 are distorted "ith additi#e noise! "hich are sho"n in -i%$ ?6a7 and -i%$ A6a7$ The de-noisin% process is applied to the noisedistorted si%nals$ 't can be clearl obser#ed that there are lar%e numbers of fluctuation in the Haar transformed si%nal "hich is contributed b the random noise$ *fter thresholdin% and in#erse Haar transform! the de-noised si%nals are re#ealed! "hich are sho"n in -i%$ ?6d7 and -i%$ A6d7$

13

-i%$ ? @i%nals durin% the steps of de-noisin%$ 6a7 The ori%inal si%nal 6noise-distorted7! 6b7 )0-le#el Haar transform of the ori%inal si%nal$ The t"o hori3ontal lines represents the noise threshold B 0$05$ 6c7 The si%nal after thresholdin%! and 6d7 is the de-noised si%nal 6in#erse Haar transform7

14

-i%$ A @i%nals durin% the steps of de-noisin%$ 6a7 The ori%inal si%nal 6noise-distorted7! 6b7 )0-le#el Haar transform of the ori%inal si%nal$ The t"o hori3ontal lines represents the noise threshold B 0$0$ 6c7 The si%nal after thresholdin%! and 6d7 is the de-noised si%nal 6in#erse Haar transform7

't "as found that -i%$ ?6d7 is an closer appro(imate of the ori%inal! non-noisedistorted si%nal than -i%$ A6d7$ 't is due to that the ener% of the si%nal -i%$ ?6a7 is concentrated into a fe" hi%h-ener% #alues and additi#e noise is concentrated in lo"ener% #alue after Haar transformation$ Therefore! it is possible to se%re%ate the si%nal component from the noise component. "hereas in the case sho"n in -i%$ A! the ener% of the si%nal is not concentrated into a fe" hi%h-ener% #alue! e$%$! it is spread across se#eral #alue! and the noise contaminated those transformed si%nal #alue "hich ma&e the thresholdin% technique less effecti#e$

15

3.3 Ima e Compression


Haar transform can be used in compressin% an ima%e of ! "here both and

are multiple of t"o$ 'ma%e compression is an e(pansion of one-dimensional si%nal compression$ To illustrate the process! a simple e(ample is sho"n belo" +A,$ * t"o-dimensional input si%nal matri( S is set to be1

-irstl ! the first-le#el Haar transform is applied to the ro"s of the input si%nal @$ The first appro(imation and detailed matri( of the ro"s are obtained$

@econdl ! first-le#el Haar transform is applied to the columns of the resultant matri(

$ The first appro(imation and detailed matri( of the columns are obtained$

-ollo"in% denotation is used1

16

A1 appro(imation area that includes information of the a#era%e of the ima%e$ H1 hori3ontal area that includes information about the #ertical ed%es/details in the ima%e$

#1 #ertical area that includes information about the hori3ontal ed%es/details in the ima%e$

!1 dia%onal area that includes information about the dia%onal details! e$%$! corners! in the ima%e$

-rom @ection /$) "e &no"n that! after Haar transform! the appro(imation component contains most of the ener% $ Hence! it is clear that e(clude information from appro(imation area "ill result in bi%%est distortion to the compressed ima%e. and e(clude information from dia%onal area "ill result in least distortion to the compressed ima%e$

-ollo"in% fi%ures "ere e(tracted from +A,$

17

-i%$ 5 6Top7 Cri%inal 'ma%e! 69eft7 0-le#el Haar Transform! 6Di%ht7 Deconstructed$ 'ma%e$

-i%$ 9 6Top7 Cri%inal 'ma%e! 69eft7 0-le#el Haar Transform! 6Di%ht7 Deconstructed
18

-i%$ )0 6Top7 Cri%inal 'ma%e! 69eft7 0-le#el Haar Transform! 6Di%ht7 Deconstructed

The error 6E@=7 of the reconstructed ima%es are summari3ed in the Table belo" +A, E@= -i%$ 5 )?A$4?9 -i%$ 9 )05$AAA -i%$ )0 0?4$AA0

't is clear that as the comple(it of the ima%e increased! i$e$! 9ena ima%e is the most comple( ima%e of these three! the error of the reconstructed ima%e become %reater$ Hence! the performance of the Haar transform is limited$

Chapter $ Conclusion
The bac&%round and deri#ation of the Haar transform is presented in the first half of this tutorial$ The simplicit and localised propert of the Haar transform can be obser#ed$ The applications of the Haar transform are presented in the second half of
19

this tutorial! "here the "or& process! e(amples and the performance of the Haar transform in each of these applications "ere demonstrated$ -rom the results sho"n in the application section! it is clear that Haar transform has its limitation! that it ma not be suitable for processin% certain t pes of si%nal$ 8e#ertheless! Haar transform is a %ood time-#ariant spectral tool "hich can be used for applications that requires hi%h memor efficienc $

20

%eferences
+), D$@$ @tan&o#iF and >$G$ -al&o"s&i$ HThe Haar "a#elet transform1 its status and achie#ementsI$ Computers and Electrical Engineering! Jol$09! 8o$)! pp$05-44! Ganuar 000/$ +0, D$ 2an%$ HHaar transformI$ 'nternet 2eb *ddress1

http1//fourier$en%$hmc$edu/e)?)/lectures/Haar/inde($html! December 04! 0005$ +/, G$G$ Din%$ HTime--requenc *nal sis and 2a#elet TransformI$ 9ecture 8otes! 8ational Tai"an Kni#ersit $ +4, G$@$ 2al&er$ A Primer on Wavelets and their Scientific Application $ CDC Press 99C! )999$ +5, E$ *l"a&eel and <$ @haaban$ H-ace Deco%nition >ased on Haar 2a#elet Transform and Principal Component *nal sis #ia 9e#enber%-Earquardt >ac&propa%ation 8eural 8et"or&I$ European ournal of Scientific !esearch! Jol$40! 8o$)! pp$05-/)! 00)0$ +?, P$ Por"i& and *$ 9iso"s&a$ HThe Haar-2a#elet Transform in Di%ital 'ma%e Processin%1 'ts @tatus and *chie#ementsI$ "achine graphics # vision! Jol$)/! 8o$)-0! pp$ A9-95! 0004$ +A, *$ >hard"aL and D$ *li$ H'ma%e Compression Ksin% Eodified -ast Haar 2a#elet TransformI$ World Applied Science ournal! Jol$A! 8o$5! pp$?4A-?5/! 0009$

21

You might also like