Sie sind auf Seite 1von 7

Discrete Haar Transform

Pradosh K Roy FIETE


Oil and Natural Gas Corporation Ltd., Calcutta , 700088 India
roypkin@yahoo.com

I.

Introduction

Fourier Transforms , providing an analytical expression for an arbitrary function is the mathematical foundation to the study of Linear Systems and Information Theory . Despite its strong bonds with Electrical Engineering , Fourier Analysis has nevertheless become indispensable in Quantum Physics , Biomedicine , Oceanography , Civil Engineering , Mechanical Vibrations , Signal Processing , Computational Chemistry , Error Correcting Codes , Image Compression etc. However the transform is severely limited in analysing nonstationary signals [Fig.2] , in which temporal variations of the frequency contents of the signal are common features. Audio and Seismic signals are well known examples of such signals.

Fig1. Stationary Signals : The Fourier Transform is used to decompose a signal into its global frequency components

Fig 2. Non Stationary Signals : The Fourier Transform is unable to pick out local frequency content. It has a hard time representing functions that are oscillatory.

Like Fourier analysis , wavelet analysis deals with expansion of functions in terms of a set of basis functions, but unlike Fourier analysis , wavelet analysis expands functions not in terms of trigonometric polynomials but in terms of wavelets , which are generated in the form of translations and dilations of a fixed function called mother wavelet. The wavelets obtained in this way have special scaling properties . They are localized in time and frequency permitting a closer connection between the function being represented and their coefficients. The first wavelet was found by Haar early in 20th century [2]. But the construction of more general wavelets to form bases for square integrable functions was investigated in the 1980s, along with efficient algorithms to compute the expansion. At the same time, applications of these techniques in signal processing have blossomed. While linear expansions of functions are a classic subject, the recent constructions contain interesting new features. For example, wavelets allow good resolution in time and frequency This feature , as explained earlier , is important for nonstationary signal analysis. While Fourier basis functions are given in closed form, many wavelets can only be obtained through a computational procedure (and even then, only at specific rational points). While this might seem to be a drawback, it turns out that if one is interested in implementing a signal expansion on real data, then a computational procedure is better than a closed-form expression![3] The name wavelet had been used before in the literature, but its current meaning is due to J. Goupillaud, J. Morlet and A. Grossman [4]. In the context of geophysical signal processing they investigated an alternative to local Fourier analysis based on a single prototype function, and its scales and shifts. The modulation by complex exponentials in the Fourier transform is replaced by a scaling operation, and the notion of scale replaces that of frequency. The simplicity and elegance of the wavelet scheme was appealing and mathematicians started studying wavelet analysis as an alternative to Fourier analysis. This led to the discovery of wavelets which form orthonormal bases for square-integrable and other function spaces by Meyer , Daubechies , Battle , Lemarie , and others. A formalization of such constructions by Mallat and Meyer created a framework for wavelet expansions called multiresolution analysis, and established links with methods used in other fields [3]. Also, the wavelet construction by Daubechies is closely connected to filter bank methods used in Digital Signal Processing . Of course, these achievements were preceded by a long-term evolution from the 1910 Haar wavelet (which, of course, was not called a wavelet back then) to work using octave division of the Fourier spectrum (Littlewood-Paley) and results in harmonic analysis (Calderon-Zygmund operators). Other constructions were not recognized as leading to wavelets initially [3].

Wavelet analysis have been applied to solve diverse problems arising in the context of science and engineering e.g. 1.Audio denoising: Long distance telephone messages often contain significant amounts of noise. How do we remove this noise in order to clarify the messages? 2.Signal compression: The efficient transmission of large amounts of data, over the Internet for example, requires some kind of compression. Are there ways we can compress this data as much as possible without losing significant information? 3. Object detection: What methods can we use to pick out a small image, say of an aircraft, from the midst of a larger more complicated image? 4. Fingerprint compression: The FBI has 25million fingerprint records. If these fingerprint records were digitized without any compression, they would gobble up 250 trillion bytes of storage capacity. Is there a way to compress these records to a manageable size, without losing any significant details in the fingerprints? 5. Image denoising: Images formed by electron microscopes and by optical lasers are often contaminated by large amounts of unwanted clutter (referred to as noise). Can this noise be removed in order to clarify the image? 6.Image enhancement: When an optical microscope image is recorded, it often suffers from blurring. How can the appearance of the objects in these images be sharpened? 7.Image recognition: How do humans recognize faces? Can we teach machines to do it? 8. Diagnosing heart trouble: Is there a way to detect abnormal heartbeats, hidden within a complicated electrocardiogram? 9. Speech recognition: What factors distinguish consonants from vowels? How do humans recognize different voices? [5]. Following a brief revision of Discrete Fourier Transform [DFT] in Section II , Discrete Haar Transform [DHT] has been described in Section III , Section IV deals with multi-resolution analysis , the central theme of wavelet analysis. In conclusion we review the limits of the Haar Transform .

