Main Content

ddencmp

Default values for denoising or compression

Description

ddencmp returns default values for denoising or compression for the critically sampled discrete wavelet or wavelet packet transform.

example

[thr,sorh,keepapp] = ddencmp(in1,in2,x) returns default values for denoising or compression, using wavelets or wavelet packets, of the input data x. x is a real-valued vector or 2-D matrix. thr is the threshold, and sorh indicates soft or hard thresholding. keepapp can be used as a flag to set whether or not the approximation coefficients are thresholded.

  • Set in1 to 'den' for denoising or 'cmp' for compression.

  • Set in2 to 'wv' to use wavelets or 'wp' to use wavelet packets.

example

[___,crit] = ddencmp(in1,'wp',x) also returns the entropy type, crit. See wpdec for more information.

Examples

collapse all

Determine the default global denoising threshold for an N(0,1) white noise input. Create an N(0,1) white noise input. Change the DWT extension mode to periodic. Set the random number generator to the default initial settings for reproducible results.

origmode = dwtmode('status','nodisplay');
dwtmode('per','nodisp')
rng default
x = randn(512,1);

Use ddencmp to obtain the default global threshold for wavelet denoising. Demonstrate that the threshold is equal to the universal threshold of Donoho and Johnstone scaled by a robust estimate of the variance.

[thr,sorh,keepapp] = ddencmp('den','wv',x);
[A,D] = dwt(x,'db1');
noiselev = median(abs(D))/0.6745;
thresh = sqrt(2*log(length(x)))*noiselev;

Compare the value of the variable thr to the value of thresh.

thr
thr = 3.3639
thresh
thresh = 3.3639

Restore the original extension mode.

dwtmode(origmode,'nodisplay')

Determine the default global compression threshold for an N(0,1) white noise input.

Create an N(0,1) white noise input. Set the DWT extension mode to periodic. Set the random number generator to the default initial settings for reproducible results.

origmode = dwtmode('status','nodisplay');
dwtmode('per','nodisp')
rng default
x = randn(512,1);

Use ddencmp with the 'cmp' and 'wp' input arguments to return the default global compression threshold for a wavelet packet transform.

[thr,sorh,keepapp,crit] = ddencmp('cmp','wp',x)
thr = 0.6424
sorh = 
'h'
keepapp = 1
crit = 
'threshold'

Compare with the default values returned for denoising.

[thr,sorh,keepapp,crit] = ddencmp('den','wp',x)
thr = 4.1074
sorh = 
'h'
keepapp = 1
crit = 
'sure'

Restore the original extension mode.

dwtmode(origmode,'nodisplay')

Input Arguments

collapse all

Purpose of ddencmp output, specified as:

  • 'den' — Denoising

  • 'cmp' — Compression

Transform type to be used for denoising or compression, specified as:

  • 'wv' — Critically sampled discrete wavelet transform. This output can be used with wdencmp.

  • 'wp' — Critically sampled wavelet packet transform. This output can be used with wpdencmp.

Input data to be denoised or compressed, specified as a real-valued vector or 2-D matrix.

Data Types: double

Output Arguments

collapse all

Threshold for denoising or compression, returned as a real number. Use this output with wdencmp or wpdencmp.

Thresholding type for denoising or compression, returned as a character.

  • 's' — Soft thresholding

  • 'h' — Hard thresholding

Use this output with wdencmp or wpdencmp.

Threshold approximation setting, returned as 1. Use this output with wdencmp or wpdencmp. If keepapp = 1, the approximation coefficients are not thresholded.

Entropy type when denoising or compressing with wavelet packets, returned as a character vector. Use this output only with wpdencmp. See wpdec for more information.

References

[1] Donoho, D. L. “De-noising by Soft-Thresholding.” IEEE Transactions on Information Theory, Vol. 42, Number 3, pp. 613–627, 1995.

[2] Donoho, D. L., and Johnstone, I. M. “Ideal Spatial Adaptation by Wavelet Shrinkage.” Biometrika, Vol. 81, pp. 425–455, 1994.

[3] Donoho, D. L., and I. M. Johnstone. "Ideal denoising in an orthonormal basis chosen from a library of bases." Comptes Rendus Acad. Sci. Paris, Ser. I, Vol. 319, pp. 1317–1322, 1994.

Extended Capabilities

Version History

Introduced before R2006a