主要内容

appcoef2

2-D approximation coefficients

Description

A = appcoef2(C,S,wname) returns the approximation coefficients at the coarsest scale using the wavelet decomposition structure [C,S] of a 2-D signal and the wavelet specified by wname. (See wavedec2 for more information.)

A = appcoef2(C,S,LoR,HiR) uses the lowpass reconstruction filter LoR and highpass reconstruction filter HiR. (See wfilters for more information.)

A = appcoef2(___,N) returns the approximation coefficients at level N. If [C,S] is the M-level wavelet decomposition structure of a 2-D signal, then 0 ≤ N ≤ M.

example

Examples

collapse all

This example shows how to reconstruct approximation coefficients from a multilevel wavelet decomposition of an image.

Set the DWT extension mode to zero-padding. Load and display an image.

origmode = dwtmode('status','nodisplay');
dwtmode('zpd','nodisp')
load woman
image(X)
colormap(map)
title('Original')

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

size(X)
ans = 1×2

   256   256

Perform a three-level wavelet decomposition of the image using the db1 wavelet. Display the number of elements in the coefficients array cfs, and the contents of the bookkeeping matrix inds. Note that cfs has the same number of elements as X.

wv = 'db1';
[cfs,inds] = wavedec2(X,3,wv);
numel(X)
ans = 
65536
numel(cfs)
ans = 
65536
inds
inds = 5×2

    32    32
    32    32
    64    64
   128   128
   256   256

Extract and display the approximation coefficients at level 2.

cfs2 = appcoef2(cfs,inds,wv,2);
figure
imagesc(cfs2)
colormap('gray')
title('Level 2 Approximation Coefficients')

Figure contains an axes object. The axes object with title Level 2 Approximation Coefficients contains an object of type image.

size(cfs2)
ans = 1×2

    64    64

Extract and display the approximation coefficients at level 3.

cfs3 = appcoef2(cfs,inds,wv,3);
figure
imagesc(cfs3)
colormap('gray')
title('Level 3 Approximation Coefficients')

Figure contains an axes object. The axes object with title Level 3 Approximation Coefficients contains an object of type image.

size(cfs3)
ans = 1×2

    32    32

Restore the original extension mode.

dwtmode(origmode,'nodisplay')

Input Arguments

collapse all

Wavelet decomposition vector of a 2-D signal, specified as a vector. C is the output of wavedec2. The bookkeeping matrix S contains the dimensions of the coefficients by level.

Example: [C,S] = wavedec2(randn(256,256),4,'db4') returns the 4-level wavelet decomposition of a matrix.

Data Types: double
Complex Number Support: Yes

Bookkeeping matrix of the wavelet decomposition of a 2-D signal, specified as a matrix of positive integers. The bookkeeping matrix is used to parse the coefficients in the wavelet decomposition vector C by level.

Example: [C,S] = wavedec2(randn(256,256),4,'db4') returns the 4-level wavelet decomposition of a matrix.

Data Types: double

Wavelet used to generate the wavelet decomposition of a 2-D signal, specified as a character vector or string scalar.

The wavelet must be recognized by wavemngr. The wavelet is from one of the following wavelet families:

  • Best-localized Daubechies

  • Beylkin

  • Coiflets

  • Complex Symlets (since R2026a)

  • Daubechies

  • Fejér-Korovkin

  • Haar

  • Han linear-phase moments

  • Morris minimum-bandwidth

  • Symlets

  • Vaidyanathan

  • Discrete Meyer

  • Biorthogonal

  • Reverse Biorthogonal

See wfilters for the wavelets available in each family.

Example: 'db4'

Wavelet reconstruction filters, specified as a pair of even-length vectors. LoR is the lowpass reconstruction filter, and HiR is the highpass reconstruction filter. The lengths of LoR and HiR must be equal. For perfect reconstruction, LoR and HiR must be the reconstruction filters associated with the same wavelet used to obtain the wavelet decomposition c and s. For more information, see wfilters

Data Types: double
Complex Number Support: Yes

Approximation coefficients level, specified as a positive integer. If [C,S] is the M-level wavelet decomposition structure of a 2-D signal, then 0 ≤ N ≤ M.

Data Types: double

Output Arguments

collapse all

Approximation coefficients at level N, returned as a matrix or 3-D array. If C and S are obtained from an indexed image analysis or a truecolor image analysis, A is an m-by-n matrix or an m-by-n-by-3 array, respectively.

For more information on image formats, see image and imfinfo.

Data Types: double
Complex Number Support: Yes

Algorithms

The input vector C and bookkeeping matrix S contain all the information about the 2-D signal decomposition.

Let NMAX = size(S,1)-2; then C = [A(NMAX) H(NMAX) V(NMAX) D(NMAX) … H(1) V(1) D(1)] where A, H, V, and D are vectors. If N = NMAX, then a simple extraction is done; otherwise, appcoef2 computes iteratively the approximation coefficients using the inverse wavelet transform.

Extended Capabilities

expand all

Version History

Introduced before R2006a

expand all

See Also

|