Single-level discrete 2-D wavelet transform (periodized).
Syntax
[cA,cH,cV,cD] = dwtper2(X,'wname')
[cA,cH,cV,cD] = dwtper2(X,Lo_D,Hi_D)
Description
dwtper2 is a two-dimensional wavelet analysis function.
[cA,cH,cV,cD] = dwtper2(X,'wname') computes the approximation coefficients matrix cA and details coefficients matrices cH, cV, and cD, obtained by periodized wavelet decomposition of the input matrix X.
'wname' is a string containing the wavelet name (see wfilters).
Instead of giving the wavelet name, you can give the filters. When used with three arguments: [cA,cH,cV,cD] = dwtper2(X,Lo_D,Hi_D), Lo_D is the decomposition low-pass filter and Hi_D is the decomposition high-pass filter.
If sx = size(X) then size(cA) = size(cH) = size(cV) = size(cD) = ceil(sx/2).
Examples
% Set initial signal and get filters.
load tire
% X contains the loaded image.
sx = size(X)
sx =
205 232
w = 'db9';
[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(w);
% DWT with zero-padding image extension.
[ca0,ch0,cv0,cd0] = dwt2(X,w);
% The transform uses some extra coefficients.
sxtzp = 2*size(ca0)
sxtzp =
222 248
% Reconstruction
x0 = idwt2(ca0,ch0,cv0,cd0,w,sx);
% Error with zero-padding.
err0 = max(max(abs(X-x0)))
err0 =
6.3292e-09
% Periodized DWT
[cap,chp,cvp,cdp] = dwtper2(X,w);
% The transform uses a minimum of extra coefficients.
lxtp = 2*size(cap)
lxtp =
206 232
% Reconstruction.
xp = idwtper2(cap,chp,cvp,cdp,w,sx);
% Error with periodized DWT.
errp = max(max(abs(X-xp)))
errp =
6.7353e-09
Algorithm
See the dwtper algorithm section.
See Also
dwt2, idwtper2
[ Previous | Help Desk | Next ]