| 1 |
.. _ref-dwt2: |
| 2 |
|
| 3 |
.. currentmodule:: pywt |
| 4 |
|
| 5 |
================================================= |
| 6 |
2D Forward and Inverse Discrete Wavelet Transform |
| 7 |
================================================= |
| 8 |
|
| 9 |
|
| 10 |
Single level ``dwt2`` |
| 11 |
~~~~~~~~~~~~~~~~~~~~~ |
| 12 |
|
| 13 |
.. autofunction:: dwt2 |
| 14 |
|
| 15 |
The relation to the other common data layout where all the approximation and |
| 16 |
details coefficients are stored in one big 2D array is as follows: |
| 17 |
|
| 18 |
:: |
| 19 |
|
| 20 |
------------------- |
| 21 |
| | | |
| 22 |
| cA(LL) | cH(LH) | |
| 23 |
| | | |
| 24 |
(cA, (cH, cV, cD)) <---> ------------------- |
| 25 |
| | | |
| 26 |
| cV(HL) | cD(HH) | |
| 27 |
| | | |
| 28 |
------------------- |
| 29 |
|
| 30 |
PyWavelets does not follow this pattern because of pure practical reasons of simple |
| 31 |
access to particular type of the output coefficients. |
| 32 |
|
| 33 |
|
| 34 |
Single level ``idwt2`` |
| 35 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 36 |
|
| 37 |
.. autofunction:: idwt2 |
| 38 |
|
| 39 |
2D multilevel decomposition using ``wavedec2`` |
| 40 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 41 |
|
| 42 |
.. autofunction:: wavedec2 |
| 43 |
|
| 44 |
2D multilevel reconstruction using ``waverec2`` |
| 45 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 46 |
|
| 47 |
.. autofunction:: waverec2 |
| 48 |
|
| 49 |
|
| 50 |
2D coordinate conventions |
| 51 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 52 |
|
| 53 |
The labels for "horizontal" and "vertical" used by ``dwt2`` and ``idwt2`` |
| 54 |
follow the common mathematical convention that coordinate axis 0 |
| 55 |
is horizontal while axis 1 is vertical:: |
| 56 |
|
| 57 |
dwt2, idwt2 convention |
| 58 |
---------------------- |
| 59 |
|
| 60 |
axis 1 ^ |
| 61 |
| |
| 62 |
| |
| 63 |
| |
| 64 |
|---------> |
| 65 |
axis 0 |
| 66 |
|
| 67 |
Note that this is different from another common convention used in computer |
| 68 |
graphics and image processing (e.g. by matplotlib's ``imshow`` and functions in |
| 69 |
``scikit-image``). In those packages axis 0 is a vertical axis and axis 1 is |
| 70 |
horizontal as follows:: |
| 71 |
|
| 72 |
imshow convention |
| 73 |
------------------- |
| 74 |
axis 1 |
| 75 |
|---------> |
| 76 |
| |
| 77 |
| |
| 78 |
| |
| 79 |
axis 0 v |
| 80 |
|