Reconstruct single branch from 2-D wavelet coefficients
wrcoef2 is a two-dimensional wavelet analysis function.
wrcoef2 reconstructs the coefficients of an image.
returns the matrix of reconstructed coefficients of type
x = wrcoef2(
on the wavelet decomposition structure
[c,s] of an image (see
wavedec2 for more information) using
the wavelet specified by
wname. The coefficients at the maximum
decomposition level are reconstructed. The size of
x is equal to
the size of the original image.
Reconstruct 2-D Wavelet Coefficients
Save the current extension mode. Load an image.
origMode = dwtmode("status","nodisp"); load woman imagesc(X) title("Original") colormap gray
dwtmode to change the extension mode to zero-padding. Obtain the 2-level wavelet decomposition of the image using the
dwtmode("zpd","nodisp") [c,s] = wavedec2(X,2,"sym5");
Reconstruct the approximation coefficients at levels 1 and 2. Display the results.
a1 = wrcoef2("a",c,s,"sym5",1); a2 = wrcoef2("a",c,s,"sym5",2); subplot(1,2,1) imagesc(a1) title("Level 1") subplot(1,2,2) imagesc(a2) title("Level 2") colormap gray
Reconstruct the horizontal, vertical, and diagonal detail coefficients at level 2.
h2 = wrcoef2("h",c,s,"sym5",2); v2 = wrcoef2("v",c,s,"sym5",2); d2 = wrcoef2("d",c,s,"sym5",2);
Confirm all the reconstructions are the same size as the original image.
sX = size(X); sa1 = size(a1); sa2 = size(a2); sh2 = size(h2); sv2 = size(v2); sd2 = size(d2); [sX;sa1;sa2;sh2;sv2;sd2]
ans = 6×2 256 256 256 256 256 256 256 256 256 256 256 256
Restore the extension mode to the original setting.
type — Coefficients to reconstruct
Coefficients to reconstruct, specified as follows:
"a"— Approximation coefficients
"h"— Horizontal detail coefficients
"v"— Vertical detail coefficients
"d"— Diagonal detail coefficients
wname — Wavelet
character vector | string scalar
Wavelet, specified as a character vector or string scalar.
wrcoef2 supports only Type 1 (orthogonal) or Type 2
(biorthogonal) wavelets. See
wfilters for a list of orthogonal
and biorthogonal wavelets.
LoR,HiR — Wavelet reconstruction filters
even-length real-valued vectors
Wavelet reconstruction filters, specified as a pair of even-length real-valued
LoR is the lowpass reconstruction filter, and
HiR is the highpass reconstruction filter. The lengths of
HiR must be equal. See
wfilters for additional
x — Reconstructed coefficients
Reconstructed coefficients, returned as a matrix. The size of
x is equal to the size of the original image
Introduced before R2006a