주요 콘텐츠

cfs2wpt

Wavelet packet tree construction from coefficients

    Description

    [T,X] = cfs2wpt(wname,size_of_data,tn_of_tree,order) builds a wavelet packet tree T and the related analyzed signal or image X. The cfs2wpt function uses the wavelet specified by wname, the dimensions of the analyzed data size_of_data, the terminal node indices tn_of_tree and the order order. All the tree coefficients are zero.

    [T,X] = cfs2wpt(wname,size_of_data,tn_of_tree,order,cfs) uses the specified coefficients cfs.

    example

    Examples

    collapse all

    This example shows how to build a wavelet packet tree in two ways:

    1. By filling the wavelet packet tree with coefficients.

    2. By creating the wavelet packet tree and using write.

    Load an image and obtain the wavelet packet decomposition down to level 2 using the sym4 wavelet.

    load detail
    imagesc(X)
    colormap gray
    title("Original Image")

    Figure contains an axes object. The axes object with title Original Image contains an object of type image.

    Tr = wpdec2(X,2,"sym4");

    Read the coefficients from the wavelet packet tree. Add N(0,402) noise to the coefficients and plot the new wavelet packet tree.

    cfs = read(Tr,"allcfs");
    noisyCfs = cfs + 40*rand(size(cfs));
    noisyT = cfs2wpt("sym4",size(X),leaves(Tr),4,noisyCfs);
    plot(noisyT)

    Figure contains 2 axes objects and other objects of type uimenu. Axes object 1 with title Tree Decomposition contains 41 objects of type line, text. Axes object 2 with title data for node: 0 or (0,0). contains an object of type image.

    To illustrate building a wavelet packet tree using write, construct an admissible binary wavelet packet tree with terminal nodes [2 3 9 10]. The analyzing wavelet is sym4 and the signal length is 1024.

    tr = cfs2wpt("sym4",[1 1024],[2 3 9 10]',2);

    Fill terminal nodes [3 9] with N(0,1) coefficients.

    sN = read(tr,"sizes",[3,9]);
    sN3 = sN(1,:);
    sN9 = sN(2,:);
    cfsN3 = randn(sN3);
    cfsN9 = randn(sN9);
    tr = write(tr,"cfs",3,cfsN3,"cfs",9,cfsN9);

    Plot the resulting wavelet packet tree and synthesized signal.

    plot(tr)

    Figure contains 2 axes objects and other objects of type uimenu. Axes object 1 with title Tree Decomposition contains 13 objects of type line, text. Axes object 2 with title data for node: 0 or (0,0). contains an object of type line.

    Input Arguments

    collapse all

    Wavelet used in the analysis, specified as a character vector or string scalar. The wavelet is from one of the following wavelet families: Best-localized Daubechies, Beylkin, Coiflets, Daubechies, Fejér-Korovkin, Haar, Han linear-phase moments, Morris minimum-bandwidth, Symlets, Vaidyanathan, Discrete Meyer, Biorthogonal, and Reverse Biorthogonal. See wfilters for the wavelets available in each family.

    Dimensions of the analyzed signal or image, specified as a vector.

    Terminal node indices of the tree, specified as a vector.

    Type of analyzed data. specified as 2 for a signal, and 4 for an image.

    Tree node coefficients, specified as a vector.

    Output Arguments

    collapse all

    Wavelet packet tree, returned as a wptree object. All tree node coefficients are zero unless you specify cfs.

    Analyzed signal or image, returned as a vector or matrix respectively.

    Version History

    Introduced before R2006a

    See Also

    |