This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Discrete stationary wavelet transform 2-D


SWC = swt2(X,N,'wname')
[A,H,V,D] = swt2(X,N,'wname')
SWC = swt2(X,N,Lo_D,Hi_D)
[A,H,V,D] = swt2(X,N,Lo_D,Hi_D)


swt2 performs a multilevel 2-D stationary wavelet decomposition using either an orthogonal or a biorthogonal wavelet. Specify the wavelet using its name('wname', see wfilters for more information) or its decomposition filters.

SWC = swt2(X,N,'wname') or [A,H,V,D] = swt2(X,N,'wname') compute the stationary wavelet decomposition of the matrix X at level N, using 'wname'.

N must be a strictly positive integer (see wmaxlev for more information), and 2N must divide size(X,1) and size(X,2).

Outputs [A,H,V,D] are 3-D arrays, which contain the coefficients:

  • For 1 i N, the output matrix A(:,:,i) contains the coefficients of approximation of level i.

  • The output matrices H(:,:,i), V(:,:,i) and D(:,:,i) contain the coefficients of details of level i (horizontal, vertical, and diagonal):

    SWC = [H(:,:,1:N) ; V(:,:,1:N) ; D(:,:,1:N) ; A(:,:,N)]

SWC = swt2(X,N,Lo_D,Hi_D) or [A,H,V,D] = swt2(X,N,Lo_D,Hi_D), computes the stationary wavelet decomposition as in the previous syntax, given these filters as input:

  • Lo_D is the decomposition low-pass filter.

  • Hi_D is the decomposition high-pass filter.

Lo_D and Hi_D must be the same length.

    Note   swt2 is defined using dwt with periodic extension.


collapse all

Extract and display images of the stationary wavelet decomposition level coefficients. First load and display the original image. Then perform the stationary wavelet decomposition of the image at level 2 using db6.

load woman
[ca,chd,cvd,cdd] = swt2(X,2,'db6');

Extract the Level 1 and Level 2 approximation and detail coefficients from the decomposition.

A1 = wcodemat(ca(:,:,1),255);
H1 = wcodemat(chd(:,:,1),255);
V1 = wcodemat(cvd(:,:,1),255);
D1 = wcodemat(cdd(:,:,1),255);

A2 = wcodemat(ca(:,:,2),255);
H2 = wcodemat(chd(:,:,2),255);
V2 = wcodemat(cvd(:,:,2),255);
D2 = wcodemat(cdd(:,:,2),255);

Display the approximation and detail coefficients from the two levels.

title('Approximation Coef. of Level 1')

title('Horizontal Detail Coef. of Level 1')

title('Vertical Detail Coef. of Level 1')

title('Diagonal Detail Coef. of Level 1')

title('Approximation Coef. of Level 2')

title('Horizontal Detail Coef. of Level 2')

title('Vertical Detail Coef. of Level 2')

title('Diagonal Detail Coef. of Level 2')


When X represents an indexed image, X is an m-by-n matrix and the output arrays SWC or cA,cH,cV, and cD are m-by-n-by-p arrays.

When X represents a truecolor image, it becomes an m-by-n-by-3 array. This array is an m-by-n-by-3 array, where each m-by-n matrix represents a red, green, or blue color plane concatenated along the third dimension. The output arrays SWC or cA,cH,cV, and cD are m-by-n-by-p-by-3 arrays.

For more information on image formats, see the image and imfinfo reference pages.


For images, an algorithm similar to the one-dimensional case is possible for two-dimensional wavelets and scaling functions obtained from one-dimensional ones by tensor product.

This kind of two-dimensional SWT leads to a decomposition of approximation coefficients at levelj in four components: the approximation at level j+1, and the details in three orientations (horizontal, vertical, and diagonal).

The following chart describes the basic decomposition step for images:


Nason, G.P.; B.W. Silverman (1995), "The stationary wavelet transform and some statistical applications," Lecture Notes in Statistics, 103, pp. 281–299.

Coifman, R.R.; Donoho, D.L. (1995), "Translation invariant de-noising," Lecture Notes in Statistics, 103, pp. 125–150.

Pesquet, J.C.; H. Krim, H. Carfatan (1996), "Time-invariant orthonormal wavelet representations," IEEE Trans. Sign. Proc., vol. 44, 8, pp. 1964–1970.

See Also

| |

Introduced before R2006a

Was this topic helpful?