<<

Lecture 19: compression of series and images

c Christopher S. Bretherton Winter 2014

Ref: Matlab Wavelet Toolbox help.

19.1 Wavelet compression of a

The last section of wavelet leleccum notoolbox.m demonstrates the use of wavelet compression on a time series. The idea is to keep the wavelet coefficients of largest amplitude and zero out the small ones.

19.2 Wavelet /compression of an image

Wavelet analysis is easily extended to two-dimensional images or datasets ( matrices), by first doing a of each column of the matrix, then transforming each row of the result (see wavelet image). The wavelet coeffi- cient matrix has the highest level (largest-scale) in the first rows/columns, then successively smaller detail scales further down the rows/columns. The ex- ample also shows fine results with 50-fold .

19.3 Continuous Wavelet Transform (CWT)

Given a continuous u(t) and an analyzing wavelet ψ(x), the CWT has the form Z ∞ s − t W (λ, t) = λ−1/2 ψ( )u(s)ds (19.3.1) −∞ λ Here λ, the scale, is a continuous variable. We insist that ψ have zero and that its square integrates to 1. The continuous is defined:   1 0 < t < 1/2 ψ(t) = −1 1/2 < t < 1 (19.3.2)  0 otherwise

W (λ, t) is proportional to the difference of running of u over successive intervals of length λ/2.

1 Amath 482/582 Lecture 19 Bretherton - Winter 2014 2

In practice, for a discrete time series, the is evaluated as a Riemann sum using the Matlab wavelet toolbox cwt. An example is given on the class web page wavelet leleccum cwt.

19.4 Other ; the Matlab wavelet tool- box

Haar wavelets are simple but depending on the application, other wavelets are better choices. For instance, Haar wavelets take a linear trend (which is smooth) and subdivide it into both and detail components. The db2 wavelet is designed to put linear trends into only the average component, so is more efficient for decomposing data with linear gradients, while maintaining mutual orthonormality of wavelets and scaling vectors. The level-1 db2 wavelets are:

1 W1 = [β1, β2, β3, β4, 0, 0, 0, 0,..., 0, 0] 1 W2 = [0, 0, β1, β2, β3, β4, 0, 0,..., 0, 0] (19.4.1) . . where √ √ √ β = (1 − 3)/4 2 = −.13, β = β 3 = −.22, 1 √ 2 √ 1 √ β3 = −β4 3 = .84, β4 = −(1 + 3)/4 2 = −.48. (19.4.2) and the scaling vectors have the form

1 W1 = [−β4, β3, −β2, β1, 0, 0, 0, 0,..., 0, 0] 1 W2 = [0, 0, −β4, β3, −β2, β1, 0, 0,..., 0, 0] (19.4.3) . .

Another advantage of the db2 wavelet over the Haar wavelet is that it acts as a tighter band pass filter in separating information from different octaves of scale. The Matlab toolbox supports a variety of wavelet types; see documentation for more information.

19.5 Boundary conditions

Unlike Haar, other wavelets always involve weighting more than two neighbor- ing elements to create the average and detail vectors. This means assumptions need to be made to compute the coefficients at the edges of the data. Because wavelets have compact , these assumptions are localized near the bound- aries (but propagate inward for higher analysis levels). By default the Matlab wavelet toolbox pads the data with zeros to compute wavelet coefficients near boundaries; this can be a poor choice. A better assumption is to extend the data Amath 482/582 Lecture 19 Bretherton - Winter 2014 3 by a copy with the indices reversed; this avoids introducing artificial boundary discontinuities. The extended data looks as follows:

uext = . . . u4, u3, u2|u1, u2, . . . uN |uN−1, uN−2,... (19.5.1)

This can be invoked using dwtmode(’sym’).