Harman Patil (Editor)

Discrete wavelet transform

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Discrete wavelet transform

In numerical analysis and functional analysis, a discrete wavelet transform (DWT) is any wavelet transform for which the wavelets are discretely sampled. As with other wavelet transforms, a key advantage it has over Fourier transforms is temporal resolution: it captures both frequency and location information (location in time).

Contents

Haar wavelets

The first DWT was invented by Hungarian mathematician Alfréd Haar. For an input represented by a list of 2 n numbers, the Haar wavelet transform may be considered to pair up input values, storing the difference and passing the sum. This process is repeated recursively, pairing up the sums to prove the next scale, which leads to 2 n 1 differences and a final sum.

Daubechies wavelets

The most commonly used set of discrete wavelet transforms was formulated by the Belgian mathematician Ingrid Daubechies in 1988. This formulation is based on the use of recurrence relations to generate progressively finer discrete samplings of an implicit mother wavelet function; each resolution is twice that of the previous scale. In her seminal paper, Daubechies derives a family of wavelets, the first of which is the Haar wavelet. Interest in this field has exploded since then, and many variations of Daubechies' original wavelets were developed.

The dual-tree complex wavelet transform (DℂWT)

The dual-tree complex wavelet transform (ℂWT) is a relatively recent enhancement to the discrete wavelet transform (DWT), with important additional properties: It is nearly shift invariant and directionally selective in two and higher dimensions. It achieves this with a redundancy factor of only 2 d substantially lower than the undecimated DWT. The multidimensional (M-D) dual-tree ℂWT is nonseparable but is based on a computationally efficient, separable filter bank (FB).

Others

Other forms of discrete wavelet transform include the non- or undecimated wavelet transform (where downsampling is omitted), the Newland transform (where an orthonormal basis of wavelets is formed from appropriately constructed top-hat filters in frequency space). Wavelet packet transforms are also related to the discrete wavelet transform. Complex wavelet transform is another form.

Properties

The Haar DWT illustrates the desirable properties of wavelets in general. First, it can be performed in O ( n ) operations; second, it captures not only a notion of the frequency content of the input, by examining it at different scales, but also temporal content, i.e. the times at which these frequencies occur. Combined, these two properties make the Fast wavelet transform (FWT) an alternative to the conventional fast Fourier transform (FFT).

Time issues

Due to the rate-change operators in the filter bank, the discrete WT is not time-invariant but actually very sensitive to the alignment of the signal in time. To address the time-varying problem of wavelet transforms, Mallat and Zhong proposed a new algorithm for wavelet representation of a signal, which is invariant to time shifts. According to this algorithm, which is called a TI-DWT, only the scale parameter is sampled along the dyadic sequence 2^j (j∈Z) and the wavelet transform is calculated for each point in time.

Applications

The discrete wavelet transform has a huge number of applications in science, engineering, mathematics and computer science. Most notably, it is used for signal coding, to represent a discrete signal in a more redundant form, often as a preconditioning for data compression. Practical applications can also be found in signal processing of accelerations for gait analysis, in digital communications and many others.

It is shown that discrete wavelet transform (discrete in scale and shift, and continuous in time) is successfully implemented as analog filter bank in biomedical signal processing for design of low-power pacemakers and also in ultra-wideband (UWB) wireless communications.

Comparison with Fourier transform

To illustrate the differences and similarities between the discrete wavelet transform with the discrete Fourier transform, consider the DWT and DFT of the following sequence: (1,0,0,0), a unit impulse.

The DFT has orthogonal basis (DFT matrix):

[ 1 1 1 1 1 i 1 i 1 1 1 1 1 i 1 i ]

while the DWT with Haar wavelets for length 4 data has orthogonal basis in the rows of:

[ 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 ]

(To simplify notation, whole numbers are used, so the bases are orthogonal but not orthonormal.)

