# lwt2

2-D lifting wavelet transform

## Syntax

```[CA,CH,CV,CD] = lwt2(X,W) X_InPlace = lwt2(X,LS) lwt2(X,W,LEVEL) X_InPlace = lwt2(X,W,LEVEL,'typeDEC',typeDEC) [CA,CH,CV,CD] = LWT2(X,W,LEVEL,'typeDEC',typeDEC) ```

## Description

`lwt2` performs a 2-D lifting wavelet decomposition with respect to a particular lifted wavelet that you specify.

`[CA,CH,CV,CD] = lwt2(X,W)` computes the approximation coefficients matrix `CA` and detail coefficients matrices `CH`, `CV`, and `CD`, obtained by a lifting wavelet decomposition, of the matrix `X`. `W` is a lifted wavelet name (see `liftwave`).

`X_InPlace = lwt2(X,LS)` computes the approximation and detail coefficients. These coefficients are stored in place:

• `CA = X_InPlace(1:2:end,1:2:end)`

• `CH = X_InPlace(2:2:end,1:2:end)`

• `CV = X_InPlace(1:2:end,2:2:end)`

• `CD = X_InPlace(2:2:end,2:2:end)`

`lwt2(X,W,LEVEL)` computes the lifting wavelet decomposition at level `LEVEL`.

`X_InPlace = lwt2(X,W,LEVEL,'typeDEC',typeDEC)` or ```[CA,CH,CV,CD] = LWT2(X,W,LEVEL,'typeDEC',typeDEC)``` with ```typeDEC = 'w'``` or `'wp'` computes the wavelet or the wavelet packet decomposition using lifting, at level `LEVEL`.

Instead of a lifted wavelet name, you may use the associated lifting scheme `LS`: `lwt2(X,LS,...)` instead of `LWT2(X,W,...)`.

For more information about lifting schemes, see `lsinfo`.

## Examples

```% Start from the Haar wavelet and get the % corresponding lifting scheme. lshaar = liftwave('haar'); % Add a primal ELS to the lifting scheme. els = {'p',[-0.125 0.125],0}; lsnew = addlift(lshaar,els); % Perform LWT at level 1 of a simple image. x = reshape(1:16,4,4); [cA,cH,cV,cD] = lwt2(x,lsnew) cA = 5.7500 22.7500 10.0000 27.0000 cH = 1.0000 1.0000 1.0000 1.0000 cV = 4.0000 4.0000 4.0000 4.0000 cD = 0 0 0 0 % Perform integer LWT of the same image. lshaarInt = liftwave('haar','int2int'); lsnewInt = addlift(lshaarInt,els); [cAint,cHint,cVint,cDint] = lwt2(x,lsnewInt) cAint = 3 11 5 13 cHint = 1 1 1 1 cVint = 4 4 4 4 cDint = 0 0 0 0 ```

## Tips

When X represents an indexed image, X, as well as the output arrays cA,cH,cV,cD, or `X_InPlace` are `m`-by-`n` matrices. When X represents a truecolor image, it 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.

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

## Algorithms

This function implements the polyphase algorithm.

`lwt` reduces to `dwt` with zero-padding extension mode and without extra-coefficients.

## References

Strang, G.; T. Nguyen (1996), Wavelets and filter banks, Wellesley-Cambridge Press.

Sweldens, W. (1998), “The Lifting Scheme: a Construction of Second Generation of Wavelets,” SIAM J. Math. Anal., 29 (2), pp. 511–546. 