II.

Discrete Fourier Transform

Given an absolutely integrable function f(t), its Fourier transform is defined by F() = ( )

which is called the Fourier analysis formula. The inverse Fourier transform is given by f(t) = 1/2 ( )

or, the Fourier synthesis formula. The Discrete Fourier Transform [DFT] of a sequence x(n) that is periodic with period N , so that x(n) = x(n+kN) for any integer value k , is defined as : N-1 X(k) = x(n) [WN ] kn , k =0,1,..,N-1 : WN = e j(2/N) , 0 and the Inverse Discrete Fourier Transform (IDFT) is N-1 x(n) = (1/N) X(k) [WN ] -kn , n =0,1,..,N-1 : WN = e j(2/N) is the Nth root of unity 0 DFT can be conveniently expressed as the Matrix Vector Multiplication [X(k)] = [KN][x(n)] The Matrix [KN] is the kernel of the Transformation.

[KN] =

1 1 1 1 1 1 .. .. 1

1 WN WN2 WN3 WN4 WN5 WNN-2 WNN-1

1 WN2 WN4

1 WN 3 WN 6

1 ..

1 WNN-2 WN2(N-2)

1 WNN-1 WN2(N-1)

It can be shown that every application using FFT can be formulated using wavelets to provide more localized temporal (or spatial) and frequency information.

III.

Discrete Haar Transform [DHT] .

The Discrete Haar Transform [DHT] decomposes a discrete signal x[n] into two sub-signals of half its length. One subsignal is a running average or trend; the other sub-signal is a running difference or fluctuation [10] . The first trend subsignal, a1 = (a1, a2, . . . , an/2), for the signal x[n] is computed by taking a running average in the following way. Its first value, a1, is computed by taking the average of the first pair of values of (x[1]1 + x[2])/2, and then multiplying it by 2. i.e. , a1 = (x[1]+x[2])/2 Similarly, its next value a2 is computed by taking the average of the next pair of values of (x[3] + x[4])/2, and then multiplying it by 2. That is, a2 = (x[3] + x[4])/2. Continuing in this way, all of the values of a1 are produced by taking averages of successive pairs of values of x[n] , and then multiplying these averages by 2. A precise formula for the values of a1 is am = (x[ 2m1] + x[2m]) / 2 , for m = 1, 2, 3, . . . , n/2. The other subsignal is called the first fluctuation. The first fluctuation of the signal x[n] , which is denoted by d1 = (d1, d2, . . . , dn/2), is computed by taking a running difference in the following way. Its first value, d1, is calculated by taking half the difference of the first pair of values x[n] i.e. (x[1] - x[2])/2 , and multiplying it by 2. Continuing in this way, all of the values of d1 are produced according to : dm = (x[ 2m1] - x[2m]) / 2 , for m = 1, 2, 3, . . . , n/2. The first level mapping from a discrete signal x[n] to its 1st trend a1 and 1st fluctuation d1 is thereby defined by : H1 x (a1 | d1) We define H1 as the kernel of the 1-level Discrete Haar Transform. Mathematically the 1st trend subsignal a1 = (a1, a2, . . . , an/2) and the 1st fluctuation subsignal d1 = (d1, d2, . . . , dn/2) , therefore , could be expressed as the matrix [H1] vector x[n] multiplication e.g.
x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8]

a1 a2 a3 a4 d1 d2 d3 d4

1 0

1 0 0 0 -1 0 0 0

0 1 0 0 0 1 0 0

0 1 0 0 0 -1 0 0

0 0 1 0 0 0 1 0

0 0 1 0 0 0 -1 0

0 0 0 1 0 0 0 1

0 0 0 1 0 0 0 -1

1/ 2

0 0 1 0 0 0

The 1-level Haar Wavelets i.e. (1/ 2 , -1/ 2,0,0,0,0,0,0) , (0,0,1/ 2 , -1/ 2,0,0,0,0) , (0,0,0,0,1/ 2 , -1/ 2,0,0) and (0,0,0,0,0,0,1/ 2 , -1/ 2) could be represented by rows of the following matrix :
1 W1 = 1/ 2 0 0 0 -1 0 0 0 0 1 0 0 0 -1 0 0 0 0 1 0 0 0 -1 0 0 0 0 1 0 0 0 -1

