Debian Codegraph @

doc/source/ref/2d-decompositions-overview.rst

raw
1
2 Overview of multilevel wavelet decompositions
3 =============================================
4
5 There are a number of different ways a wavelet decomposition can be performed
6 for multiresolution analysis of n-dimensional data. Here we will review the
7 three approaches currently implemented in PyWavelets. 2D cases are
8 illustrated, but each of the approaches extends to the n-dimensional case in a
9 straightforward manner.
10
11
12 Multilevel Discrete Wavelet Transform
13 -------------------------------------
14
15 The most common approach to the multilevel discrete wavelet transform involves
16 further decomposition of only the approximation subband at each subsequent
17 level. This is also sometimes referred to as the Mallat decomposition
18 [Mall89]_. In 2D, the discrete wavelet transform produces four sets of
19 coefficients corresponding to the four possible compinations of the wavelet
20 decomposition filters over the two separate axes. (In n-dimensions, there
21 are ``2**n`` sets of coefficients). For subsequent levels of decomposition,
22 only the approximation coefficients (the lowpass subband) are further
23 decomposed.
24
25 In PyWavelets, this decomposition is implemented for n-dimensional data by
26 :func:`~pywt.wavedecn` and the inverse by :func:`~pywt.waverecn`. 1D and 2D
27 versions of these routines also exist. It is illustrated in the figure below.
28 The top row indicates the coefficient names as used by :func:`~pywt.wavedec2`
29 after each level of decomposition. The bottom row shows wavelet coefficients
30 for the camerman image (with each subband independently normalized for easier
31 visualization).
32
33 .. plot:: pyplots/plot_mallat_2d.py
34
35 It can be seen that many of the coefficients are near zero (gray). This ability
36 of the wavelet transform to sparsely represent natural images is a key
37 property that makes it desirable in applications such as image compression and
38 restoration.
39
40 Fully Separable Discrete Wavelet Transform
41 ------------------------------------------
42 An alternative decomposition results in first fully decomposing one axis of the
43 data prior to moving onto each additional axis in turn. This is illustrated
44 for the 2D case in the upper right panel of the figure below. This approach has
45 a factor of two higher computational cost as compared to the Mallat approach,
46 but has advantages in compactly representing anisotropic data. A demo of this
47 is `available <https://github.com/PyWavelets/pywt/tree/master/demo/fswavedecn_mondrian.py>`_).
48
49 This form of the DWT is also sometimes referred to as the tensor wavelet
50 transform or the hyperbolic wavelet transform. In PyWavelets it is implemented
51 for n-dimensional data by :func:`~pywt.fswavedecn` and the inverse by
52 :func:`~pywt.fswaverecn`.
53
54 Wavelet Packet Transform
55 ------------------------
56
57 Another possible choice is to apply additional levels of decomposition to all
58 wavelet subbands from the first level as opposed to only the approximation
59 subband. This is known as the wavelet packet transform and is illustrated in
60 2D in the lower left panel of the figure. It is also possible to only perform
61 any subset of the decompositions, resulting in a wide number of potential
62 wavelet packet bases. An arbitrary example is shown in the lower right panel
63 of the figure below.
64
65 A further description is available in the
66 :ref:`wavelet packet documentation<ref-wp>`.
67
68 For the wavelet packets, the plots below use "natural" ordering for simplicity,
69 but this does not directly match the "frequency" ordering for these wavelet
70 packets. It is possible to rearrange the coefficients into frequency ordering
71 (see the ``get_level`` method of :class:`~pywt.WaveletPacket2D` and [Wick94]_
72 for more details).
73
74 .. plot:: pyplots/plot_2d_bases.py
75
76
77 .. rubric:: References
78
79 .. [Mall89] Mallat, S.G. "A Theory for Multiresolution Signal Decomposition: The Wavelet Representation" IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 2, no. 7. July 1989. DOI: 10.1109/34.192463
80
81 .. [Wick94] Wickerhauser, M.V. "Adapted Wavelet Analysis from Theory to Software" Wellesley. Massachusetts: A K Peters. 1994.