Compute 2D Cosine Packet Costs

DESCRIPTION:
Computes 2D cosine packet costs.

USAGE:
cp.costs.2d(x, cost.fun="threshold", n.levels=NULL, taper="poly2",
            dct.type=2, boundary="periodic", n.taper=NULL,
            scale=NULL, thresh=NULL, p=2, prob=.5)

REQUIRED ARGUMENTS:
x:
an image. Row length must be divisible by 2^(n.levels[1]) and column length must be divisible by 2^(n.levels[2]), see below. Should demean first.

OPTIONAL ARGUMENTS:
cost.fun:
character string indicating which cost functional to use: "entropy", "lp", "threshold", and "cpentropy". See details below.
n.levels:
a non-negative integer specifying the blocking factor: 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. 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.
dct.type:
one of 2 or 4 indicating, respectively, which of DCT-II or DCT-IV should be used. See the function dct for details.
taper:
a character string, indicating the taper function: "boxcar", "poly1", "poly2", "poly3", "poly4", "poly5", or "trig". See the function cp.table for details.
boundary:
a character string, available boundary rules: "cp.reflect", "periodic" and "zero". See the function cp.table for details.
n.taper:
a non-negative integer. The length of the taper will be 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.
scale:
scaling factor for "entropy" and "cpentropy". The default is vecnorm(dct.2d(x)). See below for details.
p:
a number in the interval (0,2] giving the degree of the lp-norm when cost.fun is "lp". See below for details.
thresh:
a non-negative number giving the threshold when cost.fun is "threshold" or "sure". By default, thresh is the probth percentile of the absolute value of the DCT coefficients. See below for details.
prob:
a number between 0 and 1 which is used to compute the threshold thresh for when cost.fun is "threshold". See the thresh argument.


VALUE:
a 2-D packet cost object with class pcosts.2d. A packet cost object can be used with the best.basis function to select optimal cosine packet transforms for images.

DETAILS:
See the printed help file for full descriptions of the cost fucntionals listed below.

Available cost functionals:

  • a version of entropy for cosine packets.

    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).


  • REFERENCES:
    Wickerhauser, M. V. (1994). Adapted Wavelet Analysis -- from theory to software.

    The default optional arguments n.levels, taper, dct.type, boundary can be reset using function wavelet.options, see wavelet.options for details.


    SEE ALSO:
    cpt.2d , dct , pcosts , pcosts.2d.object , max.level , wavelet.options .

    EXAMPLES:
    phone <- phone-mean(phone)
    ccost <- cp.costs.2d(phone, taper="poly2", n.levels=3)
    bb2 <- best.basis.2d(ccost, phone)
    bb2
    plot(bb2)