48 views

Uploaded by cathy_vancha

vgdfgsd

- fswt
- Wavelet Entropy Measure
- !!! ICBM Intelligent Condition Based Maintenance Thesis
- Segmentation and characterization of skin tumors images used for aided diagnosis of melanoma
- EEE 207 Mid Summer 2012
- Detection and Location of Faults in 11KV Underground Cable by using Continuous Wavelet Transform (CWT)
- Advanced Digital Signal Processing Multirate Wavelet
- A New Reactive, Distortion and Non-Active Power Measurement Method for Nonstationary Waveforms Using Wavelet Packet Transform
- Implementing Security Using Iris Recognition Using Matlab
- Cardiac Detection Algo
- Batik Image Classification Using Treeval and Treefit as Decision Tree Function in Optimizing Content Based Batik Image Retrieval
- DIGITAL PROCESSING OF TWO-DIMENSIONAL SIGNALS IN THE BASIS OF HAAR __WAVELETS (1).docx
- haar_2
- isecs10wp336
- A Review on Image Inpainting to Restore Image
- 2.Literature Review.docx
- handout20
- 491-G1339
- Simoncelli 99 b
- CIRED2013_0202_final

You are on page 1of 15

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 Goal

The goals with this lab are: 1. Understand the properties of the Haar basis. 2. Understand the averaging and differencing technique and how it relates to a wavelet decomposition. 3. Use the Haar transform to compress and de-noise one dimensional signals and images.

2 Introduction

This lab will illustrate some fundamental concepts about wavelets and multiresolution theory. Most examples and definitions will be made with respect to the Haar scaling function and the Haar wavelet. However, the concepts covered in this lab are true for more ``advanced'' wavelets such as the Daubechies wavelets.

Definition 1 (The Haar scaling function) Let be defined by

(1)

Define

as

(2)

(3)

where

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

a) Using, e.g., the Matlab functions haarscale.m and haargrid.m, plot the basis vectors for V for j=0,1 and 2. Describe the significance of the index j in V and the significance of the index i in

j j

when j is fixed.

(4)

Based on your plots in a) above, convince yourself (and the reader of your lab report) that this property holds for the Haar scaling function. (If you see this relation written in ``the opposite direction'' in some text, they used a different sign convention. The relation given above is consistent with Definition 1.) Definition 2 (The Haar wavelet function) Let be defined by

(5)

Define

as

(6)

(7)

where

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.

a) Using, e.g., the Matlab functions haargrid.m and haarwavelet.m, plot the basis vectors for W for j=0,1 and 2. Describe the significance of the index j in W and the significance of the index i in

j j

when j is fixed.

(8)

Based on your plots in a) above, convince yourself (and the reader of your lab report) that this property holds for the Haar wavelet function. (If you see this relation written in ``the opposite direction'' in some text, they used a different sign convention. The relation given above is consistent with Definition 2.) 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?

The Haar basis (and other wavelet basis) has the very important property that

(9)

Using, e.g., the Matlab functions haargrid.m and haarwavelet.m, produce a few plots that illustrate the following relation:

(10)

(The formulation of this exercise is very vague. However, the purpose is to visualize the important relation Use your imagination to do this.)

Let denote a finite signal with N samples (cf. an N-dimensional vector) given by

(11)

Let

be an ON-basis in

.Then

(12)

Let us first review how this was used for Fourier analyzing a signal and then see how this can be used for wavelet expansion of a

http://amath.colorado.edu/courses/5720/2000Spr/Labs/Haar/haar.html (4 of 15)5/19/2010 12:08:54 PM

signal.

Let

(13)

Denote the (n+1):th element of the v vector as v [n]. Then f can be expanded as in (12) with

k k

(14)

where * denotes complex conjugation. Numerically, we compute <f,v > by using the Fast Fourier Transform.

k

In this example we consider a signal with 8 samples for clarity. However, the procedure can be generalized to any finite signal. The analysis simplifies if the length (dimension) of the signal is 2 for some positive integer k. Let and expand this signal into spanned by the basis vectors according to Definitions 1

k

(15)

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.

Consider f=(2,5,8,9,7,4,-1,1). We wish to expand this signal in the Haar basis according to (15). In practice, we do this by performing the following steps:

http://amath.colorado.edu/courses/5720/2000Spr/Labs/Haar/haar.html (5 of 15)5/19/2010 12:08:54 PM

Step 1:

Step 2:

Step 3:

The numbers in the final vector are the coefficients in the expansion (15). You probably notice the pattern, we add/subtract a pair of numbers, divide by the normalization factor and between every step we don't touch the last elements of the vector. This

