Functions > Image Processing > Transform Domain > Example: Wavelet Transform Filtering
Example: Wavelet Transform Filtering
Use the wave2d and iwave2d functions to compute the n-level wavelet and inverse wavelet transform, respectively. The wavelet used is the bi-orthogonal wavelet basis derived from the Burt-Adelson Laplacian Pyramid.
Use the wavescale function to better view images in the transform domain.
 Wavelet transforms can sometimes represent images more compactly than a standard Fourier transform.
For information on using this example, refer to About Image Processing Examples.
Computing the n-level Wavelet Transform
1. Read in a blue subimage of the ultraviolet picture of Jupiter.
(jupiter2.gif)
2. Extract and display the 3rd color component of the packed 3-color matrix.
(jup2_ext3.bmp)
3. Set the number of levels, and then apply the transforms.
(jup2_scaled.bmp)
What you see is typical of the wavelet transform: the region is broken up into four distinct regions corresponding to the different combinations of low-pass and band-pass filtering in the horizontal and vertical directions of the image. Only the upper left corner (the low-pass/low-pass part) is significant, due to the coefficients in that part of the transformed image, which tend to be larger than in the other parts and hence obscure the smaller coefficients when scaled. To remedy this masking effect, a routine is included which scales each subimage of a transform independently of others.
4. Apply the inverse function, and then verify that the reconstructed image is identical to the original.
(jup2_rabs.bmp)
The absolute value of the reconstructed image was taken before viewing. Even though the wavelet transform theoretically guarantees perfect reconstruction, there are errors due to round-off in the computer.
5. Verify that the round-off errors are very small.
Since the wavelet transform has both positive and negative values, it is helpful to rescale before viewing. However, doing this often results in hidden information, as in the scaled transform image above.
Viewing the Image in the Transform Domain
1. Apply the wavescale function to vectorized N.
2. Scale and display the resulting image.
(jup2_scaled2.bmp)
You can clearly see the improvement in the display when independence among subimages is maintained. If one increases the level of the wavelet transform, there are even greater benefits to using the function wavescale instead of scale.