Wavelet Toolbox |
Signal Extensions: Zero-Padding, Symmetrization, and Smooth Padding
To deal with border distortions, the border should be treated differently from the other parts of the signal.
Various methods are available to deal with this problem, referred to as "wavelets on the interval" (see [CohDJV93] in References). These interesting constructions are effective in theory but are not entirely satisfactory from a practical viewpoint.
Often it is preferable to use simple schemes based on signal extension on the boundaries. This involves the computation of a few extra coefficients at each stage of the decomposition process to get a perfect reconstruction. It should be noted that extension is needed at each stage of the decomposition process.
Details on the rationale of these schemes can be found in Chapter 8 of the book Wavelets and Filter Banks, by Strang and Nguyen (see [StrN96] in References).
The available signal extension modes are as follows (see dwtmode
):
zpd
'): This method is used in the version of the DWT given in the previous sections and assumes that the signal is zero outside the original support.
sym
'): This method assumes that signals or images can be recovered outside their original support by symmetric boundary value replication.
It is the default mode of the wavelet transform in the toolbox.
Symmetrization has the disadvantage of artificially creating discontinuities of the first derivative at the border, but this method works well in general for images.
spd
' or 'sp1
'): This method assumes that signals or images can be recovered outside their original support by a simple first-order derivative extrapolation: padding using a linear extension fit to the first two and last two values.
sp0
'): This method assumes that signals or images can be recovered outside their original support by a simple constant extrapolation. For a signal extension this is the repetition of the first value on the left and last value on the right.
ppd
'): This method assumes that signals or images can be recovered outside their original support by periodic extension.
The disadvantage of periodic padding is that discontinuities are artificially created at the border.
The DWT associated with these five modes is slightly redundant. But IDWT ensures a perfect reconstruction for any of the five previous modes whatever the extension mode used for DWT.
per
'): If the signal length is odd, the signal is first extended by adding an extra-sample equal to the last value on the right. Then a minimal periodic extension is performed on each side. The same kind of rule exists for images. This extension mode is used for SWT (1-D & 2-D).
This last mode produces the smallest length wavelet decomposition. But the extension mode used for IDWT must be the same to ensure a perfect reconstruction.
Before looking at an illustrative example, let us compare some properties of the theoretical Discrete Wavelet Transform versus the actual DWT.
The theoretical DWT is applied to signals that are defined on an infinite length time interval (Z). For an orthogonal wavelet, this transform has the following desirable properties:
Since the DWT is applied to signals that are defined on a finite-length time interval, extension is needed for the decomposition, and truncation is necessary for reconstruction.
To ensure the crucial property 3 (perfect reconstruction) for arbitrary choices of
the properties 1 and 2 can be lost. These properties hold true for an extended signal of length usually larger than the length of the original signal. So only the perfect reconstruction property is always preserved. Nevertheless if the DWT is performed using the periodic extension mode ('per
') and if the length of the signal is divisible by 2J, where J is the maximum level decomposition, the properties 1, 2, and 3 remain true.
It is interesting to notice that if arbitrary extension is used, and decomposition performed using the convolution-downsampling scheme, perfect reconstruction is recovered using idwt
or idwt2
. This point is illustrated in the following example.
% Set initial signal and get filters. x = sin(0.3*[1:451]); w = 'db9'; [Lo_D,Hi_D,Lo_R,Hi_R] = wfilters(w); % In fact using a slightly redundant scheme, any signal % extension strategy works well. % For example use random padding. lx = length(x); lf = length(Lo_D); randn('seed',654); ex = [randn(1,lf) x randn(1,lf)]; axis([1 lx+2*lf -2 3]) subplot(211), plot(lf+1:lf+lx,x), title('Original signal') axis([1 lx+2*lf -2 3]) subplot(212), plot(ex), title('Extended signal') axis([1 lx+2*lf -2 3]) % Decomposition. la = floor((lx+lf-1)/2); ar = wkeep(dyaddown(conv(ex,Lo_D)),la); dr = wkeep(dyaddown(conv(ex,Hi_D)),la); % Reconstruction. xr = idwt(ar,dr,w,lx); % Check perfect reconstruction. err0 = max(abs(x-xr)) err0 = 3.0464e-11
Now let us illustrate the differences between the first three methods both for 1-D and 2-D signals.
Using the GUI we will examine the effects of zero-padding.
wavemenu
.
Let us now consider an image example.
Now we set the extension mode to zero-padding and perform a decomposition of the image to level 3 using the sym4
wavelet. Then we reconstruct the approximation of level 3.
Now we set the extension mode to symmetric extension and perform a decomposition of the image again to level 3 using the sym4
wavelet. Then we reconstruct the approximation of level 3.
Finally we set the extension mode to smooth padding and perform a decomposition of the image again to level 3 using the sym4
wavelet. Then we reconstruct the approximation of level 3.
Dealing with Border Distortion | Discrete Stationary Wavelet Transform (SWT) |
© 1994-2005 The MathWorks, Inc.