procedure is called ``averaging and differencing''. In the next section, we will study this example in more depth and see what we really did mathematically.

The example in the previous section shows the steps that we want to implement when we code up a one dimensional Haar wavelet transform. When we consider two dimensional signals (images) we will see that all we need to do is to act with the one dimensional transform on each row of the image followed by a transformation of each column of the image. Hence, the above example should serve as a guide for programming your own Haar wavelet transform later on. 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.

The first step in the example above can be described as the matrix-vector multiplication f1=W1f where

http://amath.colorado.edu/courses/5720/2000Spr/Labs/Haar/haar.html (6 of 15)5/19/2010 12:08:54 PM

(16)

Notice that the first four rows correspond to the basis vectors

and

and

Hence, the final vector in Step 1 in the example above is nothing more than the coefficients of f in the expansion

(17)

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)

We can combine the first and the second step as f2=W2W1f where

(19)

Notice that the first two rows correspond to the basis vectors

and

The third and fourth rows correspond to the basis vectors vectors of W2.

and

which span W1. The last four rows correspond to the basis

Hence, the final vector in Step 2 in the example above is nothing else than the coefficients of f in the expansion

(20)

In this step we notice that we already have the coefficients for the basis vectors of

about these coefficients in this step, we simply just keep these coefficients (the last six entries of our vector in the previous step) and only work with the first two entries. 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

(22)

Notice that the first row corresponds to the basis vector which spans W0 and so on.

which spans V0, the second row corresponds to the basis vector

Hence, the final vector in Step 3 in the example above is nothing else than the coefficients of f in the expansion

(23)

The procedure in the example above can be expressed as

(24)

a) Verify (using, for example, Matlab or Mathematica to reproduce the example above) that the matrix in (22) describes the wavelet transform for an 8 dimensional signal. b) Verify that the wavelet operator in (22) is a unitary operator. c) Mention a few properties that characterize unitary operators.

The method of averaging and differencing explained above can also be expressed as filtering the data. Averaging corresponds to a low pass filtering. It removes high frequencies of the data. Since details (sharp changes in the data) correspond to high frequencies, the averaging procedure tends to smooth the data. The low pass filter can be expressed as average the data, we move this filter along our input data. 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 in the Haar case and when we

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.

6 Exercises

In the previous lab on Fourier techniques in image processing, we learned that when we want to manipulate an image (compress, denoise, etc.), we first transformed the image into the Fourier basis, performed our manipulations in this basis, and then transformed back. The same principle holds when using wavelets techniques for image processing! Now we will transform our image into a wavelet basis, perform our manipulations in this basis, and then transform back. The foundation of signal processing can be described as to find a basis which is suitable for the manipulations we need. This means that image processing relies on concepts from linear algebra such as orthogonality, norms, inner products, etc.

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.

While it is very important to keep in mind that the wavelet transform can be described by a unitary matrix, it is not efficient to perform the transformation by multiplying the matrix to a vector. The way to wavelet transform numerically, is to proceed as in the example in section 5.2.1 by moving the filters and along the signal recursively.

q q

A vector of length 2 where k is a positive integer. The ``level'' of decomposition. (E.g., the first step in the example in section 5.2.1 corresponds to a first level decomposition, the second step corresponds to a second level decomposition and the third step corresponds to a third level decomposition.)

Output:

q

A vector which is the Haar transformation of the vector you gave as input corresponding to the level you gave as an input.

The purpose of this exercise is to build a Haar transform to use for the following exercises. If you want to use slightly different input/ outputs, feel free to do so as long as you can use your Haar transform efficiently. 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).)

Generate a signal that samples the function

(25)

at at least 1024 points. Plot the wavelet decomposition of the signal at a few different levels. 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?

A standard decomposition of a two dimensional signal (image) is easily done by first performing a one dimensional transformation on each row followed by a one dimensional transformation of each column. 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.)

Using the Haar transform, try to de-noise the following image:

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.)

Remove (or reduce) the ``scratch'' from the following image!

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.

Write down your comments to all of the exercises above (word processed). Include a representative collection of the code(s) that you used as an appendix. Make sure to include comments in your code explaining what it does. Include any plots or images you need to justify your conclusions.

8 Questions?

In case you have questions regarding the material in this lab, do not hesitate to contact me at kristian.sandberg@colorado.

http://amath.colorado.edu/courses/5720/2000Spr/Labs/Haar/haar.html (14 of 15)5/19/2010 12:08:54 PM

edu or visit me during my lab hours Mondays 4:30-6 pm and Thursdays 4-5:30 pm in ECCR 143. Lycka till!

The Haar wavelet transform 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

