Wavelet Toolbox™ software enables you to analyze signals, images, and 3-D data using orthogonal and biorthogonal critically-sampled discrete wavelet analysis. Critically-sampled discrete wavelet analysis is also known as decimated discrete wavelet analysis. Decimated discrete wavelet analysis is most appropriate for data compression, denoising, and the sparse representation of certain classes of signals and images.
In decimated discrete wavelet analysis, the scales and translations are dyadic.
You can perform 1-D, 2-D, and 3-D decimated discrete wavelet
analysis using the interactive tool,
This example shows how to denoise a signal using discrete wavelet analysis.
Create a reference signal.
len = 2^11; h = [4 -5 3 -4 5 -4.2 2.1 4.3 -3.1 5.1 -4.2]; t = [0.1 0.13 0.15 0.23 0.25 0.40 0.44 0.65 0.76 0.78 0.81]; h = abs(h); w = 0.01*[0.5 0.5 0.6 1 1 3 1 1 0.5 0.8 0.5]; tt = linspace(0,1,len); xref = zeros(1,len); for j=1:11 xref = xref + ( h(j) ./ (1+ ((tt-t(j))/w(j)).^4)); end
Add zero-mean white Gaussian noise with a variance of 0.25.
rng default; x = xref + 0.5*randn(size(xref)); plot(x); set(gca,'xlim',[1 2048]);
Denoise the signal down to level 3 using the Daubechies
least asymmetric wavelet with 4 vanishing moments. Use the universal
threshold selection rule of Donoho and Johnstone with soft thresholding
based on the DWT coefficients at level 1. Use the periodization signal
extension mode —
dwtmode('per'). Plot the
result along with the reference signal for comparision.
dwtmode('per'); [xd,cxd,lxd] = wden(x,'sqtwolog','s','sln',4,'sym4'); plot(xd); set(gca,'xlim',[1 2048]); hold on; plot(xref,'r');
This example shows how to obtain the 2-D DWT of an input image.
Load and display the image. The image consists of vertical, horizontal, and diagonal patterns.
load tartan; imagesc(X); colormap(gray);
Obtain the 2-D DWT at level 1 using the biorthogonal B-spline wavelet and scaling filters with 2 vanishing moments in the analysis filters and 4 vanishing moments in the synthesis filters. Extract the horizontal, vertical, and diagonal wavelet coefficients and the approximation coefficients. Display the results.
[C,S] = wavedec2(X,1,'bior2.4'); [H,V,D] = detcoef2('all',C,S,1); A = appcoef2(C,S,'bior2.4'); subplot(221); imagesc(A); title('Approximation Level 1'); colormap(gray); subplot(222); imagesc(H); title('Horizontal Details'); subplot(223); imagesc(V); title('Vertical Details'); subplot(224); imagesc(D); title('Diagonal Details');
You see that the wavelet details are sensitive to particular orientations in the input image. The approximation coefficients are a lowpass approximation to the original image.