Top Banner

of 86

Wavelet Toolware_software for Wavelet Training

Feb 07, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    1/86

    Wavelet ToolwareSoftware forWavelet Training

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    2/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    3/86

    Wavelet ToolwareSoftware forW avelet Training

    Andrew K ChanDepartmentof Electrical Engineering

    Texas A M U niversity

    Steve J LiuDepartment of C om puter ScienceTexas A M University

    San Diego London BostonNew York Sydney Tokyo Toronto

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    4/86

    This book is printed on acid free paper.Copyright 1998 by Academ ic PressAllrightsreserved.Nopartof this publication may bereproduced or transmitted in any form or byany means electronic or mec hanical including photocopy recording or anyinformation storage an d retrieval sy stem with ou t permission in writing from thepublisher.ACADEMIC PRESS525 B Street Suite 1900 San Diego CA 92101-4495 USA1300 Boy lston Street Chestnu tHill MA02167 USAhttp://ww w.apnet.comACADEMIC PRESSLIMITED24-28 Oval Road London NW 1 7DX UKhttp://www.hbuk.co.uk/ap/

    Printed in theUnited States of Am erica98 99 00 01 02 IP 9 8 7 6 5 4 3 2 1Disclaimer:

    This eBook does not include the ancillary media that was

    packaged with the original printed version of the book.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    5/86

    ontentsart ii

    1.1 From Fourier AnalysistoWavelet Analysis 11.2 Short Time Fourier Transform 21.3 Window Measures 31.4 What Is aWavelet? 5

    1.4.1 Wavelets at d i f f e ren t resolutions scales) 61.5 Continuous Wavelet Transform 71.6 Multiresolution Analysis 9

    1.6.1 Two scale relations 121.6.2 Decomposition relation 131.6.3 Developmentof thedecomposition and reconstruc

    t ion algorithms 151.6.4 Mappingoffunc t ions into the approximation space 16

    1.7 TypesofWavelets 181.7.1 Orthonormal wavelet bases 181.7.2 Semi orthogonal wavelet bases 191.7.3 Biorthogonal wavelet bases 21

    1.8 Wavelet Packets 221.8.1 Wavelet packet algorithms 23

    1.9 Two Dimensional Wavelets 241.9.1 Two dimensional wavelet packets 26

    art 272.1 Wavelet Algorithms Overview 292.2 AlgorithmforComputingthe STFT 292.3 Algorithm for Computing the CWT 312.4 Computationand Display of Scaling Functions 32

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    6/86

    vi W VELET TOOLW RE2.5 C om pu tation and Grap hical Display of W avelets 342.6 M app ing between B Splines and Their Duals 352.7 D ecom position of a 1 D Signal 362.8 Re construction of 1 D Signals 372.9 Thresho lding 372.9.1 Hard thresholdi ng 38

    2.9.2 Soft thresholding 382.9.3 Qu antile thresho lding 382.9.4 Universal thresholdin g 382.10 Two Dimensional Extension o fWavelet Algorithm s . . . 392.11 Other Algorithms 40

    Part III 43.1 The Wavelet Toolware Overview 433.1.1 Installation ofToolware 433.1.2 Wavelets 443.2 Using Toolware 453.3 2 D D W T T o ol 46

    3.3.1 Datafileselection 473.3.2 W avelet deco m posi tion 493.3.3 Display thres ho ldin g 503.3.4 W avelet reco nstru ctio n 513.4 1 D DWT Tool 553.4.1 1 D DWT decomposit ion 563.4.2 Viewingand processing the data 573.5 Co ntinu ous Wavelet Transform Tool 623.6 Short Tim e Fourier Transform Tool 633.7 W avelet Bu ilde r Tool 64

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    7/86

    ref ceWavelet Toolware is a companion software package to the book n ntroduction to Wavelets by Charles K. Chu i. It is designed for thereader to gain some hands-on practice in the subject ofwavelets. Theobjectiveis to provide basicsignalanalysis and synthesistoolsthatareflexible enough for the reader to easily increase the capability of theToolware by adding processing algorithms to tailorto specific areasofapplication. Wavelet Toolware contains, among other algorithms andcodes, the one-dimensional 1-D) and two-dim ensional 2-D ) DiscreteWavelet Transfo rms DW Ts) and their inverse trans form s, as well ascom putations of the Co ntinuous Wavelet Trans form CW T) and theShort Time Fourier Transform STFT). Simple signal processing appli-cations are also included for reader to practice with the software.

    This manual for Wavelet Toolware leads the reader through the ba-sics of wavelet the or y and shows how it can be ap plied to a nu m be r ofengineering problems. It is organized into three major divisions. PartI concerns the basics of wavelet theory, and readers should get a veryfundamental understanding of the development of the theory and gainappreciationof the t ime-frequency ortime-scale) representation ofsig-nals. Part IIcontains several major algorithmsthat correspond to thetopics discussed in Part I. In most cases, the algorithms are outlinedin procedural steps. Finally, Part III provides hands-on practice withthe Wavelet Toolware. It contains many practice sections ranging frominstallation of the software to denoising ofimages.This manual is designed to be self-contained for the reader who isunfamil iarw ith wavelet theorybut wantstogaina basic understandingand the usage of wavelet theory. Af ter thoro ugh ly studying this man-ual and practicing with the Toolware, readers should be able to applythe basic aspects of wavelet analysis to problems of their respectivedisciplines.A ndrew K . Ch an College Station, TexasSteve J. Liu February 13, 1998

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    8/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    9/86

    knowledgmentsThe developmental work ofthis software for training in wavelet algo-rithms is based on our experience in teaching short courses for theTexas Engineering Extension Services over th e last few years. Ourgratitude goes to Professor Charles K . Chui for his organization of theshort courses help in the reviewofthismanuscript andmany valuablesuggestions. Someof thecomputer code evaluations andgraphical illus-trations were carried out by our former and current students HowardChoe Hung-Ju Lee Nai-wen Lin Dongkyoo Shin Hsien-Hsun W uM ichael Yu Xiqiang Zhi. W ethank them fortheir careful and detailedwork. Special thanksare due to Brandon Scott Wadsworth whospentcountless hours perfectingthe UI of the software. We areindebted toMargaret Chui for her help in the editorial workofthis manuscript.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    10/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    11/86

    ToJesusChrist ourLord and

    Toourwives SophiaandGrace.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    12/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    13/86

    PartWavelet Theory

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    14/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    15/86

    1.1. FROM FOURIER ANALYSIS TO WAVELET ANALYSIS 11 1 From Fourier Analysis to Wavelet AnalysisBefore the work o f Haar [1], a cont inuous function (or an analog signal)f t ) was represented ei ther by an e ntire series (po lyno m ial basis) o rby a Fourier series (sinusoidal basis). Since both bases funct ions haveinfinite t ime durat ion ( 00 < t

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    16/86

    2 WAVELET T O O L W A R EOther drawbacks of the Fourier analysis include the following:

    1. The Fourier transform can be computed for only one frequency ata time.

    2 . Exact representations cannot be computed in real time.3. The Fourier transform provides information only in the frequencydomain, but nonein the t ime domain.

    1.2 Short Time Fourier TransformFourier analysis, being unable to provide localized time and frequencyinformation simultaneously, becomes the most serious drawback for pro-cessingoftransient signals. Inorder to gain information frombothtimeand frequency domains simultaneously, engineers have used the Short-Time Fourier Transform STFT) to accomplish their goal, even ifonlyapproximately.The STFT isformallydefined by the integral transform

    where the overbar indicates complex conjugation. The function w t)is called the window function to be chosen by the user. This is thereason that the STFT is also sometimes called the Windowed FourierTransform W FT ). Th e variables t , w ) are the transfo rm variablesfrom the single time domain variable t. Hence, the STFT transformsa one-variable function into a two-variable function. It provides time-frequency informat ionof the funct ion f t ) on the time-frequency t-f)plane. The complex spectrum of S T w f t , u j ) gives approx imated spec-tral properties of the function near the time location t. It is only anapproximation, since the expression in 1.2)is the Fourier transformofthe product of the functions f t ) and w T t ). In other words, 1.2)gives the spectrum of the product functionf r}w r t) instead of thefunction f T ) alone. Even if the window function w t) is a rectangu-lar window with unit amplitude and f T ) is a pure sinusoidal functioncos wot)5 the transform of the product f t ) w T t) is not just adeltafunction in the spectrum . Rather it is the convolution of the deltaspec trum w ith the sine fun ction spec trum of the rectangular fun ctio n.Thisbroadening of the deltafunct iondwj wo)to a sine a;wo)func-tion represents the effect of the truncation due to the window funct ion.We call that a windowing effect on the funct ion / T) . W e will see in

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    17/86

    1.3. WIN D O W ME SURES 3later sections that the accuracyof the informationon the t f planeiscontrolled by the widths of the window in time and frequency domains.In addition, the uncertainty principle governing the area of the windo win the t f plan e places a limiton the resolution thatone can achieveusingSTFT.The spectral domain equivalent of(1.2) comesfrom th e Paseval iden-tity, which gives

    Expression (1.3) indicates that the time -dom ain w indow ing process isalso a spectral-dom ain w indow ing process. It provides informationonthe spectral energyof the signal near the center of thew indow.T he original signal f t ) can be recovered from the STFT uniquely.Hence the STFT is a unique transform ation. The recovery formula forth e STFT isgivenby

    where \\w\\is the norm of the function that willbe defined in the nextsection.

    1 3 Window MeasuresIn order to make an intelligent choice of a window function for theSTFT some measures of goodness must be established to evaluatethe suitability of the windowfunction. En gineering mea suremen ts suchas the main lobe zero-crossing and the 3db points do not gauge theconcentration ofenergy of the funct ion. In the wavelet literature, theR M S wid thof the function isused to measure energy concentration inthe t ime and frequency domains. These measurements are explicitlyexpressed respectivelyas

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    18/86

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    19/86

    1.4. WH A T IS A WA VELET?

    Figure 1.1: STFT windows

    4 WhatIs a WaveletWavelets are fini te-energy functions with localization properties thatcan be used very efficiently to represent transient signals. Efficiencyhere mean s on ly a small f ini te n um ber ofcoefficients are needed to rep-resent a complicated signal. Incontrast with the sinusoidalfunct ionso finfinite extent (big w aves), w avelet implies a a sm all w ave. Strictlyspeaking, it also means mathematically that the area under the graphof th e wavelet u t ) is zero, i .e., f-u(t)dt = 0. In the spectral d o -m ain , this pro perty is equivalent to -0(0) = 0, i .e., the sp ectru m of thewavelet has a value of zero at w =0. In en gin eering terms , the w avelethas no d-c offset. This spectral-domain behavior makes the wavelet abandpassfilter. The readercan use the Toolwareto generate the graphof an y wavelet listed in the Part III by following th e instructions givenlater inthis manual .

    It iseasy to seefrom any wavelet and its spec t rumthat the energyof the wavelet isco ncentrated in a certain regionofboth the t- and uj-axes. Thislocalization pro perty is an im po rtant feature of the wavelets .If a wavelet is more localized (that is, the energy of the wavelet isconcentrated in a smaller region),it produces a better representationof the signal in the t ime-frequency(o r time-scale) plane. In our case, better means higher resolution and requires less coefficients in the

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    20/86

    WAVELET TOOLWARE scaling function scale=1)

    scaling function scale=1/2)

    scaling function scale=1/4)

    1Figure 1.2: The scalingfunct ions of the Daubechies-2wav elet at three differentscalesrepresentation.

    1 4 1 Wavelets at different resolutions scales)For agiven wavelet u t , ascaled and translated version is designated y

    The parameter a corresponds to the scale whileb is the translationparameter. T he wavelet u01 t) = u t ) is called the basic wavelet o rmother wavelet . TheDaubechiesD scaling functionat three differentscales isshown in Fig 1.2.

    t isimportant to note that the shape of the wavelet remains thesame under translation and scaling. Wew illshow belowthat with theproper choice of 6, a), the set ofwavelets ba t)constitutes the basisfunc t ions o f aReisz o rstable basis in the L or finite-energy) space.Keeping this concept o fbasis in mind, w ewill show that the idea o f

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    21/86

    1.5. CONTINUOUS WAVELET TRANSFORM 7waveletsignal processingis not much different fromthat ofFourier pro-cessing, at least when orthonormal wavelet are considered. Insteadof decomposing a signal into sinusoidal funct ions of different f requen-cies (the Fourier basis), wavelet signal processing seeksto decomposea transient signal into a linear combination of ascaled and translatedversionof the basic wavelet (the wavelet basis).

    1 5 Continuous Wavelet ransformThe continuous (integral) wavelet transform (CWT/IWT) of a signalx t) is a linear transform definedby the integral

    /

    The last expression of (1.13) represents the inner product of twofunctions denned in the L spaceby

    Referr ingto (1.13), the CWTcomputes,via theinner product fo rmulathe wavelet coefficient ofx t) associated with th e wavelet b a t . Thiscoefficient indicates the correlation between the function x t ) to thewavelet u b a t ) . Higher correlation produces a larger coefficient. Anexample of the CWT isshownin Fig 1.3.For the sakeofcomparison,wewritetheSTFTin the inner product

    form as

    One immediately sees from 1.13) and (1.15) that the difference be-tween CWT andSTFTisthatthe kernelsforthesetwotransformsaredifferent. CWT and STFTare interchangeable if weswitch

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    22/86

    WAVELET TOOLWAR E

    Figure 1.3: The graphical display of the WT coefficientsof a voice signal

    W e remark here that th e basis function w t b ) e jwt is a sinusoidalfunction at a singlefrequ ency modulated by the windowfunction w t) .The window widths are fixed independent ofband u. Based on thewindow measures discussed earlier inthis manual, the windowarea inthe t f planefor the wavelet at a given scale aisgivenby

    W e see clearlythat the windowarea of the wavelet rem ains the same,namely, 4 D w D w . However the t ime and spectral window widths aredependent on the scale a. See Fig 1.4 .) If a becomes large i.e., atlow frequency), the window width in the t ime domain is large whilethe window width in the spectral domain becomes small. This is thecase in processing signals in fine resolu tion in the spectral dom ain w hilethe time-domain resolution is coarse. For processing of a signal at lowfrequency, one should use wavelets with a large scale.Although there are striking similarities between the STFT and theCWT, their results in signal processing are qui te different. Onemustcomputethe STFTof a broadband signalon the t f planefor severalsizes of the same wind ow to ca ptu re the high- and low-frequ ency char-acteristics of the signal. How ever, one only needs to co m pu te the CW Tonceto detect both the high-and low-freq ue ncy eventsin the signal.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    23/86

    6 MULTIRESOL UTION ANALYSIS

    igure 1.4: Window widths for wavelets

    The original signal is un iqu ely recovered b y the dou ble integral

    where C is a finite constant given by the integral

    1 6 M ultiresolution A nalysisW ehave shownthat the CWT has au niq ue advantage because itswin-dow widths can be controlled by the scale parameter a. However, wealso seethat the c om pu tation load of the C W T is quite heavy in orderto capture all the characteristics of the signal. Toalleviate this com pu-tational burden, mathematicians have developed the Discrete WaveletTransform DW T) to m inimize the redundan cies existing in CW T. Al-though the algorithm of DWT is identical to that of the two-channelfilter bank analysis, the underlying meanings of these algorithms aredifferent. W ewill point out these differences in later sections.The most important featureofm ultiresolution analysis M R A )MRAis the ability to separate a signal into many components at different

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    24/86

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    25/86

    1.6. MU LTIRESOLUTION ANALYSIS 11

    Figure 1.5: Approximation subspaces and wavelet subspaces

    described by Fig 1.5. We should take note of the following two obser-vations:1. Subspaces {Vj} are nested2 . Subspaces {Wj} are mutual ly or thogonal .Mathematical ly, they are expressed by

    The subspaces {Wn} are generated by some function u(t) called a wavelet, in the same way as {Vn} are generated by0 t ) . In otherwords, any function fj t) Vj can be written as

    and any funct ion gj t) E W j can be wri t ten as

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    26/86

    12 WAVELET T O O L W A R Efo r some coefficient sets {cj k} 7 and { d j k } in l Herewehaveadopted the no ta t i o n

    W e may restate herethat a f un c t i o n f t ) can bedecomposed in to m anycomponen ts suchthat

    where the f unc t i on fM T) is the approximat ion o f / t ) f r o m the spaceV M - Fo r example, if a signal is sampled at the rate o f 256samples persecond, we may represent the signal by

    This signal can also be represented by

    1.6.1 Two scale relationsTheequation in 1.21) expresses the relationof abasisfun c t io n be tweentw o di f ferent scales. The two-scale relation formal izes th is re la t ionshipmathematical ly. Since

    w e c an w r i t e 0 t ) an d u t ) in t e rms of the bases that genera te V 1.Inother words, there exis t two sequences {pk} an d {qk} EL2 suchthat

    In general , fo r any j 6 Z, the relat ionships between Vj,Wj an dare governedby the two-scale relat ions

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    27/86

    1.6. MU LTIRESOLUTION ANALYSIS 13

    Figure1 6:Daubechies D2 scaling function

    These formulas of the basis funct ion sets { 0 2 j t ) } and {u(2 J t )} arebuilt up by a l inear com binat ion o f o (2 J + 1 t ) . For a given {pk}sequence,the relations (1.36) and (1.37) can be graphically describable. We usethe scaling funct ions o f D aubechies D2) and the cubic spline as exam-ples. The two scale relation is graphically displayed in Fig 1.6 and Fig1.7.1 6 2 ecomposition relationThe relations (1.36) and (1.37) are of ten referred to as the reconstruc-tive relation s. The deco m po sition relation is for separating a signal intocomponents at different scales. The subspace relation in an MRA

    indicatesthat there exists a relation b etween the basis funct ions in thesesubspaces. Since 2 t ) and 2 t 1) a re two distinct basis funct ions in

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    28/86

    14 WAVELET TOOLWARE

    Figure 1.7: Cubic B-spline

    j i , there exist twosequences {ak} and {bk} in I2 suchth t

    Writing these relations in their generalizedform , wehave

    for all l E Z. For an arbitrary resolution level j, this relation becomes

    Thereexists a definite relationship between the two-scale sequences{pk} {qk} and the decomposition sequences {ak} {bk}. W e will con-sider these relations whendifferent types ofwaveletsare discussed.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    29/86

    1 6 MULTIRESOLUTION ANALYSIS 15 6 3 evelopment of the decomposition and reconstruction

    algorithmsThedecom position analysis)andrecon struction synthesis) algorithm sare the m ost often-us ed algo rithm s in wavelet signal processing. A smentioned earlier, the idea consists of simply dividing the signal intocomponents soth t each component may be processed with a differ-ent algorithm. The important issue of this algorithm is to be able toreconstruct th e signal perfectly if weapply all-pass filters on all signalcomponents. These algorithmsarebased on the two-scale relations andthe decomposition relation as developed in the previous sections. Werewrite these relations here forconvenience.Let

    Since the MRArequiresth t

    we have

    W e su bs titute the deco m position relation 1.40) in 1.46) and inter-change the order of summ ations. Com paring the coefficients of f ) j , k t )and U 7 , j ,k t ) , we obtain

    where the right sides of 1.47) and 1.48) correspo nd to a dow n-sam pleafter conv olution. These form ulas relate the coefficients of the scalingfunction from a given scale to the scaling function and wavelet coeffi-cients at twice the given scale.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    30/86

    16 W V L T TOOLW RE

    Figure 1.8: DecompositionandreconstructionThe reconstruction algorithm is based on the two-scale relations.Whenwe sum the functions at the jth resolution, wehave

    W esubstitute the two-scale relations into 1.49) toyield

    Again w e compare the coefficents o f j + i k t ) on both sides o f 1.50)toyield

    where the right sides of the equations correspond to an up-samplingbefore convolution. We use ablock diagram Fig 1.8) to illustrate theprocedure o f these algorithms.1 6 4 appingoffunctions into theapproximation spaceBefore we go on any further on the extensions of the decompositionand reconstruction algorithms,we firstneed to showhow toobtain thescaling function representation of an input data. That is for agiveninput signal s t ) , w ewish to f ind the representation

    wherek are the input scaling funct ion coefficients to be processed.Many users o f wavelets have used th e sample discretized) values o fs t = ) as the input. Wewant to stress the fact that ingeneral,

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    31/86

    1.6. MU LTIRESOLUTION ANALYSIS 17If we require s k / 2 j ) = Sj k/2j), then the two sides of 1.53) are equal toeach other only if the scaling function is interpolatory, such as first-order B-spline that corresponds to the Haar wavelet and the linearB-spline. It istherefore advisabletoobtaincj kfrom thesampledatas t =k/2j) before applying the decomposition algorithm. In the following, weconsider the orthogonal projection ofs t) onto the V j space.Assuming Vj is asubspace of L2 and s t) E L2 , wewish to find Sj t)E V j as an approximation to s t ) .Write

    and considerSj t) to be the orthogonal projection ofs i) onto thesubspace. Then, s t) Sj t) isorthogonal to Vj sothat

    In matrix form this equation becomes

    where

    is the autocorrection sequence of the scaling func t ion . If the scalingfunction iscompactly supported, thecorresponding autocorrelationm a-trix in 1.57) is banded with a finite number of diagonal bands. Also,if the scaling funct ion forms an orthonormal basis, then

    If wehave onlythe sample valuesof the signal sto approximate the integral in 1.56)by a sum s t k/2j),wehave

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    32/86

    18 WAVELET TOOLWAREThis demonstrates the difference between the coefficients of the scal-in g function series and the sample values of the signal. The formeris used in wavelet signal processing (analog processing in the time do-main, since th e coefficient sequence of the scaling function series andthe wavelet series are to be p roc essed ), w hile the latter is used in filterbank processing (digital processing in the f requency domain) .

    1 7 ypesofWaveletsIn the prec eding discu ssions of the appro xim ate sub space and waveletsubspace, the basis fun ctions thatspan the subspace c an have orthono r-m al, semi-orthogonal, or biorthogo nal bases. There are c ondit ions to besatisfied by each typ e of basis. W e will state these conditions separatelyas follows.1 7 1 Orthonormal wavelet basesOrthogonali ty of fu nc t ions depends on the definition of the inner prod-uct in that vector space. W e have used th e inner product defined inthe L 2 space. Tw o different functions are orthogonal to each other ifthe inner produ ct of these f un ction s is zero.That is ,

    If wetake g x) / (x) , and

    we say that the f unc t ion f x ) is normalized. Hence, i f the set of basisfunctions , j E Z spans an approximation space Vj and satisfiesthe condition

    it is a normalized orthogonal set, or for short, an orthon orm al set.This definition applies to the wavelet subspace as well. A wavelet issaid to be orthonormal if the set of basis func tions uj,k = 2 j/ 2 u(2-7:r k)satisfies

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    33/86

    1.7. TYPESOF WAVELETS 19Sincethe wavelet subspaceand the approximation subspaceare orthog-onal, wehave

    Notice that the relationships in 1.63) to 1.65) are all referred to thesame levelof resolution. The relationships between w avelets at differentresolution levels are also orthogonal. That is,

    Examples of the orthonormal wavelet basis include the Haar wavelets,the Daubechies orthonormal wavelet bases of all orders, the Meyerwavelets of all orders, and Battle-Lemarie orthonormal spline wavelets not compactly supported). Wenote herethatboth MeyerandBattle-Lamarie wavelets are not compactly supported finite t ime dura t ion) .Decomposition and resconstruction sequencesThe relations between the decomposition sequences {a } ,{b } and thereconstruction sequences{pk} ,{q } are the simplest for an or thonormalbasis. Forperfect reconstructionof the signal,we may use the followingrelations:

    Once the pk sequence has been found through the construction of thetwo-scale relation of the scaling function, the other sequences are de-te rmined .1.7.2 Sem i orthogonal wavelet basesIn the case of cardinal B-spline functions of orders higher than 1 andtheir corresponding compactly supported spline wavelets, the integertranslates of the scaling functions, i.e., B-splines, as well as the B-waveletsare not orthogonal. That is

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    34/86

    20 W VELET TOOLW REHowever, the orthogonality between the scaling funct ion Nm and theB-wavelet N m aswellastranslatesofwave lets at different resolutions,is still preserved. In this case, the compactly supported spline waveletis called a semi-orthogonal wavelet. In order to facilitate efficient com-putationsof the expansion coefficients in the approximation spacesorthe wavelet spaces, a dual scaling funct ion 0 and a dual waveletUicanbe found to satisfy the biorthogonalityrelation

    where 0 = Nm and u = u N m have been used in these tw o equations.W e remark herethat both the dual scaling funct ion the dual B-spline)and the dual spline wavelet arebothfu nct ionsin the spline spaceof thesame o rder. H ence, these duals can be expanded into B-spline series ofthe same spline order. Wewill show inlater sectionshow to usetheserelations to map coefficients between wavelet spaces and dual waveletspaces.

    ecompositionandreconstructionsequencesThe sequences for the two-scale relations in the mth order spline spaceare

    The two-scale relations for thedualsplineanddual wavelets are slightlymore complicated. Since the B-spline functionsoforder m > 2 are notorthogonal basis the sequences {ak} {bk}comes from the dual splineand dual wavelets which are not compactly supported, bu t they arebothinfinite sequences with exponential decay.Explicit expressionsforthese sequences are

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    35/86

    1.7. TYPES OF WAVELETS 21where th e z-transformof{gh}is the reciprocal of the z-transformof theEuler-Frobenius-Laurent Polynomial E 0 z ) , namely

    Numerical values forthese sequences are listedinTable5.5 of the bookWavelets: A Mathematical Tool fo r Signal Analys i s S IAM Pu bl., 1997)for m = 2 linear splines) and m = 4 cubic splines).1 7 3 Biorthogonal wavelet basesIt is known in the signal processing literature that finite impulsere-sponse FIR) filters with symmetr ic or ant isymm etr ic coefficients havelinear phase or psuedo-linear phase characteristics. Linear phase prop-erties are important for minim izing signal distortion dur ing processing.The processing sequences or the FIR filters) {pk} and {qk}of finitelysupported orthogonal wavelets are generally not symmetr ic . In orderto take advantage of the symmetric property, one has to give up or-thogonality. Filter designs in a two-channel filter banks are examplesof a bior thog ona l basis. In this case, orthogonality between filters isnot required. The only requirement for filter bank design is that theoutput of the filter bank be a delayed version of the input . That is, theoutput signal must be a perfect copy perfect reconstruction condition)of th e input signal. Biorthogonal wavelets of Co hen, Daubech ies, andFeauvears are examples ofthis class of bases. In addition, there maynot exist a scaling function or wavelet associated with filters designedfor filter bank processing. In other words, there may not be a nested spaces for arbitrary FIR filters as their two-scale sequences. Forthis reason, the two-channel filter bank is an excellent alternative forprocessing digital signals.Decomposition and reconstruction sequencesThe two-scale sequences of two biorthogonal wavelets of Daubechieset al. are listed here as a reference. For mo re details of biorthogo nalwavelets, readers arereferred to Section 5.6 particularly, Exam ple 5.41)of the accompanying text A n Introduction to Wavelets [3]; the textWavelets: A Mathematical Tool fo r Signal Analysis, Ch apter 5, by

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    36/86

    WAVELET T O O L W A R EChui [2]; and the engineering texts, Wavelets and Subband CodingbyVetterliandKovacevic, Prentice Hall, 1995 [4],and Wavelets and Filter anks by Strang and Nguyen, Wellesley-Cambridge Press, 1996 [5].Coefficients of the B-97 Daubechies biorthogonal wavelet are given inthe following table.

    BiDaub9_7k

    5 4 3 2

    1235

    0 0267487574110 0168641184430 0782232665290 2668641184430 6029490182360 2668641184430 0782232665290 0168641184430 026748757411

    k

    0 0456358815570 0287717631140 2956358815570 5575435262290 2956358815570 0287717631140 045635881557

    k

    0 0912717631140 0575435262280 5912717631141 1150870524580 5912717631140 0575435262280 091271763114

    q k

    0 0534975148220 0337282368860 1564465330580 5337282368861 2058980364720 5337282368860 1564465330580 0337282368860 053497514822

    8 Wavelet acketsThe hierarchical wavelet decomposition produces signal componentswhose spectra reside in consecutive octave bands. In certain applica-tions, the spectral resolution produced bythisdecompositionmay notbe fine enough. One may want to use the CWT to obtain the nec-essary finer resolutions by changing the scale parameter a by a smallincrement. However, this increases the compuation load by ordersofmagnitude. Inordertoavoid thisproblem, wavelet packets are general-izations of wavelets inthat each octave f requency band is itself fur thersubdivided into finer f requency bands by wavelet packet transforms.In other words, the development ofwavelet packets is a refinementofwavelets in the freqency domain and isbased on a mathematical the-orem proven by I. Daubechies the ) splitting trick). The theorem isstated asfollows:

    If / k k^z forms an orthonormal basis and

    then {F1 - 2 / c ) , F2 . k k E Z} is an orthonormal basis for E =

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    37/86

    1.8. WAVELET PACKETS 23span{f - n); n E Z}. The proof of this theorm is given in her bookTen Lectures on Wavelets SIAM Pu bL , 1992, p. 326) [6].This theorem is obviously true when / is the scaling function 0since the two-scale relationsfor 0 and the wavelet u give

    Ifweapply this theorem to the Wj spaces, wegenerate the waveletpacket subspaces. T he general recursive formulas for wavelet packetgeneration are

    wherem,0= 0 and mi = u are the scaling function and the wavelet,respectively. For L = 1, we have the wavelet packets m2 and m3 gen-erated by the waveletm1= u This process is repeated sothat manywavelet packets can be generated from the two-scale relations. Becauseof th e many components available, any given signal can be representedby a choice of wavelet packets at different levels of resolution. An op-timized algorithm can be constructed to maximize a certain measure such as energy or entropy). Best-bases and best-level are two popularalgorithms for signal representations. The reader can find these algo-rithms in [7]. The Toolware is designed so that the decomposition andreconstruction algorithms can useeither wavelets or wavelet packets.1 8 1 avelet packet algorithmsThe wavelet packet algorithm follows the wavelet algorithm with theextension that th e wavelet coefficients djk are also being processed inth e same way as the scaling function coefficients c J k Hence,foreverydecomposition process, the number of components is double that of theprevious resolution. Suppose an input signal s n) has been mappedinto the approximation space Vj. That is, s n) < cj,k. Using the de-composition sequencesan and bn weobtain the scaling function seriescoefficients C j - 1 k and the wavelet series coefficients d j - i , k . W e can rep-resent the scaling function component and the wavelet component at

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    38/86

    WAVELET TOOLWARE

    Figure 1.9: Wavelet packet decomposition tree

    The coefficient sequences Cj-1,k and d j - 1 k are decomposed throu gh arand bn into four sequences

    in which the last tw o sequences m _ 2 k and Vj-2,k are wavelet packetseries coefficients. his process can be repeated for the four sequencesin 1.77) to produce eight coefficient sequences corresponding to eightwavelet packet components of the original signal s n). The decomposi-tion tree structure is given in Fig 1.9. The alg orithm f or W P decom-position and reconstruction of a one-dimensional signal is shown in Fig1.10.

    1.9 Tw o Dimensional W aveletsWhen the input signal istwo-dim ensional 2 -D ) , it isnecessary to rep-resent the signal components by two-dimensional wavelets and two-dimensional scaling functions. For any scaling function 0 with its cor-responding wavelet u;, there are three different 2 -D wavelets and one2-D scaling funct ion using the tensor-product approach. W e can w rite

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    39/86

    1.9. TWO DIMENSIONAL WAVELETS 25

    e ompose

    reconstruct

    Figur e 1 10: Block diagram fo r the WP dec om pos ition of a signal

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    40/86

    26 WAVELET TOOLWAREthe 2 Dwavelets as

    and the 2 Dscaling function as

    In the s pec tral d om ain, each of the w avelets and the scaling functionoccupies adifferent portion of the 2 -D spectral plane. When weanalyzea 2 D signal, the decomposition algorithm generates four componentsfrom the input signal. With respect to the spectral domain,the compo-nents are labeled low high L H ), high-low H L ), andhigh high H H ) ,corresponding to the wavelets x , y ) ,M 1,2 ,3 . The componentthat corresponds to the scaling function signal is called the low-low LL) com ponent. The terms low and high refer to whether the pro-cessing filter is lowpass or highpass. The decomposit ionof a 2-D signalresults in what is known as a hierarchacal pyram id. Because of thedownsampling operation, each image is decomposed into four subim-ages. The size of each su bim age is only a quarter ofthat of the originalimage. Readers can refer to the last section of this manual to try todecomposea 2 Dimag e signaland see the resultant component display.1.9.1 Tw o dimensional wavelet packetsTwo-dimensional wavelet packets are refinements of 2-D waveletsjustas in the 1 Dcase. Not onlyis the LLcom ponent thescaling functioncomponent ) decomposed to obtain fur ther details of the im age, bu t theother wavelet com pon ents L H , HL, HH) can also be fur ther decom-posed. Forex ample,startingwithanoriginal image with size 128x 128,a 2-D wavelet deco mp osition ofthis image willresult in four subimagesof size 64x64. Continuing the decomposition, one gets 16 2-D waveletpacket subimages of size 3 2 x 3 2 . The computational algorithm for 2-D wavelet packets is no different than that for the 2 -D wavelets. Itrequires an orderly bookkeeping for keeping track of the directions xor y), the filters used highpass or lowpass), and the resolutions. Thereader can make use ofthis wavelet Toolware to practice the waveletpacket decomposition and reconstruction of 2-D signals.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    41/86

    PartWavelet lgorithms

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    42/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    43/86

    2 1 WAVELET ALGORITHMS OVERVIEW 292 1 W avelet A lgorithm s OverviewThis part discusses the approach we take to numerically implementthe mathematical statements given in Part I. In addition, we also in-clude several algorithms that have been used in many wavelet signalprocessing applications such as thresholding, noise removal, and signalcompression. The algorithms are wri t ten in procedural form so thatthe reader can easily follow them to build codes using his/her preferredcomputer languages. The following algorithms are included in this sec-tion:

    1. Computation ofSTFT for 1-D signal2. Computation of CWT for 1-D signal3. Algorithm for generation of the graph ofscaling functions4. Algorithm for generation of the graph of wavelets5. Mapping between B-splines and their duals6. Decomposition of 1-D signals7. Reconstruction of 1-D signals8. Thresholding9. Two-dimensional extension of the wavelet algorithms

    10 Other algorithms2 2 Algorithm forC omputing the ST TLet us rewrite the definition ofSTFT here for easy reference:

    A straightforward approach to comput ingthe STFT is to makeuse oftheFast Fourier Transform FFT) algorithm thatcan befound inmanynumerical analysis books. The procedure for computing the STFT isgiven here:

    1 Choose a symmetric window function and sample it at the samerateas the input data2. Count the totalnumber ofsamples of the windowfunction, say N

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    44/86

    30 WAVELET TOOLWARE3. To take care of the edge (or boundary) effect of the algorithm , wemay reflect N/2 (if N is even) or N-1 /2 (if N is odd ) data points to

    the outside the edgesof the 1-Ddataset at both endsof the set.Thatis, if thedataset has M data points, the modified datasetwill haveatotalofM + N points from - y to M y .

    4. Position the center of the window sample data (or the center of thewindow) atn =0 and mult iply the window sample with thedataset. Take an TV-point FFT to obtain the spectrum of the funct ionatn =0.

    5. Shift the window datato the r ightby one point and repeat step 4to obtain the spectrum of the funct ion at n =1.

    6. Repeat step 5 unti l the center of the window has reached the endpoint of the data set at n = M 1. The result ing output datashould be a rectangular array of M xN points.7. Display the data through eithera 3-Dplot or a gray-scale plot.

    x mpleW e use an example similar to the one given in Dauchies book forillustration. Let the function to be processed be

    f t =sin 10007t sin 2000t a[6 t - t1) t - t2 ) ] , (2.82)wherea is aconstant chosen to be 3 andt1andt2are0.192 and 0.196msec, respectively. The funct ion issampled at 8000 points per second.The frequencies are chosen sothatwhen the t ime window width is smallenough to resolve the del ta functions, th e corresponding frequency win-dow w idth is too wide to resolve the two frequencies accurately. W euse a rectangular window of different window widths , 8 and 64 points,respectively. The STFTs of the fun ction s for these window s are com-puted usingthe Toolware,and the resultsare shown in Fig 2.1 and Fig2.2. One can easily see from these graphs that if the w ind ow in thetime-domain is wide enough to resolve the low frequencies, the deltafunctions are not resolvable. If the time -dom ain wind ow is narro wenough to resolve the del ta functions, the frequency resolution is low.W e will show later that the CWT can resolvethe delta functions andthe frequencies simultaneously in only one pass by varying the scaleparameter.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    45/86

    2.3. ALGORITHM FOR COMPUTING THE CWT 31

    Figure2.1:STFT outputsfor the windowsize equal8

    2 3 Algorithm for Computing the WTThe d efin ition of the C W T given in part A is wri t ten here:

    where h t) = isused in 2.83). Usingthe convolution integralexpression, 2.83) can be computed by us ing FFT as in the case ofSTFT.The steps are outl ined as follows:

    1. Select a wavelet of your choice to be used for this computation.2. For a given scale a sample the wavelet at the same rate as the

    i nput data.3. Treatthedataat the edgethe sameway asindicatedin theSTFT.4. Compute the FFT of the input data and that of the wavelet atscalea5. Mult iplythe twoFFTsand take the IFFT to obtain the CWT of

    the function at the scalea

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    46/86

    32 WAVELETTOOLW RE

    Figure2.2: STFT outputsfor the window sizeequal64

    6. Repeat steps 2through 5 for asmany valuesof a as the user wishes.7. Displaydatausing a 3 D plot or gray level display.ExampleThe same func t ion used to demonstrate the STFT is also used hereto demonstrate the characteristics of the CWT. We choose the Morletwavelet and compute the CWT via FFT. The result shown in Fig 2.3clearly showstheadvantageof a flexiblewindowof theCWT. Itrequiresonly one computation to resolve both the frequencies and the deltafunc t ions in 2 .82) . On e can compare this graph o f the CW T to thatof the STFT.

    4 omputation andDisplayofScalingFunctionsW egive tw o algorithms fo rcomputingthe scaling func t ions .pectral domainmethodLet us recall th e two scale relations for the scaling func t ion

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    47/86

    2.4. COMPUTATION AND DISPLAY OFSCALING FUNCTIONS

    Figure 2.3: CW T outputs

    and consider the spectral domain expression ofthis relation, namely,

    2.84where P *) is the z-t ransform of the sequence pk. Hence, the scalingfunction < 0 > t ) can be obtained by finding the I Tof the infinite prod-uct given by 2.84). In general, the infinite product must be t runcatedsothat there isonlya finite number ofpointsin the I T program.

    This approach is not easy to implement because the complexity ofthe product of the discrete Fourier transform of the sequence {pk} Ifthe number of elements in this sequence is small, the problem is stillmanageable; otherwise, the data storage required is substantial . Thefollowing alternative approach can be used.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    48/86

    34 W VEL ET TOOLW REIterative methodW e m o d i f y the two-scale equation to fit an iterative techniquebycon-sidering

    The index n indicates the number of iterative loops. For initial-izat ion, the user may use either first- or second-order B-splines. Theiteration should converge after 5 to 10iterations if the regularity ofthe funct ion ishigh. However, fo rsome sequences designed by the per-fect reconstruction filter bank approach, the algorithm may not evenconverge at all. Inother words, thereare filterbanks that are not as-sociated with scaling functions and wavelets. The finaldata may beseen byusingthe usual 1-Dgraphic display. The codeto generate thescalingfunct ion inthis Toolware isbased onthis algorithm. W eoutlinethe procedureas follows:

    1. Initialize the program bysettingalldatafiles to zero.2. Setdesired numbero fiteration, say 10, and set the iteration index

    to 1.3 . Input the initial trial function 0 0 X ) . One m ay use an impulsefunct ion, a rectangular pulse i.e., first-orderB-spline),a triangu-larpulse i.e., second-order B-spline), etc.4 . Carry ou t 3.13) byconvolvingthe funct ion with the Pksequence.5. Upsample the resulting sequence by inserting zeros in between

    everyother data point. Thissequence is01 x)6. Increase the iteration indexby 1 and repeat steps 4 to 6until10iterationcycles have been completed.

    The readermay use the Toolwareto famil iarizehimself/herself withscaling funct ions included in the software. 5 omputation ndGraphical DisplayofWaveletsTogenerate awaveletthat satisfiesthe two-scale relation

    we can use either the spectralor the time-domain approach. For thespectral-domain approach, w e simply multiply the infinite product in

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    49/86

    2.6. MAPPING BETWEEN B-SPLINES AND THEIR DUALS 35 2 .84) , except that th e index k runs from 2 to , by one-half of thez-transform o f {qk},nam ely ,

    For the t ime-domain approach , we take the l inear combination of thetranslate scaling function 0 2 t k) using the coefficients qk. We usethe t ime-domain approach in this Toolware to generate the graphsofdifferent wavelets. The reader should use the Toolware to view differentwaveletsas giveninPart C.

    2.6 MappingbetweenB-SplinesandTheirDualsW hen B-splines are cho sen to represent a signal s t ) , we have shownin Part I that it is necessary to map the sample values s toan approximat ion of the signal Sj t) This proceduremaps the signal into the B-spline or the approximation) space at thejth resolution. Since the decomposit ion sequences { a k } and {b k }f o rB-splines and B-spline wavelets are infinitely long, a t runcat ion of thesequenceisnecessary w itha reasonablefilter lengthto ensure adequateaccuracy. Fo r processing o f large images e.g., m am m o gram s at 4000x5000 x 12bits per image) or 3-D images e.g., multislice CAT scans) ,the decomposit ion process is inefficient and the compuational load islarge. Since th e B-splines Nm 2 j t k) and its dua ls spanthe same subspaceVj, it isconvenient and efficient to map the B-splinecoefficients cj,k to the dual-spline coefficients After that, we mayprocess th e signal using sequences {pk} and {qk},whichare finite withrelatively short filter lengths.Let

    be a signal approximated by a B-spline seriesand the du al B-sp line series , respec tively, ck,jare the splineco efficients that have been determined through theinitial

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    50/86

    36 WAVELET TOOLWAREmapping f rom the sampled values. To obtain the dual B-spline coef-ficients one simply makes use of the orthogonality condit ion betweenthe B-spline and its dua l

    Let j = 0 by making the sampling interval unity. W e c o m p u te the dua lcoefficients ck j by

    Since B-splines have compact support the au tocor rela t ion sequence

    is a finite sequence w here

    soth t

    can be co mput ed very eff iciently. If the final object ive of the processingrequires the rec o nstruc t ion of the signal as in image co m pression oneneeds to eventually convert the processed coefficients back to B-splinecoefficients fo r image quali ty evaluat ion and display. However if theprocessing object ive is for detect ion and reco gn i t io n the dual-splinecoefficients can be used fo r neura l network t ra in ing purposes . 7 Decompositionof a 1 D SignalThe decomposi t ion a lgor i thm fo r scaling funct ion coefficients is de-scribed by

    W e can rewrite the expression as

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    51/86

    2.8. RECONSTRUCTION OF 1-D SIGNALS 37which isinterpreted as convolutionbeforedow nsampling by 2. In termsof digital signal processing symbolism, it is given in Fig 1.8.

    Thecomputationof the wavelet coefficients at onelevelof resolutionis carried out in a similar manner, namely,

    Cominethese tw ostepsto form the decomposition blockasshow n later.This decomposition blockcan be repeated and sequentially applied tothe scaling funct ion coefficients Cj_p,k, to yield the wavelet coefficientsequences d j - p - 1 k p = 0 ,1 ,2 , . . . . , M .

    Implementat ion of 2.94) is simple. Takin g a scaling coefficient setto convolve with the coefficient set { a k } and downsampling yields thescaling function coefficients at one lower resolution level. R ep ea tingthe same procedure with coefficient set { b k } yields the wavelet coeffi-cients. These procedures arerepeated to yield the coefficients at lowerresolutio n levels.

    2 8 Reconstructionof 1 D SignalsThe two-scale relations for the approximation space and the waveletspace constitute the reconstruction algorithm. The scalingfunct ion co-efficients at a higher resolution level are computed by using the formula

    Each summation can be interpreted as ac onvolution process after upsampling. This process is depicted in Fig 1.8. It can b e repeate d forcoefficient sequences { C J - P k } and { d j - p k p = M M 1 , . . . ,0 . Thereader should use the Toolware to practice this algorithm for 1-D sig-nals.2 9 ThresholdingThresholding is one of the most often used processing tools in waveletsignal processing. It is used in noise red uc tion , in signal and imag ecompression, and sometimes in signal recognition. The four types ofthresholding we use are l )h ard thresholding, 2)soft thresholding, 3)quanti le thresholding, and 4) universa l thresholding. The choiceofthresh olding me thods d epen ds on the app lication. W e discuss each typehere briefly.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    52/86

    38 W VELET TOOLW RE2 9 Hard thresholdingHard thresholding sometimes is called gating. If a signal or a coeffi-c i en t ) valueisbelowa preset value, it is set to zero. That is

    wh er e a is the threshold valueor the gatevalue.2 9 2 Soft thresholdingSoft thresholding isdefined as

    T he func t ion f x ) generally is a linear func t ion a straight line withslope to be chosen . However, spline curves of third or fourth ordersmay beused to effec t ive ly weight thevalue greater than a

    In some applications such as signal compression, using a quadraticspline curvemay increasethe compression ratio by a certain amount.2 9 3 Quantile thresholdingIn certain applications, such as image compression, where a bit quotahasbeen assigned to the compressedfile it ismore advantageousto seta certain percentage ofwavelet coeff ic ients to zeroto satisfythe quotarequirement. In this case, the settingof the threshold valuea isbasedon the histogram and total number of coefficients. The thresholdingrule is the same as hard thresholding.2 9 4 Universal thresholdingIn some noise removal applications in which the noise statistics isknown, it may be more effective to set the threshold value based onth e noise statistics. For example, Donoho and Johnstone [8] se t thethreshold value to be

    whe r e v is the standard deviation of the noise and l is the cardinalityof the data set. This threshold value can be used ineither hard or softthresholding as shown earlier.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    53/86

    2.10. TWO-DIMENSIONAL EXTENSION OF WAVELET ALGORITHMS 39ImplementationIm plem entations of the h ard , quantile and universal thresh olding m eth-ods are quite simple. One simply subtracts the threshold value fromth e magni tude ofeach coefficient. If the difference is negative, the co-efficient is set to zero. If the difference ispositive, no change is appliedto the coefficient. To implem ent the soft thresholding by using a linearfunction of unit slope, the thresholding rule is

    2.10 Two Dimensional xtensionofW avelet Algorithms

    W e have mentioned in previous sections thatthe 2-Dwavelets aretensorproducts of the 1-D scaling function and the wavelet. Correspondingto the scaling function and the wavelet in onedimension are three2-D wavelets and one 2-D scaling function at each level of resolution.As a result, the 2-D extension of the wavelet algorithms is the 1-Dalgorithm applied to both the x and y directions o f the 2-D signal. Letus consider a 2-Dsignal as a rectangular matrix of signal values. Inthe case where the 2-D signal is an image, we call these signal valuesPixel values corresponding to the intensity of the optical reflection.Consider th e input signal cj m ,n) as an N xTVsquare m atrix . We mayprocess the signal alongthex direction first. That is wedecompose thesignal row-wise fo r every row using the 1-D decomposition algorithm.Because of the downsampling operation, the tworesultant matrices arerectangular,and ofsizeN x~ These matrices are then transposed andprocessed row-wise again toobtain four ~x y square matrices, namely,c j-1 m ,n) ,di 1 m ,n ) , d J 2 l m ,n) , and d { - 1 m ,n ).T he subscripts of thed matrices correspond to the three different wavelets. This procedurecan be repeated an arbi t rary number of times to the c m ,n) matr ix or the LL component ) , and the total number of coefficients after thedecomposition is always equal to the initial input coefficient T V 2 Thereader may use the Toolware to practice the 2D decomposition andreconstruction algorithms.

    If the coefficients are not processed, the originaldata can be recov-ered exactly through the reconstruction algorithm. The procedureissimply the reverseof the decomposition, except that the sequences are

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    54/86

    40 WAVELET TOOLWARE{Pk i Q k }instead of {ak,b k } Care should be taken to remember upsam-pling first before convolution with the processing sequences.

    2 11 Other Algorithm sToolware also includes following codes for wavelet processing:

    Noise removal using hard thresholding Image compression using thresholding 1 Dwavelet packet deco m pos itionandreconstruction 2 Dwavelet packet deco m position andreconstructionImplementat ion ofnoise removal isstraightforward and is not elab-

    orated here. The user can makeuse of the Toolware to see the effect ofspeckle noise being removed from an image, using hard thresholding.Setting the wavelet or wavelet packet) coefficients at small ampli-tudes tozeroby thresh oldin g compresses the image info rm ation becauseit takes many fewer bits to represent clusters of zero coefficients. Thereconstructed imagewilllose fidelitybecause som e highfrequency com-pone nts of the image have been removed by thresho lding.The algorithmic logic of the 1-D and 2-D wavelet packet algorithmshas been discussed inPart I. The basic algorithm is no different fromthe wavelet algorithms, except the user has to keep track of the decomposit ion structure. A procedural discussion of these algorithms isvery lengthy and will not be presented here. We encourage the user topractice this algorithm in the Toolware using the images provided, orimages from other sources.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    55/86

    PartIIIToolware User s Manual

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    56/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    57/86

    3.1. THE WAVELET TOOLWAR E OVE RVIEW 433 1 The W avelet Toolware Overv iewWavelet Toolware is a 32-bit, stand-alone software program with allnecessary library routines bundled together in a package. It has fivetools: the one- and two-dim ensional 1-D /2-D ) discrete wavelet tran s-form DW T) tools, the continuous wavelet tran sfo rm CW T) tool, theshort time Fourier transf orm STFT ) tool, and the wavelet generationtool. 1-D/2-D DWT tools respectively support DWT decomposition,DWT coefficient processing,and DWT reconstructionofone- and two-dimensional signals. The CWT tool reads in a 1-D signal datafilecomputes its CWT coefficients, and then displays the coefficients onthe screen. Similarly,the STFT tool reads in a 1-Dsignal and gener-atestheSTFT coefficients fordisplay. The wavelet generation tool is asimple utility to generate B-spline wavelets and Daubechies orthonor-mal wavelets.

    The 1-D and 2-D DWT tools have a similar operating structure.They assist the user to decompose a signal, using scaled wavelets atdifferent levels, process DWT coefficients, and then reconstruct thesignal in a veryflexible manner. A decomposed signal can be recon-structed from any level to any other lower level, with only seleced levelsaffected. In addition to some simple processing functions already in-cluded in Toolware, the user can also add new functions to Toolwarethrough adefined dll prog ram interf ace . Toolware creates n ew files onlyat the explicit requestof the user. Thus, accidental crashor terminationof Toolware execution should not affect existing files. Toolware runson the Microsoft Win95 or NT 3.1, 3.5, 3.51, 4) operating system.For performance and stability reasons, we recommend systems with aPentium 133Mhz or equivalent processor, and 32M B of main mem ory.The memory size should proportionally increase forprocessingoflargefiles to keep interm ediate results.3 1 1 Installation ofToolwareToolware installation is very simple. The user just follows these steps,and the installation program does the rest.

    1.Insertthe CD-ROM into the CDdriveE whichis the most typicalCD drive label. If the label of the CD drive on your machine isnot E use the proper CDdrive labelin subsequent steps.

    2. Clickon the run icon on the desktop.3. Type in E setup command, and the installation willstart.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    58/86

    W VELET TOOLW RE

    4. Interact with the installation software to load Toolware programfiles and datafilesinto the directory thatyouwant to host Tool-ware.

    3 1 2 WaveletsToolware supports several different wavelets, inclu ding Da ubech ies or-thonormal wavelets Daubl to D au bl O ); l inear B-spline wavelet andcubic B-spline wavelet; Battle-Lemarie spline wavelets; zeroth- andfirst-order Meyer wavelets; and biorthogonal Daubechies wavelets 1,1)to 1,3), 2,1)to 2,4) , 3,1)to 3,5), 4,1), 4 ,2) , and 5,1). A s shownin Fig 3.1, an image is decomposed using the tensor product of the1-D t ransformof an image along its vertical and horizon tal directions,respectively. Boundarydataforboth 1-D and 2-Ddataaretreatedbya s imple wrap-around or data-reflection method to achieve perfect ornearly perfect) reconstruct ion.

    Figure3.1:Theone-lelvelDW T decomposition struc tureof a 2-DimageinToolwareToolware is not designed for solving high-precision computational

    problems, but ismeant forgeneral learningand experimentation. Typ-ical numerical errors in the decomposition and reconstruction of a512x 512gray-scale imageare listedin the following table. The signal-error ratio is defined as the absolute ratio of the reconstruction errorsdivided by a signal, expressed in decibels. Our test results show thatthe difference innumerical errors on different machines isvery small.

    waveletDaublDaub2Daub3

    errors0 00000e 1008.16986e-201.63352e-18

    signal-error ratiodB2.39009e+02 dB2.26000e+02 dB

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    59/86

    3 2 U SI NG TOOLWARE

    waveletDaub4Daub5Daub6Daub7Daub8Daub9DaublOBiDaubl_lBiDaubl_2BiDaubl_3BiDaub2_lBiDaub2_2BiDaub2_3BiDaub2_4BiDaub3_lBiDaub3_2BiDaub3_3BiDaub3_4BiDaub3_5BiDaub4_lBiDaub4_2BiDaub5_lLinearBSplineCubic BSplineBattle_LemarieMeyerzeroMeyerfirst

    errors7.98535e-201.15028e-191.17830e-191.17253e-194.24760e-197.74388e-208.43506e-190 00000e 1000 00000e 1000 00000 1000 00000 1000 00000e 100

    8.46053e-13

    5.28276e-018.46053e-134.90989e-201.14181e-214.92118e-207.94940e-083.08383e-011.10625e-176.31288e-024.62319e-02

    signal-error ratio2.39108e+02 dB2.37523e+02 dB2.37418e+02 dB2.37440e+02 dB2.31849e+02 dB2.39241e+02 dB2.28870e+02 dB

    dBdBdBdBdBdB

    1.68857e+02 dBdBdBdB

    5.09022e+01dB1.68857e+02 dB2.41220e+02dB2.57555e+02 dB2.41210e+02 dB1.19127e+02 dB5.32399e+01 dB2.17692e+02 dB6.01285e+01dB6.14814e+01dB

    3 Using oolwareToolware isactivated bydouble-clickingon the Toolware group icon,Fig 3.2, which is placed at the designed directory during installation,tobringout the main menu,Fig3.3. After the main menuappearsonthe screen, the user can activate any of the five tools simultaneously.The five tools include one-dimensional discrete wavelet transform andprocessing two-dimensional discrete wavelet transform andprocessing continuous wavelet transformshort time Fourier transform STFT) and the generation of

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    60/86

    W VELET TOOLW RE

    Figure 3.2: The start-up icon fo r Toolwareprograms

    Figure 3.3: Tool ware m ain m enu

    wavelets hese tools operate independently and they usedifferent data formats.

    3.3 2 D DWT ool

    After you open the 2-D DW T tool you need to choose adatafilebeforeproceeding with other processing functions. his isdone by clickingon

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    61/86

    3.3. 2 D DWT TOOL 47

    3 3 1 Data file selectionToolware accepts pgm image files, meaning that any files appendedwith .pgm can b e read into Toolware for processing. After th e userclicks on the File button, or its corresponding graphical icon, the fileselection window (Fig 3.4) will pop o ut for the user t o open an imagefile for processing. From th e file window , one can identify any imagefile (in P G M form at) in any d irectory a n d the n load t he file by clickingon the bu t t on.

    Figure 3 4: File selection window for 2 D imagesA loaded image is automatically displayed on the screen for DWTan d processing (see Fig 3 5 for a sculpture image, file nam e art.pg m ,taken from the main campus of Texas A M University). T he left-most corner of this window lists the tit le of the tool and the cho-

    sen file name.maxim ize, minim ize, an d close th e current window. T h e second rowT h e two buttons at the upper r ight cornerDWT tool where each of these headings is a pull-down menu.Although they could be activated from the pull-down menu, keyoperations of the 2-D tool are represented by thumbnail icons at thethird row of its window.T h e first grou p of four icons enable ope ning, saviing a displayed image. The second group of three iconsthe decomposition, reconstruction, and processing of the selected im-age. Up t o five levels of D W T coefficients can be s tored in t h e intern albuffer for display, but only levels 0 t o 3 can be processed by processingfuncti e P bu tto n. By clicking on one of t h e followingicons ), the user can display any particular decomposi-

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    62/86

    W V L TTOOLWARE

    Figure 3 5: A 2 Dimage in the 2 D tool

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    63/86

    3 3 2 D DWT TOOL 49t ion levelofw avelet coefficients.A ll DW T coefficients at different levels are buf fered in Toolwareand they are dynamically packed together to form one display image asneeded . Level 0 repres ents the origina ldata or the image reco nst ru c tedfrom i t s DWT coefficients. Ob viously the rec ons tru cted image can bedifferent f rom the original one if certain D W T coefficients are manip-ulated by processing func t ions in the tool. Th e user needs to takeprecaution in preserving the original image while saving new resultsintothe ha rd d i sk .3 3 avelet decompositionAfter an image is loaded into the 2-D tool it can b e dec omp osed byclicking on the b u tto n. Th en a list of wavelet d eco m pos ition se-quences willpop up along w ith a choice of the d ecom posit ion st r u ctu re.Fig 3.6 shows an exam ple in which a five-level wavelet-packet stru c-t u r e is selected for decomposi t ion of an image using the Daubechiesb iorthogonal w avelet . The decomposit ion process isstarted and termi-nated au tom at ical ly b y c licking on the O K b u t ton .

    Figure 3.6: Selectionof the decomposit ion parametersAfter Toolware has per for m ed the d ecom posit ion based on selectedparamete rs the decomposed image will pop up on the window sothatth e u se r c an view th e absolute valueof the wavelet coefficients see Fig3.7. The displayed image is generated b yus ing the t runca ted abso lu te

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    64/86

    50 W VELET TOOLW REvalues ofwavelet coefficients, but raw DWT coefficients are retained inan internal buffer foractual processing. As needed, any other decom-posit ion level w ithin the decom posit ion range can be seen by cl ickingon one of the icons W hen the leveli is clicked on, allDWT coefficients from level to level are displayed in the same win-dow. In a composed imageof DWT coefficients, the upper left blockisthe LL low-low) ba n d, the lowerleft block is the LH low-high) ban d,the upper r ight block is the HL high-low) band, and the lower rightblock is the HH high-high) band. Although the image is decomposedfor four levels, th e example in Fig 3.7 showsthat we can still retrievelevel-2 wavelet packet coefficients for processing and display, since allcoefficients at every level are saved into an internal buffer. The screenremains unchanged if an invalid level of an image is chosen. This canhap pen , for examp le, if the user tr ies to view the second-level DW Tcoefficients of an im age not yet decom posed.

    Figure 3.7: DWT coefficient display

    isplaythresholdingWavelet coefficients are usually very sparse. For much better visualeffects, we display wavelet coefficients, except for the coefficients in thelowest subband, in reverse brightness. That is, except for DWT co-efficients in the lowest subband, i.e., LL, LLLL, LLLLLL, etc., larger

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    65/86

    2 D DWT TOOL 51

    D W T coeff ic ients are repre se n ted by darke r display pixels. For con ve-n ien ce o fo p e r at i o n , a set of b u t to n s ,is available fo r quick preview o f thre sho l d ing ef fects wi thou t c ha ngingthe ir in te rna l va lues . The two l e f tmos t buttons decrease / increase thesm allest abso lute ) values to be displayed. The ne x t two b u t t o n s de-crease / increase the largest abso lute) values to be displayed. Ne xt tot h e m , the ruler- l ike icon in dicates the se lec ted lower /upper bounds wi threspect to the ran ge of t ru e values. Wavele t coeff ic ients that fall in tothe l owe r / uppe r b ound se t t i ng are scaled to the display range of 0 to255. The far right button resets all the threshold se t t ings an d r e t u r n sthe image display back to i t s or iginal f o rm. W e remark here that un -like the process ing f u n c t i o n s , the display thresholding does n o t havep e r m a n e n t effects on the internal values of the displayed DW T coeffi-c ien ts . The user should use bui l t - in or cus tom process ing f u n c t i o n s toalter D W T coeff ic ients fo r actual s ignal process ing purposes . Fig 3.8shows an example in which some DWT coeff ic ients are thresholded inthe display buf fer , sothat they become less v is ib le on the sc reen .

    Figure 3.8: DW T coefficient display af ter thresholding

    3 3 4 W avelet reconstructionW en o t ethat o n c eadataset isde c ompose d , its se lec ted decomposi t ionparameters are locked into the t o o l to prevent e r roneous , meaninglessr e c on s t ruc t ion . W he n c l ic k ing on the b u t to n , a window f or s e -le c t ion o f r e c on s t ruc t ion parameterswill pop up. Toolware can performre c ons t ruc t ion b e twe e n di f ferent levels, an d thei r results will bestored

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    66/86

    52 W VELET TOOLW REin i ts internal bu f fe r s w ith the possib ility o f overw riting their existing contents. For example if an image is decomposed into four levelsits DWT coefficients at levels 1 2 3 and 4 are kep t in the inte rna lbuffers . If a level-3 to level-0 rec on stru ctio n requ est is selected as inFig 3.9 D W T coefficients stored in level 3 bu f fers are retrieved andthen reconstructed back to level -2 subbands . The new level-2 valueswill b e saved into the level-2 buffers . Then level-2 coefficients will b ereconstructed into level-1 coefficients and new level-1 coefficients willb e reconstructed back to level-0. If any of level-3 coefficients have beenaltered before the reconstruct ion request it is likely that old level-2level-1 and level-0 coefficients wil l be o verwrit ten in the recon struc t ionprocess.

    Figure 3.9: Selection of DWT reconstructionAs usual the user can view the new DWT values after reconstruc-

    tion. If the user exits Toolware at this point the original file on thehard disk is not affected b u t if the file-savebutton isinvoked then thelatest level-0 imag e w ill replace the origin al image if the samef i le nam eis chosen. oefficient processingIn most signal processing applications D W T coefficients are altereddeleted or clustered to achieve certain effects. The 2 -D tool allowsthe user to add new funct ions for processing of DWT coefficients inits buffers . Processing o f DWT coefficients is tr iggered by theb u t ton and a list of processing fu nct ions wil l pop up.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    67/86

    2 D DWT TOOL 53

    Figure 3.10: Selection of DWT processing functions

    In the example shownin ig3.10,the userhas chosento applyasimplethresholding routineto eight subbands of the decomposed ar t .pgm im -age. When the OK but ton isclickedon, this routine will be applied toeach of the s ub ban ds, one after another, until all the selected subbandsare processe d. Post-processed D W T coefficients will be displayed onthe screen automatically, see ig 3.11.

    Figure 3.11: Post-processed DW T coefficientsIn addition to its own internal routines, the 2-D tool will acceptuser-defined processing functions, provided that they conform to thefollowing dll interface stru ctu re. M ore detail on the integration of

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    68/86

    54 W VELET TOOLW REprocessingfunc t ions to the Toolware willalsobediscussed in the sectionon the 1-D tool .

    tfdefine P R O C D /*Tell the T o o l w a r e that thisis a 2-Dprocessing routine*/# d e f i n e N A M E S im ple S m ooth ing /*Th e name ofthis routine*/#include extfuncl.h /*Some T o o l w a r e symbols*//* This routine accepts floating point n u m b e r splaced in the 2-Darray input ,*//* process the array, andthen place the resultsat the 2-Darray output . *//* Thedimension of the matrix is specified by x a n d y .*/

    T O O L B O X _ F U N C T I O N process(float huge **input,float huge **output, int x, int y)int i,j;

    output[i] [ ] =(input[i-1] [j-1] +input[i][j-1]+input[i+l][j-l])+(input[i-1] [j] +input[i][j]+input[i+1] [j])+

    (input[i-1] [j+1] +input[i] [j+1]+ i n p u t[i+1] [j+1

    O neneedsto use acom pi lertocom pilea newrou t ine in to aW in d o w s dll (dy nam iclink l ibrary)fi le and placeit into the Toolware directory.Otherwise , the 1-D tool will not be able to f ind your cus tom rou t inefor execution. In using Borland C++ 5.0,one loads the .ideprojec t ( inC++) intoth e compiler an dmakes necessary fu n c t io n a l changes. Th en,simply bui ld the dl l l ibary to be saved into the Toolware directory. Ifyou u se other compilers to generate codes, in order to be compat ib le ,the .dllused m ust have nam es e xpo rted expl icit ly (see dl l .m ap) . I fthese files do not match, Toolware wil l assume that the .dllis n ot anexternal tool designed for i t and will ignore it.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    69/86

    3.4. 1 D DW T TOO 55

    Figure3.12: 1-D data fileselection3.4 1 D DWT ToolAfter the 1-D DWT tool is activated, it does not display any signalbefore anydatafile isopened. The 1-D DWT tool has the sameset ofcontrol buttons as the 2-D DWTtool,but their display and processingmechanisms are quite different. The list of filesthat can be read intothe 1-D DWT tool byclickingon the button isdisplayed onthe screen,see Fig 3.12. atafileformatThe 1-D DWTtoolacceptsnumerical (integer or floating-point files inthe ASCII format. Appending pts to a filename, i.e., / z /e_nome.ptsmakesitvisibleto the 1-D DWT tool,and the filename will appearonthe filelistofToolware. The folowing are three examplesthat haveanacceptabledataformat for the Toolware.Style 1:

    111 444 998 1773 2765 3973 5395 7 27 8866

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    70/86

    56 WAVELET TOOLWARE0 0109060 0131450 015577Style2:0 0000000 0001110 0004440 0009980 0017730 002765 0 003973 0 0053950 007027 0 0088660 010906 0 013145 0 015577Style3:37 40 204 80 88 163 186 131 112 157 129 120 82 69116 74 43 73 114 73 90 123 147 149 165 193 185 168180 203 172 165 181 182 183 177 191 210 197 219 224148 96 255 100 1 144 88 20 7 55 45 27 74 43 58 19374 93 179 185 113 114 172 114 10 0 87 70 100 64 3875 109 63 85 139 135 138 161 172 188 186 173 185 206170 163 1 93 182 171 178 196 208 194 214 223 191 74226 181 0 123 109 33 5 42 56 26 49A f t e r a data file is loaded into the Toolware, it is graphically displayedon the screen in a three row f o r m a t , see Fig 3.13, and the data isready for DW T de comp osit ion, processing, and reconstr uct ion. Thethree rows have thre e different buffe rs , denoted as DB1 DB2 and DB3which will b e also used for processing and r econs t ruct ion of DWT co-efficients. In this example, b oth DB and DB2 contain an unprocessedsignal, and DB3 is em pty. De tails on man agem en t of the th re e displaybuf fe rs will b e explained la ter .3 4 1 D DWT decompositionThe 1-D tool support s b oth pyram idal decomposit ion and wavelet-packet decomposit ion. Similar to the decomposit ion procedure of the2D DWT Tool, you need to first specify a decomposition level and awavelet typ e for deco mp osition of a one-dime nsional signal. The 1-D DWT decomposit ion is activated b y clicking on A list ofwavelets will pop up on the screen together with decomposit ion s t ruc-tur es, se e Fig 3.14. A t the user s choice, one nee ds to select the w avelettype , the decomposit ion level, and the decomposit ion s t ructure, i .e . ,pyramidal or wavelet packe t , and then click on the OK b u t t o n to startdecomposit ion. In this example, we have chosen a level-0 to level-4,

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    71/86

    3.4. 1 D DWT TOOL 57

    Figure3.13:The three row display of an acoust ic signalwavelet-packet decomposition of the signalby the cubic-spline wavelet.3 4 iewingandprocessing the dataThe 1-D DWT toolcandecomposeasignalup to f o u r levels.As in the2 D tool, it also uses d i f f e r e n t b u f f e r s to store DWT coe f f i c i en t s . Forexample, if a signal is decomposed for three levels, its DWT coeff ic ien tsin any of the three levels can be retrieved for processing, reconstruc-tion, and display. When a particular subband at a levelischosenbyclicking on one of the f o l l o w i n g level buttons, the DWT coe f f c ien t sw i l l be loaded into the three display b u f f e r s DB1 DB2 and DB3 for

    F i g u r e3.14: Selectiono fdecomposition parameters

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    72/86

    58 WAVELET TOOLWAREvisualization based on the following rules.

    W h e n the user clickson O A, the original signal isdisplayed onand the reconstructed signal, i f any, is displayed on DB3. The recon-st ruct ion) difference between DB1 and DB3 is show n at DB2. If thesystem does no t have any reconstructed data yet , then DB3 and thusthe third display row) is empty, and bo th DB1 and DB 2 display theoriginaldatabecause DB 2 keeps the difference between DB1 and DB3.For other decomposition levels, DB 3 displays the parent su bba nd ofthe two chosen subbands displayed in DB1 and DB 2. That is, at level1A , which represents the two subbands decomposed from the or ig inalsignal at 0A, its low-pass and bandpasssubbands aredisplayed inoriginal signal, is displayed onDB 3. For following levels, letters A andB respectively denote the low-pass and bandpass children of a set ofDWT-coefficients.When level 2A ischosen, the low-pass and bandpass chi ldren of thelevel 1A low-pass subband, whichisdisplayed on DB 3 areresp ect ivelydisplayed on DB \ and DB 2. Similarly, at level 2B, the low-pass andbandpass chi ldrenof the level1Abandpass subb and, w hich isdisplayedon -D-B3, are respectively displayed in DB1 and DB2. Rules for use ofand DB 2 at other levels are listed as follows.

    Level3A3 B3C3D4A4B4C4D4E4F4G4H

    D i and Dchildrenchildrenchildrenchildrenchildrenchildrenchildrenchildrenchildrenchildrenchildrenchildren

    fromfromfromfromfromfromfromfromfromfromfromfrom

    displayth eth eth eth eth eth eth eth eth etheth eth e

    low-passbandpasslow-passbandpasslow-passbandpasslow-passbandpasslow-passbandpasslow-passbandpass

    bandbandbandof 2Aof 2Aof 2Bband of 2Bbandbandbandband

    bandbandbandband

    of 3Aof 3Ao f 3 Bof 3B

    o f 3 Co f 3 Cof 3Dof 3D

    Fig 3 .15 shows DWT coefficients of an signal. In i ts normal displaymode , the maximum and minimum values of al l DW T coefficients, in-

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    73/86

    3.4. 1-D DW T TOOL 59eludingtheoriginaldata,areusedto set the display scales. Thisusuallyleads to loss of visual details of small coefficients in some subbands, asexpected, for the sake ofdisplay consistency. To remedy this problem,the 1-D tool isequipped w ith asliding magnifier through whichone canbetter view details ofsmall coefficient values. By simply pressing onthe left mouse but ton, am agnified version ofdatasur roundingthe cur-sorwill display on a small floating window,see Fig 3.16. The zoom-inwindow disappears at the releaseof the but ton.

    Figure 3.15: The three-row displayof DWT coefficientsat level-3For agiven display level,the usercanprocessdatastored in the

    to DB5 by clickingon the P processing) button, and thenthe list of processing fu nc tio ns will pop up, see Fig 3.17. By clickingon a processing function together with one or more buffer button s up-permost signal D B 1 ) , middle signal D B 2 ) , bottomsignal DB3)), theuser can processdata stored in selected buffers by the chosen function.Boththe internal anddisplay buffers are refreshed after the processingfunction is executed.

    At any t ime, the user canreconstructall or some DWT coefficients.Similar to the 2D Tool, oncea signal isdecomposed, its decomposit ions t ructure is registered into Toolware, and the user can onlyuse the se-lected dec om position wavelet and stru cture for recon struction. In theexample shownin Fig 3.18, onlythe reconstruction levelscan bechosenby th e user, and all other parameters will be set by Toolware. Oncethe reconstruction command is executed, new level-3 DWT coefficientsare reconstructed from level-4DWT coefficientsand saved into level-3

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    74/86

    W VELET TOOLW RE

    Figure 3.16: Amagnified viewofsmall DWT oeffi ients

    Figure 3.17: The windowfor 1 D DWT processing functions

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    75/86

    3.4. 1 D DWT TOO 61

    Figure3.18:Selection of the reconstruction structure

    buffers. Level-2 buffers areupdated in asimilar fashion. Thisprocessrepeats until all levels between the chosen reconstruction levels are up-dated. Asusual you can view the modified signal after reconstruction.

    ustomprocessing routinesLike the 2-D tool the 1-D toolalso accepts custom routines forpro-cessing wavelet coefficients. The following is an example routine fo rsmooth ing of the chosen signal.#define PROC1D /*Tell the Toolware this

    isa 1-D routine*/tfdefineNAME Simple Smoothing /*Name of the routine*/#include extfuncl.h /*Toolware symbols*//*This routine accepts floating point numbers placedinthe array input ,*//*processthe array, andthen placetheresultsat thearray output . *//* Thetotal number ofdata samples isdefinedby len .*/TOOLBOX.FUNCTION process(float huge *input,float huge *output, intlen

    int i;for(i=l;i

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    76/86

    62 W VELET TOOLW RE3 5 Continuous Wavelet Transform ToolThe continous wavelet transform tool (CWTtool) generates thecon-tinuous wavelet coefficients of a one-dim ensional signal. It has eightdifferent control buttons, see Fig3.19.

    Figure3.19:CW T tool control button s

    Start ing from left to right, the first button is for selection of adatafile for processing, the second and third are for saving the displayedCWT coefficients intoanASCIIdatafile, or a pgm (image)file,respec-tively. The imageof the CW T coefficient matrixcan beprinted toyourprinterby clickingon the printer button. The relative display intensityofCW T coefficients can be adjusted by the next four buttons. Clickingon the fifth button, whichhas a straight line, meansthat the displayintensity directly reflects the m agnitude of CW T coefficients. The nexttwo buttons are for (de)emphasis of small and large coefficients. Theeighthbutton allowsyou to display either onlythe m agni tude, whichisthe default mode, or signed amplitudes, with different colors assignedto positiveand negative values.

    The CWT coefficients of the signal,which are organized into atwo-dimensional matrix, are graphically shown on the display window ofthe CWT tool. The x-axisof the display is the time line,and the yaxis is the scale of the signal. After you invoke the C W T tool fromthe main menu, it will display an em pty w indow . By clicking on thefileselection bu tto n,you can selecta .pts or .wav file as the signalinput . Then, the CWT tool will producethe CWT coefficients througha self-explanatory sequence. After the signal is processed, its CWTcoefficients will be displayed on the window.

    In this example displayed in Fig 3.20, the data set (file: delta.pts)represents two compounded sinusoidal signals, in addition to two im-pulses. The frequencies of the two sinusoidal signals are 500 and1000H z, respectively. The m ag nitud es of the two imp ulses are located att =0.192and 0.196, respectively,and their magnitudeis 6. Thesam-plingrate for this signal is set at 8 kH z. Yo u can seefrom the imagethat the CWT coefficients of the tw o sinusoidal signals are clearlydis-played horizontally, and those of the two impulses are displayed verti-callyat their timeinstants.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    77/86

    3 6 SHORT TIME FOURIER TRANSFORM TOOL

    Figure 3.20: CWT coefficients

    3 6 Short ime Fourier Transform oolSimilar to the CWT tool, the STFT tool generates the short timeFourier transform coefficients of a one-dimensional signal, for a givenwindow size. Except for the selectionof the window size, which deter-mines the size of a signal segment for FFT com pu tation s, the STFTtool has an identical set of control buttons, except fo r selection of theshort t ime window,and they serve the same purposes as those in theCW T tool. By clicking on the file button, you can choose a one-dimensional data file in either the pts format , or the standard wavformat , to be processed by the STFT tool. Similar to the CWT tool,theSTFT coefficients of the signal are organized into a tw o-dimen sionalmatr ix and then graphically displayed, where the a:-axisof the displayis th e time line, and the ?/-axis is the frequency axisof the signal.

    It is interesting to compare the results obtained from the CWT tothose from the STFT. The following two figures represent the resultswhen the window sizes are set to bew 8 (Fig 3.21), and w 64(Fig 3.22), respectively. As expected, for a given window size, theSTFT has either good time resolution or good frequency resolution,but not both. Usingthe CWT, we caneasily determinethat the signaldelta.pts has two dominating frequencies, and two impulses, from theCW T coefficients. On the other hand, one must use different windowsizestotestthis signalinordertoreachthe sameor asimilar conclusion.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    78/86

    Figure 3.21: STFT coefficients for window size=8

    3 7 Wavelet uilder ToolThe wavelet builder tool constructs two different types o fwavelets andtheir scaling funct ions . In addit ion to their graphical display the nu-merical values o f those funct ions can also be expor ted to data f iles.The B-spline func t ions are generated using their closed-form expres-sions. By choos ing the B-spline family from the file se lect ion but tonyou will see the Harr wavelet at i teration 1. Each t ime you click on theyellow rightward arrow the wavelet order increases by 1.That meansthat you willsee the linear cubic and other splines and waveletsbyclicking on the same but ton . Fig 3.23 displays the cubic spline andits wavelet . The Daubechies or thonormal wavelets are generated in as imi lar m ann er . Some precom puted coefficients are already saved inthe system fo r fast retr ieval and expor t . The values o f these waveletsfunct ions can be saved into text f iles for fur ther processing. For exam-ple you could save the num erical values o fwavelet func t ions into datafiles and then use theSTFT too l to examine their spectra.

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    79/86

    65

    Figure 3 22: ST T coefficients for windo w size=64

    Figure 3 23: Cubic spline and its wavelet

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    80/86

    his page intentionally left blank

  • 7/22/2019 Wavelet Toolware_software for Wavelet Training

    81/86

    Bibliography[1 ] Haar , A., Zur Theorie der Orthogonalen Funktionensysteme, Math

    AnnaL 9 1910),331-371.[2 ] Chui , C. K., Wavelet: A Mathematical Too l fo r Signal AnalysisSIAM Publ., 1997.[3 ] Chui , C. K. An Introduction to Wavelets Academic Press, 1992.[4 ] Vetterli , M., and Kopvacevic, Wavelets and Subband Coding Pren-tice Hall Inc., 1995.[5] Strang, G., and T. N