Coding wavelets the easy way

Structure of the Discrete Wavelet Transform (DWT)


If we perform an N-1 recursion of the decomposition of the scheme in the previous page (which corresponds to the left part of the diagram; the right part, where we recover a signal, is called the reconstruction), then we will have to store
  • One signal which is the output of the signal through the successive low pass filters (with subsampling in these settings)
  • N signals which correspond to the details obtained at each level of the recursion
All of this signals a structured, so, if we want to store this beast into one variable, the variable structure that we use must be quite flexible.

Cells


We shall use the following:
cell(N,1) creates a vector like cell array of empty matrices. Referencing the i-th element of a such a cell array name cellname is done by using curly braces, i.e. cellname{i}.
Now let us proceed with the structure of our Wavelet Transform, which we shall name WT.
At the highest level, it will be a structure with two fields:
  • WT.LoRes which contains the (structured) low resolution representation of the signal at the current scale depth
  • WT.Details which is a vector cell array as described above, with WT.Details{i} containing the (structured) detail at scale i
Such a flexible container is required because all of the signals have different lengths and different supports.