Kristian Sandberg
Dept. of Applied Mathematics
University of Colorado
at Boulder
|
|
| A fractal along with a two level Haar (standard) decomposition. Image source: Carlson's Fractal Gallery. |
![]() |
(1) |
Define
as
| (2) |
Define the vector space Vj as
| (3) |
The index j refers to dilation and i refers to translation.
Warning! This definition may be different in different texts! Sometimes one defines the scaling function for negative integers as well and uses a different sign convention. Whenever you use a text on wavelets, make sure you know what sign convention is being used.
The constant
is chosen such that
.
If one considers the scaling function on other intervals than [0,1], the normalization constant will change.
b) Claim: The following property holds for Vj:
| (4) |
![]() |
(5) |
Define
as
| (6) |
Define the vector space Wj
| (7) |
Warning! This definition may be different in different texts! Sometimes one defines the wavelet function for negative integers as well and uses a different sign convention. Whenever you use a text on wavelets, make sure you know what sign convention is being used.
Again, the constant
is chosen such that
.
If one considers the wavelet function on other intervals than [0,1], the normalization constant will change.
b) Claim: The following property holds for Wj:
| (8) |
c) A standard argument for using wavelets rather than the Fourier basis for signal processing is that the Haar wavelet is localized. By looking at your plots from a) above, can you see why the Haar wavelet is called a ``localized'' function? Is the Fourier basis localized?
| (9) |
| (10) |
(The formulation of this exercise is very vague. However, the purpose is to visualize the important relation
.
Use your imagination to do this.)
| (11) |
Let
be an ON-basis in
.Then
![]() |
(13) |
![]() |
(14) |
Let
and expand this signal into
spanned by the basis vectors according to Definitions 1 and 2 (discretized). Then
The correspondence to Fourier expanding a signal is now to compute the inner products
and
.
In principle, we could do this by evaluating an integral (or a sum in the discrete case). In practice, computation of the inner products for a wavelet basis is done as illustrated by the following example.
Although the example above may be a good illustration of how the Haar transform is coded, it is not that clear how the ``averaging and differencing'' technique actually relates to the more mathematical description in (15). The next paragraph will go through the same steps as in the example above, but try to explain what really was done mathematically.
We still consider the signal
f=(2,5,8,9,7,4,-1,1). The coefficients of the original signal are the coefficients of the vector f expanded in V3, i.e.,
,
etc. Recall that the basis vectors of V3 are translation of the Haar mother scaling function which has been dilated so that each basis function has a support equal to 1/8 (=1 pixel) of the support of f which is 8 pixels.
Our goal is to expand f into
.
We will do this in three steps.
Step 1: Expand f into
.
The first step in the example above can be described as the matrix-vector multiplication f1=W1f where
![]() |
(16) |
The last four rows correspond to the basis vectors
and
which span W2.
Hence, the final vector in Step 1 in the example above is nothing more than the coefficients of f in the expansion
![]() |
(17) |
Step 2: Expand f into
.
In this step we notice that we already have the coefficients for the basis vectors of W2. Hence we don't have to worry about these coefficients in this step, we simply just keep these coefficients (the last four entries of our vector in the previous step) and only work with the first four entries.
The second step can be described as the matrix-vector multiplication
f2=W2f1 where
![]() |
(18) |
![]() |
(19) |
Notice that the first two rows correspond to the basis vectors
and
which span V1.
The third and fourth rows correspond to the basis vectors
and
which span W1. The last four rows correspond to the basis vectors of W2.
Hence, the final vector in Step 2 in the example above is nothing else than the coefficients of f in the expansion
![]() |
(20) |
The third step can be described as the matrix-vector multiplication
f3=W3f2 where
![]() |
(21) |
We can combine the first, second and third step as
f3=W3W2W1f where
Notice that the first row corresponds to the basis vector
which spans V0, the second row corresponds to the basis vector
which spans W0 and so on.
Hence, the final vector in Step 3 in the example above is nothing else than the coefficients of f in the expansion
![]() |
(23) |
![]() |
(24) |
b) Verify that the wavelet operator in (22) is a unitary operator.
c) Mention a few properties that characterize unitary operators.
The differencing corresponds to high pass filtering. It removes low frequencies and responds to details of an image since details correspond to high frequencies. It also responds to noise in an image, since noise usually is located in the high frequencies. The high pass filter can be expressed as
in the Haar case and when we difference the data, we simply move this filter along our input data. The low pass and high pass filters make up what in signal processing language is referred to as a filter bank. The method of averaging and differencing is referred to as analysis. The reverse procedure (going the opposite way in the example above) is called synthesis.
Hence, the wavelet transform separates low and high frequencies, just as the Fourier transform. Since different features of a signal (background, details, noise, edges, etc.) correspond to different frequencies, this is a key to use wavelets in signal processing. The nice thing is that wavelets are localized since they only live on part of the interval of the data, as opposed to the trigonometric functions used in Fourier analysis which live on the entire interval of the data.
When doing the exercises below, there are a few things you should keep in mind. Just as you probably has developed a feeling for what a Fourier spectrum looks like and how it can be interpreted, try to get a feeling for how a signal looks like in the Haar wavelet basis. Where can you find the high/low frequencies? Where is the magnitude of the coefficients large/small?
When you wavelet decompose images, there is a trick to make it easier to study the decomposition. Usually a major part of the decomposition (see the image in the beginning of this instruction) is very dark. If you use Matlab, use the command brighten() to find a suitable brightness of the picture.
When you run your wavelet transform in Matlab, you may notice that the transform is quite slow. Even though you may have implemented your wavelet transform as a ``fast algorithm'', the architecture of the Matlab language may slow down your algorithm considerably. This has to do with the fact that loops and recursive functions calls (which you may need) are time consuming in Matlab. Don't worry about that, but keep in mind that your algorithm probably is much faster in C or Fortran which can handle loops and subroutine calls much more efficient than Matlab.
Program a function with the following in-/output:
Input:
a) Verify that your transform can reproduce the example in section 5.2.1.
b) Verify that the l2-norm is preserved in each of the three steps in the example.
c) Build an inverse Haar transform, i.e., a code that takes a Haar transformed vector and returns a non-transformed vector. (A ``reverse'' of the code in a).)
![]() |
(25) |
By using thresholding (like in the previous lab) on the Haar transformed signal, investigate the compression performance of the Haar transform. Compare the compression performance to a compression using the FFT of the same signal.
Bonus question: If this signal represents a sound signal, what does the signal sound like?
Construct a function that Haar transforms an image for different levels. Test your function on the same images as used for the previous labs (the basket and the image with campus and the Rockies). Compress the image and investigate the compression performance of the Haar transform compared to using the FFT.
(Hint. The image in the beginning of this lab instruction illustrates a level 2 Haar transformation of an image. The structure of your second level Haar transform should look like this one.)
|
| Fractal from Carlson's Fractal Gallery with random noise added. |
(Do not expect your de-noising to do miracles. There are many approaches to de-noise. The simplest is probably to do thresholding on your wavelet decomposed image but you may come up with other methods that work better.)
Down load the following image:
|
Do a Haar wavelet decomposition of this image at a few different levels. What are your observations? (You may have to adjust the brightness of the wavelet decomposition using brighten() in Matlab.)
|
| An MRI (Magnetic Resonance Imaging) image from First Radiology Clinic with "a scratch" added. Medical imaging is a very important application of digital image processing. |
Lycka till!
This document was generated using the LaTeX2HTML translator Version 98.1 release (February 19th, 1998)
Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -split 0 -no_navigation haar.tex.
The translation was initiated by Kristian Sandberg on 2000-04-01