upwlev2
Single-level reconstruction of 2-D wavelet decomposition
Description
Examples
Perform Single-Level Reconstruction of 2-D Wavelet Decomposition
Load an image.
load porche
image(X)
colormap(map)
Save the current extension mode, and set the extension mode to zero-padding.
origmode = dwtmode("status","nodisp"); dwtmode("zpd","nodisp")
Obtain the DWT decomposition of the image down to level 2. Use the Haar wavelet.
wv = "haar";
[c,s] = wavedec2(X,2,wv);
size(c)
ans = 1×2
1 262144
s
s = 4×2
128 128
128 128
256 256
512 512
Use the appcoef2
function to extract the approximation coefficients from the wavelet decomposition structure [c
,s
].
a = appcoef2(c,s,wv); size(a)
ans = 1×2
128 128
Perform the single-level reconstruction of the wavelet decomposition structure [c
,s
]. Also obtain the approximation matrix at level 2. Confirm the total number of coefficients has not changed, and the approximation coefficients obtained using appcoef2
and upwlev2
are equal.
[nc,ns,ca] = upwlev2(c,s,wv); size(nc)
ans = 1×2
1 262144
ns
ns = 3×2
256 256
256 256
512 512
max(max(abs(a-ca)))
ans = 0
Restore the original extension mode.
dwtmode(origmode,"nodisp")
Input Arguments
wname
— Analyzing wavelet
character vector | string scalar
Analyzing wavelet, specified as a character vector or string scalar.
wname
must specify the same wavelet used to obtain
the original wavelet decomposition structure
[
.
The c
,s
]wavedec2
function supports
only orthogonal and biorthogonal wavelets. See wfilters
for a list of
orthogonal and biorthogonal wavelets.
Data Types: char
| string
LoR,HiR
— Wavelet reconstruction filters
vectors
Wavelet reconstruction filters, specified as a pair of even-length
real-valued vectors. LoR
is the lowpass reconstruction
filter, and HiR
is the highpass reconstruction filter.
LoR
and HiR
must correspond to the
wavelet used to obtain the original wavelet decomposition structure
[
.
The lengths of c
,s
]LoR
and HiR
must be
equal. See wfilters
for a list of
orthogonal and biorthogonal wavelets.
Data Types: double
Output Arguments
nc
— Wavelet decomposition
vector
Wavelet decomposition, returned as a vector. The vector contains the
wavelet coefficients. [c,s]
is a decomposition at level
n = size(s,1)-2
, so
[nc,ns]
is the same decomposition at level
n-1. The bookkeeping matrix ns
contains the contains the dimensions of the wavelet coefficients by level
and is used to parse the wavelet decomposition vector
nc
.
Data Types: double
ns
— Bookkeeping matrix
vector
Bookkeeping matrix, returned as a matrix of positive integers. The
bookkeeping matrix is used to parse the coefficients in the wavelet
decomposition nc
by level.
Data Types: double
ca
— Approximation matrix
vector
Approximation matrix at level n, where
n =
size(
.s
,1)-2
If c
and s
are obtained from an
indexed image analysis or a truecolor image analysis,
ca
is an
m-by-n matrix or an
m-by-n-by-3 array, respectively.
For more information, see wavedec2
.
For more information on image formats, see image
and imfinfo
.
Data Types: double
Version History
Introduced before R2006a
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 (한국어)