Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# ndwt2

Nondecimated 2-D wavelet transform

## Syntax

WT = ndwt2(X,N,'wname')
WT = ndwt2(X,N,'wname','mode','ExtM')
WT = ndwt2(X,W,...)
WT = ndwt2(X,WF,...)

## Description

ndwt2 performs a multilevel 2-D nondecimated wavelet decomposition using a particular wavelet ('wname') or the wavelet filters you specify. The decomposition also uses the specified DWT extension mode (see dwtmode).

WT = ndwt2(X,N,'wname') returns a structure which contains the nondecimated wavelet transform of the vector X at the level N. N is a positive integer and 'wname' is a string containing the wavelet name. The default default extension mode is'sym'. For more information on wname, see wfilters.

WT = ndwt2(X,N,'wname','mode','ExtM') uses the extension mode specified in the string 'ExtM'.

WT is a structure with the fields shown in the table.

 sizeINI Size of the two-dimensional array X level Level of the decomposition mode Name of the wavelet transform extension mode filters Structure with 4 fields, LoD, HiD, LoR, HiR, which contain the filters used for DWT dec 1 by (3*level+1) cell array containing the coefficients of the decomposition. dec{1} contains the coefficients of the approximation and dec{j} (j = 2 to 3*level+1), contains the coefficients of the details from level level to level 1, three details by level (LH, HL and HH where L is low and H is high) sizes (level+1) by 2 array containing the size of the components

IWT = ndwt2(X,W,...) specifies two wavelets (one for each direction) with W = {'wname1','wname2'} or W is a structure with two fields 'w1', 'w2' containing strings, which are the names of wavelets, one per direction.

Instead of one or two wavelets, you may specify four filters (two for decomposition and two for reconstruction) or 2 x 4 filters (one quadruplet per direction):

WT = ndwt2(X,WF,...) specifies four filters (two for decomposition and two for reconstruction) or 2 x 4 filters (one quadruplet per direction). WF is a cell array (1x4) or (2x4), {LoD,HiD,LoR,HiR}, or a structure with the four fields 'LoD', 'HiD', 'LoR', 'HiR'.

## Examples

```% Load original image.

% Decompose X at level 2 using db1.
W1 = ndwt2(X,2,'db1')

W1 =

sizeINI: [96 96]
level: 2
filters: [1x1 struct]
mode: 'sym'
dec: {7x1 cell}
sizes: [3x2 double]

% Decompose X at level 3 using db1 and periodic
% extension mode.
W2 = ndwt2(X,3,'db1','mode','per')

W2 =

sizeINI: [96 96]
level: 3
filters: [1x1 struct]
mode: 'per'
dec: {10x1 cell}
sizes: [4x2 double]

% Decompose X at level 3 using db1 for rows, and db2 for
% columns, using symmetric extension mode.
W3 = ndwt2(X,3,{'db1','db2'},'mode','sym')

W3 =

sizeINI: [96 96]
level: 3
filters: [1x1 struct]
mode: 'sym'
dec: {10x1 cell}
sizes: [4x2 double]

WF = W3.filters

WF =

LoD: {[0.7071 0.7071]  [-0.1294 0.2241 0.8365 0.4830]}
HiD: {[-0.7071 0.7071]  [-0.4830 0.8365 -0.2241 -0.1294]}
LoR: {[0.7071 0.7071]  [0.4830 0.8365 0.2241 -0.1294]}
HiR: {[0.7071 -0.7071]  [-0.1294 -0.2241 0.8365 -0.4830]}

% Decompose X using filters given by WF.
W4 = ndwt2(X,3,WF,'mode','sym')

W4 =

sizeINI: [96 96]
level: 3
filters: [1x1 struct]
mode: 'sym'
dec: {10x1 cell}
sizes: [4x2 double]
```