Denoising or compression
[XC,CXC,LXC,PERF0,PERFL2] = wdencmp('gbl',X,wname,N,THR,SORH,KEEPAPP)
[___] = wdencmp('gbl',C,L,wname,N,THR,SORH,KEEPAPP)
[___] = wdencmp('lvl',X,wname,N,THR,SORH)
[___] = wdencmp('lvl',C,L,wname,N,THR,SORH)
returns a denoised or compressed version
PERFL2] = wdencmp('gbl',
XC of the input data
X obtained by wavelet coefficients thresholding using the
global positive threshold
X is a
real-valued vector or matrix. [
N-level wavelet decomposition structure of
wavedec2 for more information).
PERF0 are the
L2-norm recovery and compression
scores in percentages, respectively. If
KEEPAPP = 1, the
approximation coefficients are kept. If
KEEPAPP = 0, the
approximation coefficients can be thresholded.
Denoise 1-D electricity consumption data using the Donoho-Johnstone global threshold.
Load the signal and select a segment for denoising.
load leleccum; indx = 2600:3100; x = leleccum(indx);
ddencmp to determine the default global threshold and denoise the signal. Plot the original and denoised signals.
[thr,sorh,keepapp] = ddencmp('den','wv',x); xd = wdencmp('gbl',x,'db3',2,thr,sorh,keepapp); subplot(211) plot(x); title('Original Signal'); subplot(212) plot(xd); title('Denoised Signal');
Denoise an image in additive white Gaussian noise using the Donoho-Johnstone universal threshold.
Load an image and add white Gaussian noise.
load sinsin Y = X+18*randn(size(X));
ddencmp to obtain the threshold.
[thr,sorh,keepapp] = ddencmp('den','wv',Y);
Denoise the image. Use the order 4 Symlet and a two-level wavelet decomposition. Plot the original image, the noisy image, and the denoised result.
xd = wdencmp('gbl',Y,'sym4',2,thr,sorh,keepapp); subplot(2,2,1) imagesc(X) title('Original Image') subplot(2,2,2) imagesc(Y) title('Noisy Image') subplot(2,2,3) imagesc(xd) title('Denoised Image')
X— Input data
Input data to denoise or compress, specified by a real-valued vector or matrix.
C— Wavelet expansion coefficients
L— Size of wavelet expansion coefficients
N— Level of wavelet decomposition
Level of wavelet decomposition, specified as a positive integer.
Threshold to apply to the wavelet coefficients, specified as a scalar, real-valued vector, or real-valued matrix.
For the case
THR is a scalar.
For the one-dimensional case and
THR is a length
N real-valued vector containing the
For the two-dimensional case and
THR is a
N matrix containing the
level-dependent thresholds in the three orientations:
horizontal, diagonal, and vertical.
SORH— Type of thresholding
Type of thresholding to perform:
's' — Soft thresholding
'h' — Hard thresholding
wthresh for more
KEEPAPP— Threshold approximation setting
Threshold approximation setting, specified as either
KEEPAPP = 1, the
approximation coefficients cannot be thresholded. If
0, the approximation coefficients can be thresholded.
XC— Denoised or compressed data
Denoised or compressed data, returned as a real-valued vector or matrix.
X have the same
LXC— Size of wavelet expansion coefficients
Size of wavelet expansion coefficients of the denoised or compressed data
XC, specified as a vector or matrix of positive
integers. If the data is one-dimensional,
LXC is a
vector of positive integers (see
wavedec for more
information). If the data is two-dimensional,
LXC is a
matrix of positive integers (see
wavedec2 for more
PERF0— Compression score
Compression score, returned as a real number.
is the percentage of thresholded coefficients that are equal to 0.
PERFL2— L2 energy recovery
PERFL2 = 100 * (vector-norm of
[C,L] denotes the wavelet decomposition structure of
X is a one-dimensional signal and
'wname' an orthogonal wavelet,
PERFL2 is reduced to
The denoising and compression procedures contain three steps:
The two procedures differ in Step 2. In compression, for each level in the wavelet decomposition, a threshold is selected and hard thresholding is applied to the detail coefficients.
 DeVore, R. A., B. Jawerth, and B. J. Lucier. “Image Compression Through Wavelet Transform Coding.” IEEE Transactions on Information Theory. Vol. 38, Number 2, 1992, pp. 719–746.
 Donoho, D. L. “Progress in Wavelet Analysis and WVD: A Ten Minute Tour.” Progress in Wavelet Analysis and Applications (Y. Meyer, and S. Roques, eds.). Gif-sur-Yvette: Editions Frontières, 1993.
 Donoho, D. L., and I. M. Johnstone. “Ideal Spatial Adaptation by Wavelet Shrinkage.” Biometrika. Vol. 81, pp. 425–455, 1994.
 Donoho, D. L., I. M. Johnstone, G. Kerkyacharian, and D. Picard. “Wavelet Shrinkage: Asymptopia?” Journal of the Royal Statistical Society, series B, Vol. 57, No. 2, pp. 301–369, 1995.
 Donoho, D. L., and I. M. Johnstone. “Ideal denoising in an orthonormal basis chosen from a library of bases.” C. R. Acad. Sci. Paris, Ser. I, Vol. 319, pp. 1317–1322, 1994.
 Donoho, D. L. “De-noising by Soft-Thresholding.” IEEE Transactions on Information Theory. Vol. 42, Number 3, pp. 613–627, 1995.
Usage notes and limitations:
Variable-size data support must be enabled.