cpt.2d(x, crystal.names=NULL, basis="block.cpt.2d", cost.fun="threshold",
n.levels=NULL, taper="poly2", dct.type=2, boundary="periodic",
n.taper=NULL, scale=NULL, thresh=NULL, p=1, prob=.75)
icpt.2d(x)
cpt.2d, an image or matrix. Row length must be
divisible by
2^(n.levels) and
column length must be divisible by
2^(n.levels).
If mean(x) != 0, should de-mean first (see below). For
icpt.2d,
an object of
cpt.2d.
"cj.h-cj.v".
where
j is an integer giving the level and
h is an integer from
0 to
2^j-1
giving the horizontal block number and
v is an integer from
0 to
2^j-1
giving the vertical block number.
If
crystal.names is supplied, then
basis is ignored.
"best.basis" or
"block.cpt.2d".
See the respective help files for details.
"entropy",
"threshold",
"sure", and "
lp" are available.
Only used for
"best.basis".
See
cp.costs.2d for details.
x is divided into
2^(2*n.levels)
nrow(x)/2^n.levels by
ncol(x)/2^n.levels
blocks. For
"best.basis",
n.levels gives the blocking factor for the finest level.
When both
crystal.names and
basis are missing,
2D subband basis of
n.levels is computed.
If
n.levels is bigger than
ml, where
ml is the maximum possible level,
computed from the
max.level function, then
n.levels is set to
ml and
a warning message is given.
2 or
4 indicating which of DCT-II or DCT-IV should be used.
See the function
dct for details.
"boxcar", "poly1", "poly2", "poly3", "poly4", "poly5", or
"trig".
See the function
cp.table for details.
"cp.reflect", "periodic"
and
"zero".
See the function
cp.table for details.
2*n.taper.
By default,
n.taper is set to
length(x)/2^(n.level+1),
which is the maximum possible length at the finest blocking level.
cost.fun.
See the function
cp.costs.2d for details.
(0,2] giving the degree of the
lpnorm when
cost.fun is
"lp".
See the function
cp.costs.2d for details.
cost.fun is
"threshold" or
"sure".
See the function
cp.costs.2d for details.
(0,1) used to
compute the threshold for when
cost.fun is
"threshold".
See the function
cp.costs.2d for details.
cpt.2d returns an object of class
cpt.2d, inheriting from
the class
crystal.matrix.
The object is a matrix of the same size as
x with crystal names as an
attribute.
icpt.2d returns an image if
x is an object of class
cpt.2d.
The default optional arguments
n.levels, taper, dct.type, boundary
can be reset using function
wavelet.options, see
wavelet.options for details.
The algorithms for the taper functions are given in the
S+WAVELETS User's Manual,
in the section "Cosine Packet Algorithms". They are discussed in
greater depth in Wickerhauser (1994).
Wickerhauser, M. V. (1994). Adapted Wavelet Analysis from Theory to Software. A. K. Peters Ltd, Wellesley, MA.
xx <- phone-mean(phone)
par(mfrow=c(1,2))
image(xx)
bb2 <- crystal.names("block.dct.2d", 2)
cc2 <- cpt.2d(xx, crystal.names=bb2, taper="poly2")
thresh <- rep(3.7, 16)
ss2 <- shrink(cc2, thresh)
zz <- reconstruct(ss2)
image(zz)