These 1-level Haar wavelets have a number of interesting properties. First, they each have an energy of 1. Second, they each consist of a rapid fluctuation between just two non-zero values, 1/2, with an average value of zero. Hence the name wavelet. Finally, they all are very similar to each other in that they are each a translation in time by an even number of time-

units of the 1st Haar wavelet ( i.e. 1/ 2, -1/ 2 , 0 , 0 , 0 , 0 , 0 , 0 ) . The 2nd Haar wavelet is a translation forward in time by two units of , and third is a translation forward in time by four units of 1st Haar Wavelet , and so on.

Similarly 1-level Haar Scaling Functions could be identified by the rows in the following matrix :
1 V1 = 1/ 2 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1

H1

Theorem I. The 1-level Haar Transform defined by x (a1 | d1) conserves energy i.e E(a1 | d1) = E(x[n]) for every signal x[n] , where E(x[n]) = x[n]2 , n=0,1,.n and E(a1 | d1) = a1[j]2 + d1[j]2 , j=0,n/2 Theorem II. The energy of the trend subsignal a1 accounts for a large percentage of the energy of the transformed signal (a1 | d1). This compaction of energy provides a framework for applying Haar transform to compress signals. The 1-level DHT can be extended to multiple levels , thereby increasing the energy compaction of signals. H2 H1 H3 H2 H1

(a2 | d2| d1) and (a3 | d3| d2| d1)

where ,
1/2 0 1/2 1/2 0 -1/2 0 0 0 0 0 0 1/2 0 1/2 0 0 0 0 0 1/2 0 -1/2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1

H2

0 0 0 0 0

1/2

1/2 0 1/2 0 -1/2 0 0 0

0 -1/2 0 0 1/2 0 0

1/2 0 -1/2 0 0 -1/2 0 0

0 1/2 0 1/2 0 0 1/2 0

0 1/2 0 1/2 0 0 -1/2 0

0 1/2 0 -1/2 0 0 0 1/2

0 1/2 0 -1/2 0 0 0 -1/2

H2 H1

0 1/2 0 1/2 0 0 0

1/2 1/2 0
=

1/2 -1/2 0 0 0 0 0 0

0 0 1 0 0 0 0 0

0 0 0 1 0 0 0 0

0 0 0 0 1 0 0 0

0 0 0 0 0 1 0 0

0 0 0 0 0 0 1 0

0 0 0 0 0 0 0 1

H3

0 0 0 0

and ,

1/22 1/22 0

1/22 1/22 1/2 0 -1/2 0 0 0

1/22 1/22 -1/2 0 0 1/2 0 0

1/22 1/22 -1/2 0 0 -1/2 0 0

1/22 -1/22 0 1/2 0 0 1/2 0

1/22 -1/22 0 1/2 0 0 -1/2 0

1/22 -1/22 0 -1/2 0 0 0 1/2

1/22 -1/22 0 -1/2 0 0 0 -1/2

H3 H2 H1 =

1/2 0 0 0

Lets consider the signal x [8] = [ 4,6,10 , 12,,8,6,5,5] , to illustrate the 3-level DHT transform :
1/22 a3 d
3

1/22 1/22 1/2 0 -1/2 0 0 0

1/22 1/22 -1/2 0 0 1/2 0 0

1/22 1/22 -1/2 0 0 -1/2 0 0

1/22 -1/22 0 1/2 0 0 1/2 0

1/22 -1/22 0 1/2 0 0 -1/2 0

1/22 -1/22 0 -1/2 0 0 0 1/2

1/22 -1/22 0 -1/2 0 0 0 -1/2 4 6 10

1/22
=

d21 d
2 2

1/2 0 1/2 0 0 0

12 8 6 5 5

d1 d2 d3 d4

Or more explicitly , H1 H2H1 (a1 | d1) (a2 | d2| d1) (52, 112 , 72 , 52 | -2, -2 , 2 , 0)

[4,6,10,12,8.6.5,5]

[4,6,10,12,8.6.5,5]

= (16,12 |-6,2 | -2, -2 , 2 , 0)

[4,6,10,12,8.6.5,5]

H3 H2 H1 (a3 | d3| d2| d1) = (142| 22 |-6,2 | -2, -2 , 2 , 0)