- fswtUploaded byAakanksha Dugar
- Wavelet Entropy MeasureUploaded byedpogi
- !!! ICBM Intelligent Condition Based Maintenance ThesisUploaded byVladimir Garusov
- Segmentation and characterization of skin tumors images used for aided diagnosis of melanomaUploaded byiMedPub
- EEE 207 Mid Summer 2012Uploaded byTahmid Hassan Talukdar
- Detection and Location of Faults in 11KV Underground Cable by using Continuous Wavelet Transform (CWT)Uploaded byInternational Organization of Scientific Research (IOSR)
- Advanced Digital Signal Processing Multirate WaveletUploaded byakhilaraj
- A New Reactive, Distortion and Non-Active Power Measurement Method for Nonstationary Waveforms Using Wavelet Packet TransformUploaded byBernardMight
- Implementing Security Using Iris Recognition Using MatlabUploaded byDeepak Kumar
- Cardiac Detection AlgoUploaded byKirti Susan Varghese
- Batik Image Classification Using Treeval and Treefit as Decision Tree Function in Optimizing Content Based Batik Image RetrievalUploaded byHeri Budi
- DIGITAL PROCESSING OF TWO-DIMENSIONAL SIGNALS IN THE BASIS OF HAAR __WAVELETS (1).docxUploaded byEldor Sayfiyev
- haar_2Uploaded byashoksakjnij
- isecs10wp336Uploaded byvahdat_kazemi
- A Review on Image Inpainting to Restore ImageUploaded byInternational Organization of Scientific Research (IOSR)
- 2.Literature Review.docxUploaded bySwapnil Jha
- handout20Uploaded byAbbas Abbasi
- 491-G1339Uploaded byjebilee
- Simoncelli 99 bUploaded byDenis Constantin Ilie-Ablachim
- CIRED2013_0202_finalUploaded byShung Tak Chan
- Thesis Front adaptiveUploaded bySunil Kumar
- Design of Self-Maintenance and Engineering Immune Systems for Smarter Machines and Manufacturing SystemsUploaded byrinoy136
- Welcome to International Journal of Engineering Research and Development (IJERD)Uploaded byIJERD
- ijatcse02132912Uploaded byeditor3854
- 104-135_1Uploaded byMazhar Ul Haq
- Computer Aided Diagnosis of Ventricular Arrhythmias from Electrocardiogram Lead II SignalsUploaded bysipij
- 17.08041305Uploaded bysgajendran
- 99ebook Com NetworkAnalySynthUploaded byAsif Farooki
- R7221904 Signals and SystemsUploaded bysubbu
- Coseno Elevado Wits LabUploaded byEnrique Guerrero

- Mohammadi Et Al 08-Application of DCP for Determination of the Eng Parameters of Sandy SoilsUploaded byiwan
- official_course_descriptionUploaded byapi-3716660
- AC Circut AnalysisUploaded byhthaier4062
- 445R_99 (1)Uploaded bytumballisto
- Jee Main Online Paper 5 CBSE sample paperUploaded byjaykay33
- Chapter 15 - Communication SystemsUploaded byGaurav Chopra
- 357063767-1-1-population-dynamics.pdfUploaded byluckyguy1
- Chapter 0012Uploaded byDr Ravi Kumar A V
- jto test paperUploaded byRegan
- Bezier Curve FittingUploaded byaushad3m
- ConstraintsUploaded byupador
- Engineering Mechanics - Dynamics - R.C. Hibbeler - 6th EditionUploaded byToni Tones
- Ilspet Density[1]Uploaded bymsthomas79
- Excel TutorUploaded bySusheel Sriram
- DSA.pdfUploaded byMaajith Marzook
- Energy Flow in a Simple Circuit and Its InteractionUploaded by59Gudlar
- s Chaw Low and TownesUploaded byAgnivesh Sharma
- With AnswersUploaded byperwinsharma
- Steam Flow Compensation Equations - For DCSUploaded byLTE002
- Developement of SurfaceUploaded bykiki270977
- Inference in LabUploaded byPatriese Kyra Navarro
- 1.pdfUploaded byronniewo2
- Artificial Life and Computational Intelligence-ALCALCI 2106Uploaded byignaciomoya1771
- Parallel Ground Continuity CableUploaded byRaul Cordova
- Trends in Microwave-related Drying of Fruits and VegetablesUploaded byİsmail Eren
- information-02-00528.pdfUploaded byFisseha Abebe
- Mlm Vector AlgebraUploaded byRaghav Giridhar
- v16-9Uploaded bymamaemtoloko
- Conics and CycloidUploaded byDiganta Boro
- Smoothed Ratio Money ManagementUploaded byMauricio Burlacenko