The dwt2() function performs single level 2D Discrete Wavelet Transform.
Parameters: 


Returns one average and three details 2D coefficients arrays. The coefficients arrays are organized in tuples in the following form:
(cA, (cH, cV, cD))
where cA, cH, cV, cD denote approximation, horizontal detail, vertical detail and diagonal detail coefficients respectively.
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.]]
The idwt2() function reconstructs data from the given coefficients set by performing single level 2D Inverse Discrete Wavelet Transform.
Parameters: 


Example:
>>> import pywt, numpy
>>> data = numpy.array([[1,2], [3,4]], dtype=numpy.float64)
>>> coeffs = pywt.dwt2(data, 'haar')
>>> print pywt.idwt2(coeffs, 'haar')
[[ 1. 2.]
[ 3. 4.]]
Performs multilevel 2D Discrete Wavelet Transform decomposition and returns coefficients list:
[cAn, (cHn, cVn, cDn), ..., (cH1, cV1, cD1)]
where n denotes the level of decomposition and cA, cH, cV and cD are approximation, horizontal detail, vertical detail and diagonal detail coefficients arrays respectively.
Parameters: 


Example:
>>> import pywt, numpy
>>> coeffs = pywt.wavedec2(numpy.ones((8,8)), 'db1', level=2)
>>> cA2, (cH2, cV2, cD2), (cH1, cV1, cD1) = coeffs
>>> print cA2
[[ 4. 4.]
[ 4. 4.]]
Performs multilevel reconstruction from the given coefficients set.
Parameters: 


Example:
>>> import pywt, numpy
>>> coeffs = pywt.wavedec2(numpy.ones((4,4)), 'db1')
>>> print "levels:", len(coeffs)1
levels: 2
>>> print pywt.waverec2(coeffs, 'db1')
[[ 1. 1. 1. 1.]
[ 1. 1. 1. 1.]
[ 1. 1. 1. 1.]
[ 1. 1. 1. 1.]]