DHT is applicable for 2N data vectors like Radix 2 FFT.

IV Multiresolution Analysis [MRA] Lets make use of the 1-level DHT , the vector x[8] could be rewritten as x[n] = ( a1/2 , a1/2 , a2/2 , a2/2 , a3/2 , a3/2 , a4/2 , a4/2 ) + (d1/2 , -d1/2, d2/2 ,- d2/2, d3/2 , -d3/2, d4/2 ,- d4/2 ) Thus the signal x[8] can be expressed as the sum of two signals that we call the 1st Averaged Signal and the 1st Detailed Signal. x = A1 + D1 A1 = ( a1/2 , a1/2 , a2/2 , a2/2 , a3/2 , a3/2 , a4/2 , a4/2 ) D1 = (d1/2 , -d1/2, d2/2 ,- d2/2, d3/2 , -d3/2, d4/2 ,- d4/2 ) For the signal x[8] = [4,6,10,12,8,6,5,5] , we get the 1st Averaged Signal A1 = ( 5,5,11,11,7,7,5,5) and the 1st Detailed Signal D1 = ( -1, 1 , -1, 1, 1 , -1 ,0 ,0 ). Notice how the first averaged signal consists of the repeated average values 5,5, and 11, 11 and 7,7 and 5,5 about which the values of x fluctuate. Thus , using these results we have x = ( 5,5,11,11,7,7,5,5) + (-1,1,-1,1,1,-1,0,0) The equation illustrate the basic idea of MRA. The signal x is expressed as a sum of lower resolution or averaged signal added with a signal made up of fluctuations or details. These fluctuations provide the added details necessary to produce the full resolution signal x . In general if the number N of signal values is divisible k times by 2 , then a k-level MRA given by x = Ak + Dk + ..... + D2 + D1 can be performed on the signal x. V Conclusion We have seen that DHT can be used to localize energy of a signal into shorter subsignals. This redistribution of energy can be used to compress signals. The term compression is used here to mean converting the data into a format that requires less number of bits to transmit. The conventional compression techniques viz. Huffman Coding , LZW compression , Arithmetic compression are lossless compression techniques , achieving error free decomposition of the original signal. However , these techniques achieve at most 2:1 compression ratio. Lossy techniques are acceptable when the inaccuracies in the decompressed signals are so small as to be imperceptible. With DHT , we can obtain compression ratios as high as 20:1 , 50:1 or even 100:1 , if we are willing to accept slight inaccuracies in the decompressed signal i.e. lossy compression. Method of compression using DWT/DHT involves (i) DWT/DHT of the original signal, (ii) Zeroing all values of the transformation which are less than some threshold values , (iii) Transmission of only the significant , non zero values of the transformation and finally (iv) Inverse transformation of the transmitted data , assigning zero values to the insignificant values which are not transmitted [5]. The decompressed signal is an approximation of the original signal. It can be shown that DHT is not very effective in compressing real life signals , which requires more sophisticated wavelets e.g. Daubechies Daub4 waveletm, shown more explicitly in the accompanying figures.

Selected References
[1].Fourier , J., Theorie Analytique de la Chaleur. Gauthiers-Villars, Paris, 1888 , [2]. Haar , A.,.1910, Zur Theorie der orthogonalen Funktionensysteme. Math. Annal., 69:331 371 [ 3]. P. Goupillaud, A. Grossman, and J. Morlet. , 1984/85, Cycle-octave and related transforms in seismic signal analysis. Geoexploration, 23:85102, 1984/85 [4 ] Vetterli , M., Jelena Kovacevic, 1995, Wavelets and Subband Coding , Prentice Hall PTR , New Jersey , 505 pp. [ 5] Walker, James S.,1999 , A Primer on Wavelets and their Scientific Applications , Chapman & Hall/CRC, Boca Raton.. NB. This note on DHT is based on Walker , James S., 1999, A Primer on Wavelets and their Scientific Applications m CRC Press LLC , p. 9-36.

Figure I. Transform Coefficients for Speech Signal 3 Level Daub4 Wavelet

Figure II. Transform Coefficients for Speech Signal Haar Wavelet.

Original Signal

Original Signal

Reconstructed Signal

Reconstructed Signal

Figure III. Reconstruction of Speech Signal 3 Level Daub4 Wavelet

Figure IV. Reconstruction of Speech Signal Haar Wavelet.

Discrete Haar Transrform Rev.1 Pradosh K. Roy

Das könnte Ihnen auch gefallen