Preliminary observations include:

  • Sinusoidal waves differ only in their frequency. The first does not complete any cycles, the second completes one full cycle, the third completes two cycles, and the fourth completes three cycles (which is equivalent to completing one cycle in the opposite direction). Differences in phase can be represented by multiplying a given basis vector by a complex constant.
  • Wavelets, by contrast, have both frequency and location. As before, the first completes zero cycles, and the second completes one cycle. However, the second and third both have the same frequency, twice that of the first. Rather than differing in frequency, they differ in location — the third is nonzero over the first two elements, and the second is nonzero over the second two elements.
  • Decomposing the sequence with respect to these bases yields:

    ( 1 , 0 , 0 , 0 ) = 1 4 ( 1 , 1 , 1 , 1 ) + 1 4 ( 1 , 1 , 1 , 1 ) + 1 2 ( 1 , 1 , 0 , 0 ) Haar DWT ( 1 , 0 , 0 , 0 ) = 1 4 ( 1 , 1 , 1 , 1 ) + 1 4 ( 1 , i , 1 , i ) + 1 4 ( 1 , 1 , 1 , 1 ) + 1 4 ( 1 , i , 1 , i ) DFT

    The DWT demonstrates the localization: the (1,1,1,1) term gives the average signal value, the (1,1,–1,–1) places the signal in the left side of the domain, and the (1,–1,0,0) places it at the left side of the left side, and truncating at any stage yields a downsampled version of the signal:

    ( 1 4 , 1 4 , 1 4 , 1 4 ) ( 1 2 , 1 2 , 0 , 0 ) 2-term truncation ( 1 , 0 , 0 , 0 )

    The DFT, by contrast, expresses the sequence by the interference of waves of various frequencies – thus truncating the series yields a low-pass filtered version of the series:

    ( 1 4 , 1 4 , 1 4 , 1 4 ) ( 3 4 , 1 4 , 1 4 , 1 4 ) 2-term truncation ( 1 , 0 , 0 , 0 )

    Notably, the middle approximation (2-term) differs. From the frequency domain perspective, this is a better approximation, but from the time domain perspective it has drawbacks – it exhibits undershoot – one of the values is negative, though the original series is non-negative everywhere – and ringing, where the right side is non-zero, unlike in the wavelet transform. On the other hand, the Fourier approximation correctly shows a peak, and all points are within 1 / 4 of their correct value, though all points have error. The wavelet approximation, by contrast, places a peak on the left half, but has no peak at the first point, and while it is exactly correct for half the values (reflecting location), it has an error of 1 / 2 for the other values.

    This illustrates the kinds of trade-offs between these transforms, and how in some respects the DWT provides preferable behavior, particularly for the modeling of transients.

    One level of the transform

    The DWT of a signal x is calculated by passing it through a series of filters. First the samples are passed through a low pass filter with impulse response g resulting in a convolution of the two:

    y [ n ] = ( x g ) [ n ] = k = x [ k ] g [ n k ]

    The signal is also decomposed simultaneously using a high-pass filter h . The outputs giving the detail coefficients (from the high-pass filter) and approximation coefficients (from the low-pass). It is important that the two filters are related to each other and they are known as a quadrature mirror filter.

    However, since half the frequencies of the signal have now been removed, half the samples can be discarded according to Nyquist’s rule. The filter output of the low-pass filter g in the diagram above is then subsampled by 2 and further processed by passing it again through a new low- pass filter g and a high- pass filter h with half the cut-off frequency of the previous one,i.e.:

    y l o w [ n ] = k = x [ k ] g [ 2 n k ] y h i g h [ n ] = k = x [ k ] h [ 2 n k ]

    This decomposition has halved the time resolution since only half of each filter output characterises the signal. However, each output has half the frequency band of the input, so the frequency resolution has been doubled.

    With the subsampling operator

    ( y k ) [ n ] = y [ k n ]

    the above summation can be written more concisely.

    y l o w = ( x g ) 2 y h i g h = ( x h ) 2

    However computing a complete convolution x g with subsequent downsampling would waste computation time.

    The Lifting scheme is an optimization where these two computations are interleaved.

    Cascading and filter banks

    This decomposition is repeated to further increase the frequency resolution and the approximation coefficients decomposed with high and low pass filters and then down-sampled. This is represented as a binary tree with nodes representing a sub-space with a different time-frequency localisation. The tree is known as a filter bank.

    At each level in the above diagram the signal is decomposed into low and high frequencies. Due to the decomposition process the input signal must be a multiple of 2 n where n is the number of levels.

    For example a signal with 32 samples, frequency range 0 to f n and 3 levels of decomposition, 4 output scales are produced:

    Relationship to the Mother Wavelet

    The filterbank implementation of wavelets can be interpreted as computing the wavelet coefficients of a discrete set of child wavelets for a given mother wavelet ψ ( t ) . In the case of the discrete wavelet transform, the mother wavelet is shifted and scaled by powers of two

    ψ j , k ( t ) = 1 2 j ψ ( t k 2 j 2 j )

    where j is the scale parameter and k is the shift parameter, both which are integers.

    Recall that the wavelet coefficient γ of a signal x ( t ) is the projection of x ( t ) onto a wavelet, and let x ( t ) be a signal of length 2 N . In the case of a child wavelet in the discrete family above,

    γ j k = x ( t ) 1 2 j ψ ( t k 2 j 2 j ) d t

    Now fix j at a particular scale, so that γ j k is a function of k only. In light of the above equation, γ j k can be viewed as a convolution of x ( t ) with a dilated, reflected, and normalized version of the mother wavelet, h ( t ) = 1 2 j ψ ( t 2 j ) , sampled at the points 1 , 2 j , 2 2 j , . . . , 2 N . But this is precisely what the detail coefficients give at level j of the discrete wavelet transform. Therefore, for an appropriate choice of h [ n ] and g [ n ] , the detail coefficients of the filter bank correspond exactly to a wavelet coefficient of a discrete set of child wavelets for a given mother wavelet ψ ( t ) .

    As an example, consider the discrete Haar wavelet, whose mother wavelet is ψ = [ 1 , 1 ] . Then the dilated, reflected, and normalized version of this wavelet is h [ n ] = 1 2 [ 1 , 1 ] , which is, indeed, the highpass decomposition filter for the discrete Haar wavelet transform.

    Time complexity

    The filterbank implementation of the Discrete Wavelet Transform takes only O(N) in certain cases, as compared to O(N log N) for the fast Fourier transform.

    Note that if g [ n ] and h [ n ] are both a constant length (i.e. their length is independent of N), then x h and x g each take O(N) time. The wavelet filterbank does each of these two O(N) convolutions, then splits the signal into two branches of size N/2. But it only recursively splits the upper branch convolved with g [ n ] (as contrasted with the FFT, which recursively splits both the upper branch and the lower branch). This leads to the following recurrence relation

    T ( N ) = 2 N + T ( N 2 )

    which leads to an O(N) time for the entire operation, as can be shown by a geometric series expansion of the above relation.

    As an example, the discrete Haar wavelet transform is linear, since in that case h [ n ] and g [ n ] are constant length 2.

    h [ n ] = [ 2 2 , 2 2 ] g [ n ] = [ 2 2 , 2 2 ]

    Other transforms

    The Adam7 algorithm, used for interlacing in the Portable Network Graphics (PNG) format, is a multiscale model of the data which is similar to a DWT with Haar wavelets.

    Unlike the DWT, it has a specific scale – it starts from an 8×8 block, and it downsamples the image, rather than decimating (low-pass filtering, then downsampling). It thus offers worse frequency behavior, showing artifacts (pixelation) at the early stages, in return for simpler implementation.

    Code example

    In its simplest form, the DWT is remarkably easy to compute.

    The Haar wavelet in Java:

    Complete Java code for a 1-D and 2-D DWT using Haar, Daubechies, Coiflet, and Legendre wavelets is available from the open source project: JWave. Furthermore, a fast lifting implementation of the discrete biorthogonal CDF 9/7 wavelet transform in C, used in the JPEG 2000 image compression standard can be found here (archived 5 March 2012).

    Example of above code

    This figure shows an example of applying the above code to compute the Haar wavelet coefficients on a sound waveform. This example highlights two key properties of the wavelet transform:

  • Natural signals often have some degree of smoothness, which makes them sparse in the wavelet domain. There are far fewer significant components in the wavelet domain in this example than there are in the time domain, and most of the significant components are towards the coarser coefficients on the left. Hence, natural signals are compressible in the wavelet domain.
  • The wavelet transform is a multiresolution, bandpass representation of a signal. This can be seen directly from the filterbank definition of the discrete wavelet transform given in this article. For a signal of length 2 N , the coefficients in the range [ 2 N j + 1 , 2 N j 1 ] represent a version of the original signal which is in the pass-band [ π 2 j , π 2 j 1 ] . This is why zooming in on these ranges of the wavelet coefficients looks so similar in structure to the original signal. Ranges which are closer to the left (larger j in the above notation), are coarser representations of the signal, while ranges to the right represent finer details.
  • References

    Discrete wavelet transform Wikipedia