DiscreteWaveletPacketTransform

DiscreteWaveletPacketTransform[data]

gives the discrete wavelet packet transform (DWPT) of an array of data.

DiscreteWaveletPacketTransform[data,wave]

gives the discrete wavelet packet transform using the wavelet wave.

DiscreteWaveletPacketTransform[data,wave,r]

gives the discrete wavelet packet transform using r levels of refinement.

Details and Options

  • DiscreteWaveletPacketTransform gives a DiscreteWaveletData object.
  • Properties of the DiscreteWaveletData dwd can be found using dwd["prop"], and a list of available properties can be found using dwd["Properties"].
  • DiscreteWaveletPacketTransform is a generalization of DiscreteWaveletTransform where the full tree of wavelet coefficients is computed.
  • The data can be any of the following:
  • listarbitrary-rank numerical array
    imagearbitrary Image object
    audioan Audio or sampled Sound object
  • The resulting wavelet coefficients are arrays of the same depth as the input data.
  • The possible wavelet wave include:
  • BattleLemarieWavelet[]BattleLemarié wavelets based on B-spline
    BiorthogonalSplineWavelet[]B-spline-based wavelet
    CoifletWavelet[]symmetric variant of Daubechies wavelets
    DaubechiesWavelet[]the Daubechies wavelets
    HaarWavelet[]classic Haar wavelet
    MeyerWavelet[]wavelet defined in the frequency domain
    ReverseBiorthogonalSplineWavelet[]B-spline-based wavelet (reverse dual and primal)
    ShannonWavelet[]sinc function-based wavelet
    SymletWavelet[]least asymmetric orthogonal wavelet
  • The default wave is HaarWavelet[].
  • With higher settings for the refinement level r, larger-scale features are resolved.
  • The default refinement level r is given by min(TemplateBox[{{{InterpretationBox[{log, _, DocumentationBuild`Utils`Private`Parenth[2]}, Log2, AutoDelete -> True], (, n, )}, +, {1, /, 2}}}, Floor],4), where is the minimum dimension of data.
  • With refinement level Full, r is given by TemplateBox[{{{InterpretationBox[{log, _, DocumentationBuild`Utils`Private`Parenth[2]}, Log2, AutoDelete -> True], (, n, )}, +, {1, /, 2}}}, Floor].
  • The tree of wavelet coefficients at level consists of coarse coefficients and detail coefficients with representing the input data.
  • The forward transform is given by , , , and .
  • The inverse transform is given by .
  • The are lowpass filter coefficients and are highpass filter coefficients that are defined for each wavelet family.
  • The dimensions of and are given by wd_(j+1)=TemplateBox[{{{1, /, 2},  , {(, {{wd, _, j}, +, fl, -, 2}, )}}}, Ceiling] where is the input data dimension and fl is the filter length for the corresponding wspec.
  • The following options can be given:
  • MethodAutomaticmethod to use
    Padding "Periodic"how to extend data beyond boundaries
    WorkingPrecision MachinePrecisionprecision to use in internal computations
  • The settings for Padding are the same as available in ArrayPad.
  • InverseWaveletTransform gives the inverse transform.
  • By default, InverseWaveletTransform uses coefficients represented by dwd["BasisIndex"] for reconstruction. Use WaveletBestBasis to compute and set an optimal basis.

Examples

open allclose all

Basic Examples  (3)

Compute a wavelet packet transform:

The resulting DiscreteWaveletData represents a full tree of wavelet coefficients:

The inverse transform reconstructs the input:

Transform an audio signal:

Use dwd[,"Audio"] to extract coefficient signals:

Compute the inverse transform:

Transform an Image object:

Use dwd[,"Image"] to extract coefficient images:

Compute the inverse transform:

Scope  (34)

Basic Uses  (5)

Useful properties can be extracted from the DiscreteWaveletData object:

Get a full list of properties:

Get data and coefficient dimensions:

Use Normal to get all wavelet coefficients explicitly:

Also use All as an argument to get all coefficients:

Use Automatic to get only the coefficients used in the inverse transform:

Use the "TreeView" or "IndexMap" to find out what wavelet coefficients are available:

Extract specific coefficient arrays:

Extract several wavelet coefficients corresponding to a list of wavelet index specifications:

Extract all coefficients whose wavelet indexes match a pattern:

Use WaveletBestBasis to compute an optimal basis of wavelet packet coefficients:

Highlight the best basis in a block grid of all coefficients:

Extract the best basis using "BasisIndex":

The computed best basis is used by default in functions like WaveletListPlot:

Use a higher refinement level to increase the frequency resolution:

With a smaller refinement level, more of the signal energy is left in {0,0}:

With further refinement, {0,0} is resolved into further components:

Wavelet Families  (10)

Compute the wavelet packet transform using different wavelet families:

Compare the coefficients:

Use different families of wavelets to capture different features:

HaarWavelet (default):

DaubechiesWavelet:

BattleLemarieWavelet:

BiorthogonalSplineWavelet:

CoifletWavelet:

MeyerWavelet:

ReverseBiorthogonalSplineWavelet:

ShannonWavelet:

SymletWavelet:

Vector Data  (6)

Plot the coefficients over a common horizontal axis using WaveletListPlot:

Plot against a common vertical axis:

Visualize coefficients as a function of time and refinement level using WaveletScalogram:

The coefficient indexes appear as tooltips when the mouse pointer is moved over a coefficient:

WaveletScalogram of the best tree representation of the data:

Constant data:

All coefficients are small except coarse coefficients {0,0,}:

Data oscillating at the highest resolvable frequency (Nyquist frequency):

Only the first detail coefficient {1} and its coarse child coefficients {1,0,0,} are not small:

Data with large discontinuities:

Coarse coefficients {0,} have the same large-scale structure as the data:

Detail coefficients are sensitive to discontinuities:

Data with both spatial and frequency structure:

Coarse coefficients {0,} track the local mean of the data:

First detail coefficient {1} and its coarse child coefficients {1,0,} represent the oscillations:

All coefficients on a common vertical axis:

Matrix Data  (5)

Compute a two-dimensional wavelet packet transform:

View the tree of wavelet coefficients:

Inverse transform to get back the original signal:

Use WaveletMatrixPlot to visualize the different wavelet coefficients:

WaveletMatrixPlot of best tree representation:

In two dimensions, the vector of filtering operations in each direction can be computed:

Interpreting these vectors as binary digit expansions results in wavelet index numbers:

Get the lowpass and highpass filters for a Haar wavelet:

The resulting 2D filters are outer products of filters in the two directions:

Wavelet transform of step data:

Data with a vertical discontinuity:

All horizontal and diagonal detail coefficients, wavelet index {___,2|3,___}, are zero:

Data with horizontal discontinuity:

All vertical and diagonal detail coefficients, wavelet index {___,1|3,___}, are zero:

Data with diagonal discontinuity:

All horizontal and vertical detail coefficients, wavelet index {___,1|2,___}, are zero:

Array Data  (2)

Compute a three-dimensional wavelet packet transform:

Block grid view of all coefficients:

Wavelet transform of a three-dimensional cross array:

Visualize lowpass wavelet coefficients {___,0}:

Energy of the original data is conserved within the transformed coefficients:

Image Data  (3)

Transform an Image object:

The inverse transform yields a reconstructed Image object:

Wavelet coefficients are normally given as lists of data for each image channel:

Get all coefficients as Image objects instead:

Get raw Image objects with no rescaling of color levels:

Get the inverse transform of the {0,1} coefficient as an Image object:

Compute a best tree of coefficients from a packet transform of image data:

Plot the best tree in a hierarchical grid using WaveletImagePlot:

Sound Data  (3)

Transform a Sound object:

The inverse transform yields a reconstructed Sound object:

By default, coefficients are given as lists of data for each sound channel:

Get the {1,1} coefficient as a Sound object:

Inverse transform of {1,1} coefficient as a Sound object:

Compute a best tree of coefficients from a packet transform of sound data:

Browse the best tree coefficients using a MenuView:

Generalizations & Extensions  (3)

DiscreteWaveletPacketTransform works on arrays of symbolic quantities:

Inverse transform recovers the input exactly:

Specify any internal working precision:

Use complex-valued data:

The wavelets coefficients are complex:

Options  (5)

Padding  (2)

The settings for Padding are the same as the methods for ArrayPad, including "Periodic":

"Reversed":

"ReversedNegation":

"Reflected":

"ReflectedDifferences":

"ReversedDifferences":

"Extrapolated":

Padding can remove boundary effects:

Use the default "Periodic" padding:

"Extrapolated" padding lessens boundary effects for nonperiodic data:

WorkingPrecision  (3)

By default, WorkingPrecision->MachinePrecision is used:

Use higher-precision computation:

With numbers close to zero, accuracy is the better indicator of the number of correct digits:

Use WorkingPrecision-> for exact computation:

Applications  (3)

Best Tree Analysis  (2)

The default reconstruction tree contains the coefficients at the maximum refinement level:

Choose a reconstruction tree with energy concentrated in a small number of coefficients:

Plot the best tree coefficients against a common vertical axis:

Visualize default reconstruction tree coefficients for image data:

Compute the reconstruction tree whose coefficients have the smallest total log energy:

Compression  (1)

Lossless compression of matrix data:

In the best tree wavelet packet representation many coefficients are zero:

Count nonzero coefficients as a measure of compressed size:

Nonzero values in original data:

Length of data:

Properties & Relations  (11)

DiscreteWaveletPacketTransform computes the full tree of wavelet coefficients:

DiscreteWaveletTransform computes a subset of the full tree of coefficients:

DiscreteWaveletPacketTransform coefficients halve in length with each level of refinement:

Rotated data gives different coefficients:

StationaryWaveletPacketTransform coefficients have the same length as the original data:

Rotated data gives rotated coefficients:

Multidimensional discrete wavelet transform is related to one-dimensional packet transform:

For Haar wavelet (default) and data length , the computed coefficients are identical:

The default refinement is given by Min[Round[Log2[Min[Dimensions[data]]]],4]:

In higher dimensions:

The energy norm is conserved for orthogonal wavelet families:

The energy norm is approximately conserved for biorthogonal wavelet families:

The mean of the data is captured at the maximum refinement level of the transform:

Extract the coefficient for the maximum refinement level:

Compensate for the normalization at each refinement level:

The sum of inverse transforms from individual coefficient arrays gives the original data:

Individually inverse transform each wavelet coefficient array:

The sum gives the original data:

HaarWavelet corresponds to averaging (lowpass filter) and differencing (highpass filter):

Compute {0} and {1} wavelet coefficients:

Compare with DiscreteWaveletPacketTransform:

In two dimensions a separate filter is applied in each dimension:

Lowpass and highpass filters for Haar wavelet:

Haar wavelet transform of matrix data:

Compare with DiscreteWaveletPacketTransform using HaarWavelet:

Image channels are transformed individually:

Combine {0} coefficients of separately transformed image channels:

Compare with {0} coefficient of DiscreteWaveletPacketTransform of original image:

The images are identical:

Possible Issues  (1)

Padding can affect the total energy of wavelet coefficients:

Energy is not conserved:

Pad with 0s to ensure energy conservation in the coefficients:

Wolfram Research (2010), DiscreteWaveletPacketTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteWaveletPacketTransform.html (updated 2017).

Text

Wolfram Research (2010), DiscreteWaveletPacketTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteWaveletPacketTransform.html (updated 2017).

CMS

Wolfram Language. 2010. "DiscreteWaveletPacketTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/DiscreteWaveletPacketTransform.html.

APA

Wolfram Language. (2010). DiscreteWaveletPacketTransform. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiscreteWaveletPacketTransform.html

BibTeX

@misc{reference.wolfram_2024_discretewaveletpackettransform, author="Wolfram Research", title="{DiscreteWaveletPacketTransform}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/DiscreteWaveletPacketTransform.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_discretewaveletpackettransform, organization={Wolfram Research}, title={DiscreteWaveletPacketTransform}, year={2017}, url={https://reference.wolfram.com/language/ref/DiscreteWaveletPacketTransform.html}, note=[Accessed: 21-November-2024 ]}