A Really Friendly Guide to Wavelets
Total Page:16
File Type:pdf, Size:1020Kb
A Really Friendly Guide to Wavelets © C. Valens, 1999 [email protected] A Really Friendly Guide to Wavelets – © C. Valens, 1999 – [email protected] Disclaimer This tutorial is aimed at the engineer, not the mathematician. This does not mean that there will be no mathematics, it just means that there will be no proofs in the text. In my humble opinion, mathematical papers are completely unreadable because of the proofs that clutter the text. For proofs the reader is pointed to suitable references. The equations presented are there to illustrate and to clarify things, I hope. It should not be necessary to understand all the equations in order to understand the theory. However, to understand this tutorial, a mathematical background on an engineering level is required. Also some knowledge of signal processing theory might come in handy. The information presented in this tutorial is believed to be correct. However, no responsibilty whatsoever will be accepted for any damage whatsoever due to errors or misleading statements or whatsoever in this tutorial. Should there be anything incorrect, incomplete or not clear in this text, please let me know so that I can improve this tutorial. 2 A Really Friendly Guide to Wavelets – © C. Valens, 1999 – [email protected] Table of Contents 1. Introduction 2. The continuous wavelet transform 3. Wavelet properties 4. Discrete wavelets 5. A band-pass filter 6. Intermezzo: a constraint 7. The scaling function 8. Subband coding 9. The discrete wavelet transform 10. Coda 11. References 3 A Really Friendly Guide to Wavelets – © C. Valens, 1999 – [email protected] 1. Introduction It is well known from Fourier theory that a signal can be expressed as the sum of a, possibly infinite, series of sines and cosines. This sum is also referred to as a Fourier expansion. The big disadvantage of a Fourier expansion however is that it has only frequency resolution and no time resolution. This means that although we might be able to determine all the frequencies present in a signal, we do not know when they are present. To overcome this problem in the past decades several solutions have been developed which are more or less able to represent a signal in the time and frequency domain at the same time. The idea behind these time-frequency joint representations is to cut the signal of interest into several parts and then analyze the parts separately. It is clear that analyzing a signal this way will give more information about the when and where of different frequency components, but it leads to a fundamental problem as well: how to cut the signal? Suppose that we want to know exactly all the frequency components present at a certain moment in time. We cut out only this very short time window using a Dirac pulse1, transform it to the frequency domain and … something is very wrong. The problem here is that cutting the signal corresponds to a convolution between the signal and the cutting window. Since convolution in the time domain is identical to multiplication in the frequency domain and since the Fourier transform of a Dirac pulse contains all possible frequencies the frequency components of the signal will be smeared out all over the frequency axis. In fact this situation is the opposite of the standard Fourier transform since we now have time resolution but no frequency resolution whatsoever. The underlying principle of the phenomena just described is Heisenberg’s uncertainty principle, which, in signal processing terms, states that it is impossible to know the exact frequency and the exact time of occurrence of this frequency in a signal. In other words, a signal can simply not be represented as a point in the time-frequency space. The uncertainty principle shows that it is very important how one cuts the signal. The wavelet transform or wavelet analysis is probably the most recent solution to overcome the shortcomings of the Fourier transform. In wavelet analysis the use of a fully scalable modulated window solves the signal-cutting problem. The window is shifted along the signal and for every position the spectrum is calculated. Then this process is repeated many times with a slightly shorter (or longer) window for every new cycle. In the end the result will be a collection of time-frequency representations of the signal, all with different resolutions. Because of this collection of representations we can speak of a multiresolution analysis. In the case of wavelets we normally do not speak about time-frequency representations but about time-scale representations, scale being in a way the opposite of frequency, because the term frequency is reserved for the Fourier transform. Since from literature it is not always clear what is meant by small and large scales, I will define it here as follows: the large scale is the big picture, while the small scales show the details. Thus, going from large scale to small scale is in this context equal to zooming in. 1 A Dirac pulse is defined as f(t) = 1 at t = 0 and f(t) = 0 for all other t. 4 A Really Friendly Guide to Wavelets – © C. Valens, 1999 – [email protected] In the following sections I will present the wavelet transform and develop a scheme that will allow us to implement the wavelet transform in an efficient way on a digital computer. The transform will be so efficient that it does not even use wavelets anymore. (The careful reader might raise an eyebrow here and ask: “Surely you can’t be serious?”2) But before we continue a disclaimer. Since wavelet theory is not a new thing anymore, it has been around now for fifteen years, say, I will not present a full and in-depth theory here. Several good textbooks on wavelet theory are available and many readable papers with a good review of wavelet theory have been published. The list of references at the end of this report contains pointers to texts with more extensive wavelet theory coverage like (in random order) [Kai94], [Wei94], [She96], [Bur98], [Dau92], [Hub96], [Mal89], [Vet92]. I do however present some mathematical background in order to tell a coherent and clear tale (I hope). Having this said, let’s go on to the wavelets. 2. The continuous wavelet transform The wavelet analysis described in the introduction is known as the continuous wavelet transform or CWT. More formally it is written as: γ τ = ψ* (s, ) ∫ f (t) s,τ (t)dt , (1) where * denotes complex conjugation. This equation shows how a function ƒ(t) is decomposed into a set of basis functions 5s,-(t), called the wavelets. The variables s and - are the new dimensions, scale and translation, after the wavelet transform. For completeness sake equation (2) gives the inverse wavelet transform. I will not expand on this since we are not going to use it: = γ τ ψ τ f (t) ∫∫ (s, ) s,τ (t)d ds .(2) The wavelets are generated from a single basic wavelet 5(t), the so-called mother wavelet, by scaling and translation: − τ ψ = 1 ψ t s,τ (t) .(3) s s In (3) s is the scale factor, - is the translation factor and the factor s-1/2 is for energy normalization across the different scales. It is important to note that in (1), (2) and (3) the wavelet basis functions are not specified. This is a difference between the wavelet transform and the Fourier transform, or other transforms. The theory of wavelet transforms 2 “I am serious, and don’t call me Shirley.” Leslie Nielsen as Dr. Rumack in the film Airplane! (1980). 5 A Really Friendly Guide to Wavelets – © C. Valens, 1999 – [email protected] deals with the general properties of the wavelets and wavelet transforms only. It defines a framework within one can design wavelets to taste and wishes. 3. Wavelet properties The most important properties of wavelets are the admissibility and the regularity conditions and these are the properties which gave wavelets their name. It can be shown [She96] that square integrable functions 5(t) satisfying the admissibility condition, | Ψ(ω) |2 ∫ dω < +∞ ,(4) | ω | can be used to first analyze and then reconstruct a signal without loss of information. In (4) 4(7) stands for the Fourier transform of 5(t). The admissibility condition implies that the Fourier transform of 5(t) vanishes at the zero frequency, i.e. | Ψ(ω) |2 = 0 .(5) ω=0 This means that wavelets must have a band-pass like spectrum. This is a very important observation, which we will use later on to build an efficient wavelet transform. A zero at the zero frequency also means that the average value of the wavelet in the time domain must be zero, ∫ ψ(t)dt = 0 ,(6) and therefore it must be oscillatory. In other words, 5(t) must be a wave. As can be seen from (1) the wavelet transform of a one-dimensional function is two-dimensional; the wavelet transform of a two-dimensional function is four-dimensional. The time-bandwidth product of the wavelet transform is the square of the input signal and for most practical applications this is not a desirable property. Therefore one imposes some additional conditions on the wavelet functions in order to make the wavelet transform decrease quickly with decreasing scale s. These are the regularity conditions and they state that the wavelet function should have some smoothness and concentration in both time and frequency domains. Regularity is a quite complex concept and we will try to explain it a little using the concept of vanishing moments.