2-D Discrete Wavelet Function in Matlab 71
2-D Discrete Wavelet Function in Matlab 71
2-D Discrete Wavelet Function in Matlab 71
function y=dyadup(x,arg2,arg3)
DYADUP Dyadic upsampling.
DYADUP
implements a simple zero-padding scheme very useful in the wavelet
reconstruction algorithm.
Y = DYADUP(X,EVENODD),
where X is a vector, returns an extended copy of vector X obtained
by inserting zeros. Whether the zeros are inserted as even- or odd-
indexed elements of Y depends on the value of positive integer
EVENODD:
If EVENODD is even, then Y(2k+1) = X(k), Y(2k) = 0.
If EVENODD is odd, then Y(2k+1) = 0 , Y(2k) = X(k).
Y = DYADUP(X) is equivalent to
Y = DYADUP(X,1).
Y = DYADUP(X,EVENODD, ‘type’) or
Y = DYADUP(X, ‘type’, EVENODD)
where X is a matrix, return extended copies of X obtained by in-
serting columns of zeros (or rows or both) if ‘type’ = ‘c’ (or ‘r’ or
‘m’ respectively), according to the parameter EVENODD which is as
above.
Y = DYADUP(X) is equivalent to
Y = DYADUP(X,1, ‘c’).
Y = DYADUP(X, ‘type’) is equivalent to
Y = DYADUP(X,1, ‘type’).
Y = DYADUP(X,EVENODD) is equivalent to
Y = DYADUP(X,EVENODD, ‘c’)
function x = idwt2(a,h,v,d,arg5,arg6,arg7)
IDWT2 Single-level inverse discrete 2-D wavelet transform.
IDWT2
performs a single-level 2-D wavelet reconstruction with respect to
either a particular wavelet (‘wname’, see WFILTERS) or particular
wavelet reconstruction filters you specify.
DWT2(CA,CH,CV,CD, ‘wname’)
uses the wavelet ‘wname” to compute the single-level reconstructed
approximation coefficients matrix X based on approximation matrix
CA and (horizontal, vertical, and diagonal) details matrices CH, CV
and CD.
X = IDWT2(CA,CH,CV,CD,Lo R,Hi R)
74 JIANZHONG WANG
function x = idwtper2(a,h,v,d,arg5,arg6,arg7)
IDWTPER2 Single-level inverse discrete 2-D wavelet transform (pe-
riodized).
X = IDWTPER2(CA,CH,CV,CD, ‘wname’)
returns the single-level reconstructed approximation coefficients ma-
trix X based on approximation and details matrices CA, CH, CV and
CD at a given level, using the periodized inverse wavelet transform.
‘wname’ is a string containing the wavelet name (see WFILTERS).
Instead of giving the wavelet name, you can give the filters. For
X = IDWTPER2(CA,CH,CV,CD,Lo R,Hi R),
Lo R is the reconstruction low-pass filter and Hi R is the recon-
struction high-pass filter.
If sa = size(CA) = size(CH) = size(CV) = size(CD) then size(X)
= 2*sa. For
X = IDWTPER2(CA,CH,CV,CD, ‘wname’,S) or
X = IDWTPER2(CA,CH,CV,CD,Lo R,Hi R,S),
S is the size of the result.
function y = upcoef2(o,x,arg3,arg4,arg5,arg6)
UPCOEF2 Direct reconstruction from 2-D wavelet coefficients.
Y = UPCOEF2(O,X, ‘wname’,N,S)
computes the N steps reconstructed coefficients of matrix X and
takes the size-S central portion of the result. ‘wname’ is a string con-
taining the name of the wavelet.
If O = ‘a’, approximation coefficients are reconstructed, otherwise
if O = ‘h’ (or ‘v’ or ‘d’), horizontal (vertical or diagonal respectively),
detail coefficients are reconstructed. N must be a strictly positive in-
teger. Instead of giving the wavelet name, you can give the filters.
For
Y = UPCOEF2(O,X,Lo R,Hi R,N,S)
Lo R is the reconstruction low-pass filter and Hi R is the recon-
struction high-pass filter.
Y = UPCOEF2(O,X, ‘wname’,N) or
Y = UPCOEF2(O,X,Lo R,Hi R,N),
return the computed result without any truncation.
3. 2-D DISCRETE WAVELET FUNCTION IN MATLAB 75
function x = waverec2(c,s,arg3,arg4)
WAVEREC2 Multi-level 2-D wavelet reconstruction.
WAVEREC2
performs a multi-level 2-D wavelet reconstruction using either a
specific wavelet ( ‘wname’, see WFILTERS) or specific reconstruction
filters (Lo R and Hi R).
X = WAVEREC2(C,S, ‘wname’)
reconstructs the matrix X based on the multi-level wavelet decom-
position structure [C,S] (see WAVEDEC2). For
X = WAVEREC2(C,S,Lo R,Hi R),
Lo R is the reconstruction low-pass filter and Hi R is the recon-
struction high-pass filter.
function x = wrcoef2(o,c,s,arg4,arg5,arg6)
WRCOEF2 Reconstruct single branch from 2-D wavelet coefficients.
WRCOEF2 reconstructs the coefficients of an image.
X = WRCOEF2( ‘type’,C,S, ‘wname’,N)
computes the matrix of reconstructed coefficients of level N, based
on the wavelet decomposition structure [C,S] (see WAVEDEC2). ‘wname’
is a string containing the name of the wavelet. If ‘type’ = ‘a’, approxi-
mation coefficients are reconstructed otherwise if ‘type’ = ‘h’ ( ‘v’ or ‘d’
respectively), horizontal (vert. or diag. respectively) detail coefficients
are reconstructed.
Level N must be an integer such that:
0 ¡= N ¡= size(S,1)-2 if ‘type’ = ‘a’ and such that
1 ¡= N ¡= size(S,1)-2 if ‘type’ = ‘h’, ‘v’ or ‘d’.
Instead of giving the wavelet name, you can give the filters. For
X = WRCOEF2( ‘type’,C,S,Lo R,Hi R,N),
Lo R is the reconstruction low-pass filter and Hi R is the recon-
struction high-pass filter.
X = WRCOEF2( ‘type’,C,S, ‘wname’) or
X = WRCOEF2( ‘type’,C,S,Lo R,Hi R)
reconstructs coefficients of maximum level N = size(S,1)-2.