Вы находитесь на странице: 1из 5

Lecture 1 - Linear and Non-Linear Wavelet Approximation

http://www.ceremade.dauphine.fr/~peyre/teaching/wavelets/tp1.html

Lecture 1 - Linear and Non-Linear 1D Wavelet Approximation


Abstract : The goals of this lecture is to manipulate wavelet transforms of 1D signals. We will thus learn how to apply this transform and to discover its structures. At last, we will perform linear and non-linear approximation by keeping only a few coefficients.

Computation and visualization of wavelet transforms.


1D wavelet transform (download functions perform_wavelet_transform.m et load_signal.m) % loading a 1D signal n = 256; f = load_signal('Piece-Regular', n); % 1D wavelet transform (you can use other wavelet filters by looking at the 'options' field) Jmin = 4; % minimum scale of the transform fw = perform_wavelet_transform(f,Jmin,+1); % computation of the transform until scale Jmin % draw the original image clf; subplot(2,1,1); plot(f); axis tight; title('Original signal'); % draw the transformed coefficients (try to understand their structure) subplot(2,1,2); plot(fw); axis tight; title('Transformed coefficients');

1 de 5

31/08/2011 12:21 a.m.

Lecture 1 - Linear and Non-Linear Wavelet Approximation

http://www.ceremade.dauphine.fr/~peyre/teaching/wavelets/tp1.html

Examples of piecewise regular signal together with its transformed coefficients. Large coefficients are located, at each scale, near the discontinuities of the signal. Moreover, coefficients become larges at coarser scales (on the left). Finer scale are on the right, and the finest scale represent the n/2 coefficients on the right side of the transform. Inverse transforms f1 = perform_wavelet_transform(fw,Jmin,-1); % should recover the same signal

Linear and non-linear wavelet approximation.


Approximation by setting to 0 the last coefficients. % keep only the M first coefficients M = 80; fwM = fw; fwM(M+1:end) = 0; % reconstruction fM = perform_wavelet_transform(fwM,Jmin,-1); Non linear approximation using thresholding. % you have to find the threshold in order to keep only the M highest coefficients T = ???; % perform the thresholding fwT = fw .* (abs(fw)>T); % reconstruction fT = perform_wavelet_transform(fwT,Jmin,-1); Display approximated signals
2 de 5 31/08/2011 12:21 a.m.

Lecture 1 - Linear and Non-Linear Wavelet Approximation

http://www.ceremade.dauphine.fr/~peyre/teaching/wavelets/tp1.html

clf; subplot(3,1,1); plot(f); axis tight; title('Original signal'); subplot(3,1,2); plot(fM); axis tight; title( ['Linear approximation with ' num2str(M) ' coefficients.']); subplot(3,1,3); plot(fT); axis tight; title( ['Non-linear approximation with ' num2str(M) ' coefficients.']);

Comparison of linear and non-linear approximation. Linear wavelet approxomation is not efficient beceause of the discontinuities in the original signal. One can see oscillation near discontinuities because we did not keep enough fine scale coefficients in order to reconstruct well these step discontinuities. The non-linear approximation performs better because it adapts itself to the signal by keeping only high coefficients, that are localised near the steps. Comparaison of the approximation errors |f-fM|^2; for both methods. % linear v_lin = cumsum( fw(end:-1:1).^2 ); v_lin = v_lin(end:-1:1); % non-linear v = sort( abs(fw) ); v_nl = cumsum( v.^2 ); v_nl = v_nl(end:-1:1); % log/log plot of the errors clf; loglog( 1:length(v_lin), v_lin, 1:length(v_lin), v_nl ); legend('linear', 'non-linear'); axis([1 length(v_lin) 1e-5 max(v_lin) ]);

3 de 5

31/08/2011 12:21 a.m.

Lecture 1 - Linear and Non-Linear Wavelet Approximation

http://www.ceremade.dauphine.fr/~peyre/teaching/wavelets/tp1.html

Decreasing of the approximation errors. The theory predicts that the linear error should decrease like M^-1, whereas the non-linear approximation should decrease like M^-alpha, where alpha is the exponent of regularity of the function outside the steps. Everything happens as if the non-linear approximation allows us to "forget" the discontinuities.

Comparison with the Fourier transform.


Computation of the Fourier transform and linear approximation in 1D % 1D Fourier transform ff = fft(f); % approximation ff = fftshift(ff); M = 80; ffM = ff; ffM(1:end/2-M/2) = 0; ffM(end/2+M/2+1:end) = 0; ff = fftshift(ff); ffM = fftshift(ffM); % reconstruction fM = real(ifft(ffM)); % inverse % display clf; subplot(3,1,1); plot(f); axis tight; title('Original'); subplot(3,1,2); plot(-length(ff)/2+1:length(ff)/2, fftshift(abs(ff))); axis tight; title('Fourier') subplot(3,1,3); plot(fM); axis tight; title(['Linear approx. with ' num2str(M) ' coefficients']);

4 de 5

31/08/2011 12:21 a.m.

Lecture 1 - Linear and Non-Linear Wavelet Approximation

http://www.ceremade.dauphine.fr/~peyre/teaching/wavelets/tp1.html

Linear approximation in Fourier basis performs poorly because of discontinuities. Non-linear approximation does not improve on this because Fourier basis is not localized in space. Spectrum of such a function decays like 1/frequency.

Copyright 2006 Gabriel Peyr

5 de 5

31/08/2011 12:21 a.m.

Вам также может понравиться