Source

pywt / doc / source / ref / 2d-dwt-and-idwt.rst

The default branch has multiple heads

Full commit

2D Forward and Inverse Discrete Wavelet Transform

Single level dwt2

The relation to the other common data layout where all the approximation and details coefficients are stored in one big 2D array is as follows:

                            -------------------
                            |        |        |
                            | cA(LL) | cH(LH) |
                            |        |        |
(cA, (cH, cV, cD))  <--->   -------------------
                            |        |        |
                            | cV(HL) | cD(HH) |
                            |        |        |
                            -------------------

PyWavelets does not follow this pattern because of pure practical reasons of simple access to particular type of the output coefficients.

Example:

>>> import pywt, numpy
>>> data = numpy.ones((4,4), dtype=numpy.float64)
>>> coeffs = pywt.dwt2(data, 'haar')
>>> cA, (cH, cV, cD) = coeffs
>>> print cA
[[ 2.  2.]
 [ 2.  2.]]
>>> print cV
[[ 0.  0.]
 [ 0.  0.]]

Single level idwt2

2D multilevel decomposition using wavedec2

2D multilevel reconstruction using waverec2