ilwt2
Description
returns the 2-D inverse wavelet transform based on the approximation
coefficients, xr
= ilwt2(ll
,lh
,hl
,hh
)ll
, and the horizontal
(lh
), vertical (hl
), and diagonal
(hh
) wavelet coefficients. By default,
ilwt2
assumes that you used the lifting scheme
associated with the db1
wavelet to obtain the coefficients.
If you have not modified the coefficients, xr
is a perfect
reconstruction of the signal.
Examples
Inverse 2-D Lifting Wavelet Transform
Load and display the 128-by-128 xbox
image.
load xbox imagesc(xbox) title("Original Image")
Obtain the 2-D LWT of the image using default settings. Preserve integer values.
[ll,lh,hl,hh] = lwt2(xbox,Int2Int=true);
Obtain the inverse LWT up to level 1. Confirm the size of the reconstruction is 64-by-64.
xr = ilwt2(ll,lh,hl,hh,Level=1,Int2Int=true); size(xr)
ans = 1×2
64 64
imagesc(xr)
title("Level 1 Reconstruction")
Obtain the inverse LWT using default settings. Confirm perfect reconstruction.
xr = ilwt2(ll,lh,hl,hh,Int2Int=true); max(abs(xr(:)-xbox(:)))
ans = 0
Inverse LWT of 2-D Multisignal to Specified Level
Load the 3-D wmri
data set. The data consists of 27 128-by-128 magnetic resonance images (MRI) arranged in a 128-by-128-by-27 array.
load wmri
Display some of the slices along the Z-orientation of the original data set.
map = pink(90); idxImages = 1:3:size(X,3); figure("DefaultAxesXTick",[],"DefaultAxesYTick",[],... "DefaultAxesFontSize",8,"Color","w") colormap(map) for k = 1:9 j = idxImages(k); subplot(3,3,k) image(X(:,:,j)) str = sprintf("Z = %d",j); title(str) end
By default, lwt2
performs the wavelet decomposition along the rows and columns of the input data. Use lwt2
to obtain the 2-D LWT of each 128-by-128 slice in the 3-D data set using the lifting scheme associated with the bior3.5
wavelet. Preserve the integer-valued data.
lscheme = liftingScheme(Wavelet="bior3.5");
[ll,lh,hl,hh] = lwt2(X,LiftingScheme=lscheme,Int2Int=true);
Inspect the dimensions of a detail coefficients cell array. Confirm the coefficients at each level is a 3-D array, and the size of the third dimension is 27.
hh
hh=7×1 cell array
{64x64x27 double}
{32x32x27 double}
{16x16x27 double}
{ 8x8x27 double}
{ 4x4x27 double}
{ 2x2x27 double}
{ 1x1x27 double}
Obtain the inverse 2-D LWT up to level 1. Confirm the size of the 3-D reconstruction is 64-by-64-by-27.
xr = ilwt2(ll,lh,hl,hh,LiftingScheme=lscheme,Int2Int=true,Level=1); size(xr)
ans = 1×3
64 64 27
Choose any slice from the original data set, and perform the same LWT operations on that slice. Confirm the reconstruction is equal to the corresponding slice in the 3-D reconstruction array.
num = 13; slice = X(:,:,num); [lls,lhs,hls,hhs] = lwt2(slice,LiftingScheme=lscheme,Int2Int=true); xrs = ilwt2(lls,lhs,hls,hhs,LiftingScheme=lscheme,Int2Int=true,Level=1); max(max(abs(xrs-xr(:,:,num))))
ans = 0
Compare the reconstruction of the slice with the original version.
figure colormap(map) subplot(1,2,1) image(X(:,:,num)) title("Original") subplot(1,2,2) image(xrs) title("Level 1 Reconstruction")
Input Arguments
ll
— Approximation coefficients
scalar | vector | matrix
Approximation coefficients at the coarsest scale, specified as a
scalar, vector, or matrix. The coefficients are the output of
lwt2
.
Data Types: single
| double
Complex Number Support: Yes
lh
— Horizontal detail coefficients
cell array
Horizontal detail coefficients by level, specified as a
LEV-by-1 cell array, where
LEV is the level of the decomposition. The
elements of lh
are in order of decreasing
resolution. The coefficients are the output of lwt2
.
Data Types: single
| double
Complex Number Support: Yes
hl
— Vertical detail coefficients
cell array
Vertical detail coefficients by level, specified as a
LEV-by-1 cell array, where
LEV is the level of the decomposition. The
elements of hl
are in order of decreasing
resolution. The coefficients are the output of lwt2
.
Data Types: single
| double
Complex Number Support: Yes
hh
— Diagonal detail coefficients
cell array
Diagonal detail coefficients by level, specified as a
LEV-by-1 cell array, where
LEV is the level of the decomposition. The
elements of hh
are in order of decreasing
resolution. The coefficients are the output of lwt2
.
Data Types: single
| double
Complex Number Support: Yes
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: xr =
ilwt2(ll,lh,hl,hh,Wavelet="db2",Int2Int=true)
Wavelet
— Wavelet
"db1"
(default) | character vector | string scalar
Orthogonal or biorthogonal wavelet to use in the inverse LWT,
specified as a character vector or string scalar. See the
Wavelet property of
liftingScheme
for the list of supported
wavelets. For perfect reconstruction, you must specify the same
wavelet that you used to obtain the coefficients
ll
, lh
,
hl
, and hh
.
You cannot specify Wavelet
and
LiftingScheme
at the same time.
Example: xr =
ilwt2(ll,lh,hl,hh,Wavelet="bior3.5")
uses the
bior3.5
biorthogonal
wavelet.
Data Types: char
| string
LiftingScheme
— Lifting scheme
liftingScheme
object
Lifting scheme to use in the inverse LWT, specified as a liftingScheme
object. For perfect reconstruction,
you must specify the same lifting scheme that you used to obtain
the coefficients ll
,
lh
, hl
, and
hh
.
You cannot specify LiftingScheme
and
Wavelet
at the same time.
Example: xr =
ilwt2(ll,lh,hl,hh,LiftingScheme=lScheme)
uses the
lScheme
lifting scheme.
Level
— Reconstruction level
0
(default) | positive integer
Reconstruction level, specified as a nonnegative integer less
than or equal to length(hh)
-1. If you do not
specify a level, the function sets the reconstruction level to
0
and xr
is a
perfect reconstruction of the signal.
Example: xr = ilwt2(ll,lh,hl,hh,Level=2)
reconstructs the signal up to level 2.
Data Types: double
Extension
— Extension mode
"periodic"
(default) | "zeropad"
| "symmetric"
Extension mode to use in the inverse LWT, specified as one of these:
"periodic"
— Periodized extension"zeropad"
— Zero extension"symmetric"
— Symmetric extension
This argument specifies how to extend the signal at the boundaries.
Example: xr =
ilwt2(ll,lh,hl,hh,Extension="zeropad")
specifies
zero extension.
Int2Int
— Handling integer-valued data
false
or
0
(default) | true
or 1
Integer-valued data handling, specified as one of these:
1
(true
) — Preserve integer-valued data0
(false
) — Do not preserve integer-valued data
Specify Int2Int
only if all coefficients are
integers.
Example: xr = ilwt2(ll,lh,hl,hh,Int2Int=true)
preserves integer-valued data.
Output Arguments
xr
— Inverse wavelet transform
matrix
Inverse wavelet transform, returned as a matrix.
xr
has the same dimensionality as the input
used by the lwt2
function to
generate the approximation and details coefficients.
References
[1] Strang, Gilbert, and Truong Nguyen. Wavelets and Filter Banks. Rev. ed. Wellesley, Mass: Wellesley-Cambridge Press, 1997.
[2] Sweldens, Wim. “The Lifting Scheme: A Construction of Second Generation Wavelets.” SIAM Journal on Mathematical Analysis 29, no. 2 (March 1998): 511–46. https://doi.org/10.1137/S0036141095289051.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021bR2021b: ilwt2
input syntax has changed
The ilwt2
input syntax has changed. Use name-value
arguments instead.
Functionality | Result | Use Instead | Compatibility Considerations |
---|---|---|---|
X = ilwt2(CA,CH,CV,CD,W) | Errors | X =
ilwt2(CA,CH,CV,CD,Wavelet=W) | You can also set the
LiftingScheme name-value
argument to obtain the inverse LWT. |
X =
ilwt2(CA,CH,CV,CD,W,LEVEL) | Errors | X =
ilwt2(CA,CH,CV,CD,Wavelet=W,Level=LEVEL) | You can also set the Extension
and Int2Int name-value
arguments. |
X = ilwt2(AD_In_Place,W) | Errors | NA | In-place transforms are no longer supported. |
See Also
lwt2
| lwtcoef2
| haart2
| ihaart2
| liftingScheme
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)