unit 2 image processing and analysis cp7004

download unit 2 image processing and analysis cp7004

of 55

Transcript of unit 2 image processing and analysis cp7004

  • 8/10/2019 unit 2 image processing and analysis cp7004

    1/55

    Frequency domain analysis

    Diference between spatial domain and requency domain.

    In spatial domain , we deal with images as it is. The value of the pixels of the imagechange with respect to scene. Whereas in frequency domain , we deal with the rate

    at which the pixel values are changing in spatial domain.

    For simplicity , Lets put it this way.

    Spatial domain

    In simple spatial domain , we directly deal with the image matrix. Whereas infrequency domain , we deal an image lie this.

    Frequency Domain

    We !rst transform the image to its frequency distri"ution. Then our "lac "oxsystem perform what ever processing it has to performed , and the output of the"lac "ox in this case is not an image , "ut a transformation. #fter performinginverse transformation , it is converted into an image which is then viewed in spatialdomain.

    It can "e pictorially viewed as

  • 8/10/2019 unit 2 image processing and analysis cp7004

    2/55

    $ere we have used the word transformation. What does it actually mean%

    Transormation.

    # signal can "e converted from time domain into frequency domain usingmathematical operators called transforms. There are many ind of transformationthat does this. &ome of them are given "elow.

    Fourier &eries Fourier transformation

    Laplace transform

    ' transform

    (ut of all these , we will thoroughly discuss Fourier series and Fourier transformationin our next tutorial.

    Frequency components

    #ny image in spatial domain can "e represented in a frequency domain. )ut what dothis frequencies actually mean.

    We will divide frequency components into two ma*or components.

    High requency components

    $igh frequency components correspond to edges in an image.

    Low requency components

    Fourier

    Fourier was a mathematician in +--. $e give Fourier series and Fourier transformto convert a signal into frequency domain.

    Fourier Series

  • 8/10/2019 unit 2 image processing and analysis cp7004

    3/55

    periodic signals can "e "roen down into further signals with the followingproperties.

    The signals are sines and cosines The signals are harmonics of each other

    It can "e pictorially viewed as

    In the a"ove signal , the last signal is actually the sum of all the a"ove signals. Thiswas the idea of the Fourier.

    How it is calculated.

    &ince as we have seen in the frequency domain , that in order to process an imagein frequency domain , we need to !rst convert it using into frequency domain andwe have to tae inverse of the output to convert it "ac into spatial domain. Thatswhy "oth Fourier series and Fourier transform has two formulas. (ne for conversionand one converting it "ac to the spatial domain.

    Fourier series

    The Fourier series can "e denoted "y this formula.

    Discrete Fourier Transorm

    The continuous Fourier transformis de!ned as

    http://mathworld.wolfram.com/FourierTransform.htmlhttp://mathworld.wolfram.com/FourierTransform.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    4/55

    0ow consider generali1ation to the case of a discrete function, "y letting, where , with , ..., . Writing this out gives the discrete Fourier

    transform as

    The inverse transform is then

    4iscrete Fourier transforms are extremely useful "ecause they reveal periodicities ininput data as well as the relative strengths of any periodic components. There are a

    few su"tleties in the interpretation of discrete Fourier transforms, however. Ingeneral, the discrete Fourier transform of a realsequence of num"ers will "e asequence of complexnum"ers of the same length. In particular, if are real, then

    and are related "y

    for , +, ..., , where denotes the complex con*ugate. This means that the

    component is always real for real data.

    #s a result of the a"ove relation, a periodic function will contain transformed peasin not one, "ut two places. This happens "ecause the periods of the input data"ecome split into 6positive6 and 6negative6 frequency complex components.

    The plots a"ove show the real part red/, imaginary part "lue/, and complexmodulus green/ of the discrete Fourier transforms of the functions left!gure/ and right !gure/ sampled 57 times over two periods. In theleft !gure, the symmetrical spies on the left and right side are the 6positive6 and6negative6 frequency components of the single sine wave. &imilarly, in the right!gure, there are two pairs of spies, with the larger green spies corresponding to

    the lower8frequency stronger component and the smaller green spiescorresponding to the higher8frequency weaer component. # suita"ly scaled plot ofthe complex modulus of a discrete Fourier transform is commonly nown as a power

    http://mathworld.wolfram.com/ComplexConjugate.htmlhttp://mathworld.wolfram.com/ComplexModulus.htmlhttp://mathworld.wolfram.com/PowerSpectrum.htmlhttp://mathworld.wolfram.com/ComplexConjugate.htmlhttp://mathworld.wolfram.com/ComplexModulus.htmlhttp://mathworld.wolfram.com/PowerSpectrum.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    5/55

    Mathematicaimplements the discrete Fourier transform for a list of complexnum"ersas Fourier9list:.

    The discrete Fourier transform is a special case of the '8transform.

    The discrete Fourier transform can "e computed e;ciently using a fast Fourier

    transform.

    #dding an additional factor of in the exponent of the discrete Fourier transformgives the so8called linear/ fractional Fourier transform.

    The discrete Fourier transform can also "e generali1ed to two and more dimensions.For example, the plot a"ove shows the complex modulusof the -8dimensionaldiscrete Fourier transform of the function .

    .

    The inverse can "e calculated "y this formula.

    Fourier transorm

    The Fourier transform simply states that that the non periodic signals whose areaunder the curve is !nite can also "e represented into integrals of the sines and

    cosines after "eing multiplied "y a certain weight.

    Th F i t f h id li ti th t i l d i i

    http://www.wolfram.com/mathematica/http://mathworld.wolfram.com/ComplexNumber.htmlhttp://mathworld.wolfram.com/ComplexNumber.htmlhttp://reference.wolfram.com/language/ref/Fourier.htmlhttp://mathworld.wolfram.com/Z-Transform.htmlhttp://mathworld.wolfram.com/FastFourierTransform.htmlhttp://mathworld.wolfram.com/FastFourierTransform.htmlhttp://mathworld.wolfram.com/FractionalFourierTransform.htmlhttp://mathworld.wolfram.com/ComplexModulus.htmlhttp://www.wolfram.com/mathematica/http://mathworld.wolfram.com/ComplexNumber.htmlhttp://mathworld.wolfram.com/ComplexNumber.htmlhttp://reference.wolfram.com/language/ref/Fourier.htmlhttp://mathworld.wolfram.com/Z-Transform.htmlhttp://mathworld.wolfram.com/FastFourierTransform.htmlhttp://mathworld.wolfram.com/FastFourierTransform.htmlhttp://mathworld.wolfram.com/FractionalFourierTransform.htmlhttp://mathworld.wolfram.com/ComplexModulus.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    6/55

    Diference between Fourier series and transorm

    #lthough "oth Fourier series and Fourier transform are given "y Fourier , "ut thedi@erence "etween them is Fourier series is applied on periodic signals and Fouriertransform is applied for non periodic signals

    Which one is applied on images.

    0ow the question is that which one is applied on the images , the Fourier series orthe Fourier transform. Well , the answer to this question lies in the fact that whatimages are. Images are non A periodic. #nd since the images are non periodic , soFourier transform is used to convert them into frequency domain.

    Discrete ourier transorm.

    &ince we are dealing with images, and infact digital images , so for digital imageswe will "e woring on discrete fourier transform

    Bonsider the a"ove Fourier term of a sinusoid. It include three things.

    &patial Frequency Cagnitude

    =hase

    The spatial frequency directly relates with the "rightness of the image. Themagnitude of the sinusoid directly relates with the contrast. Bontrast is thedi@erence "etween maximum and minimum pixel intensity. =hase contains the colorinformation.

    The formula for - dimensional discrete Fourier transform is given "elow.

    The discrete Fourier transform is actually the sampled Fourier transform, so itcontains some samples that denotes an image. In the a"ove formula fx,y/ denotesthe image , and Fu,v/ denotes the discrete Fourier transform. The formula for -dimensional inverse discrete Fourier transform is given "elow.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    7/55

    The inverse discrete Fourier transform converts the Fourier transform "ac to theimage

    onsider this signal.

    0ow we will see an image , whose we will calculate FFT magnitude spectrum andthen shifted FFT magnitude spectrum and then we will tae Log of that shiftedspectrum.

    !riginal "mage

    The Fourier transorm magnitude spectrum

    The Shited Fourier transorm

  • 8/10/2019 unit 2 image processing and analysis cp7004

    8/55

    The Shited #agnitude Spectrum

    Fast Fourier Transorm

    The fast Fourier transform FFT/ is a discrete Fourier transformalgorithmwhich

    reduces the num"er of computations needed for points from to , where lgis the "ase8- logarithm. If the function to "e transformed is not harmonically related

    to the sampling frequency, the response of an FFT loos lie a sinc functionalthough the integrated poweris still correct/. #liasingalso nown as leaage/ can"e reduced "y apodi1ationusing an apodi1ation function. $owever, aliasingreduction is at the expense of "roadening the spectral response.

    FFTs were !rst discussed "y Booley and Tuey +DE5/, although ?auss had actuallydescri"ed the critical factori1ation step as early as +75 )ergland +DED, &trang+DD2/. # discrete Fourier transformcan "e computed using an FFT "y means of the4anielson8Lanc1os lemmaif the num"er of points is a powerof two. If the num"erof points is not a powerof two, a transform can "e performed on sets of pointscorresponding to the prime factors of which is slightly degraded in speed. #n

    e;cient real Fourier transform algorithm or a fast $artley transform)racewell+DDD/ gives a further increase in speed "y approximately a factor of two. )ase83 and"ase8 fast Fourier transforms use optimi1ed code and can "e -7827 faster than

    http://mathworld.wolfram.com/DiscreteFourierTransform.htmlhttp://mathworld.wolfram.com/Algorithm.htmlhttp://mathworld.wolfram.com/Lg.htmlhttp://mathworld.wolfram.com/Logarithm.htmlhttp://mathworld.wolfram.com/SincFunction.htmlhttp://mathworld.wolfram.com/Power.htmlhttp://mathworld.wolfram.com/Aliasing.htmlhttp://mathworld.wolfram.com/Apodization.htmlhttp://mathworld.wolfram.com/ApodizationFunction.htmlhttp://mathworld.wolfram.com/Aliasing.htmlhttp://mathworld.wolfram.com/DiscreteFourierTransform.htmlhttp://mathworld.wolfram.com/Danielson-LanczosLemma.htmlhttp://mathworld.wolfram.com/Power.htmlhttp://mathworld.wolfram.com/Power.htmlhttp://mathworld.wolfram.com/HartleyTransform.htmlhttp://mathworld.wolfram.com/DiscreteFourierTransform.htmlhttp://mathworld.wolfram.com/Algorithm.htmlhttp://mathworld.wolfram.com/Lg.htmlhttp://mathworld.wolfram.com/Logarithm.htmlhttp://mathworld.wolfram.com/SincFunction.htmlhttp://mathworld.wolfram.com/Power.htmlhttp://mathworld.wolfram.com/Aliasing.htmlhttp://mathworld.wolfram.com/Apodization.htmlhttp://mathworld.wolfram.com/ApodizationFunction.htmlhttp://mathworld.wolfram.com/Aliasing.htmlhttp://mathworld.wolfram.com/DiscreteFourierTransform.htmlhttp://mathworld.wolfram.com/Danielson-LanczosLemma.htmlhttp://mathworld.wolfram.com/Power.htmlhttp://mathworld.wolfram.com/Power.htmlhttp://mathworld.wolfram.com/HartleyTransform.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    9/55

    and +E using the Winograd transformalgorithm=ress et al. +DD-, pp. 3+-83+2,#rndt/.

    Fast Fourier transform algorithms generally fall into two classesH decimation in time,and decimation in frequency. The Booley8Tuey FFT algorithm!rst rearranges theinput elements in "it8reversed order, then "uilds the output transform decimation

    in time/. The "asic idea is to "rea up a transform of length into two transforms oflength using the identity

    sometimes called the 4anielson8Lanc1os lemma. The easiest way to visuali1e thisprocedure is perhaps via the Fourier matrix.

    The &ande8Tuey algorithm&toer and )ulirsch +D7/ !rst transforms, thenrearranges the output values decimation in frequency/.

    Spatial requency

    Images are -4 functions f(x,y)in spatial coordinates x,y/ in an image plane. >achfunction descri"es how colours or grey values intensities, or "rightness/ vary inspaceH

    ariations of grey values for di@erentx8positions along a lineyJ const.

    #n alternative image representation is "ased on spatial frequencies of grey value orl i i h i l hi d l i " f

    http://mathworld.wolfram.com/WinogradTransform.htmlhttp://mathworld.wolfram.com/Algorithm.htmlhttp://mathworld.wolfram.com/Algorithm.htmlhttp://mathworld.wolfram.com/Danielson-LanczosLemma.htmlhttp://mathworld.wolfram.com/FourierMatrix.htmlhttp://mathworld.wolfram.com/Algorithm.htmlhttp://mathworld.wolfram.com/WinogradTransform.htmlhttp://mathworld.wolfram.com/Algorithm.htmlhttp://mathworld.wolfram.com/Algorithm.htmlhttp://mathworld.wolfram.com/Danielson-LanczosLemma.htmlhttp://mathworld.wolfram.com/FourierMatrix.htmlhttp://mathworld.wolfram.com/Algorithm.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    10/55

    spectrum F(u,v)of spatial frequencies and the reverse conversion of the latter into aspatial representation f(x,y)are lossless, i.e. involve no loss of information. &uchspectral representation sometimes simpli!es image processing.

    To formally de!ne the term 6spatial frequency6, let us consider a simple +4 periodicfunction such as sine function x/ J sinxH

    =eriodic function x/ J sinx ?eneral sinusoidal functionx

    It consists of a !xed pattern or cycle fromxJ 7 toxJ -K E.-M in particular, 7/J 7.7M KN-/ J +.7M K/ J 7.7M 2KN-/ J O+.7M and -K/ J 7.7/ that repeatsendlessly in "oth directions. The length of this cycle, Lin the a"ove example LJ-K/ is called the period, or cycle of the function, and the frequency of variation isthe reciprocal of the period. For the spatial variation where Lis measured in distanceunits, the spatial requencyof the variation is +NL. ?enerally, a sinusoidal curvef(x)JAsinxP / is similar to the a"ove pure sine "ut may di@er in phase,period LJ -KNi.e. angular requency/, or N and amplitudeA. The sinefunction has the unit amplitudeAJ +, the unit spatial frequency i.e. the angularfrequency J -K/, and the 1ero phase J 7.

    Images "elow show whatx8directed sinusoidal variations of grey values in asynthetic greyscale image f(x,y)J fmeanPAsin-KNN/uxP / loo lieH

    Bolumn+H the "ottom image is half the amplitudeNcontrast of the top image.Bolumn -H the "ottom image is twice the spatial frequency of the top image.

    Bolumn 2H the "ottom image is D7oJ KN-/ out of phase w.r.t. the top image.#ll the images 8 from www.luc.eduNfacultyNasutterNsinewv-.gif/

    $ere, uis a dimensionless spatial frequency corresponding to the num"er ofcomplete cycles of the sinusoid per the image width Nmeasured in the num"er ofpixels. The ratio -KNNgives the spatial frequency in units of cycles per pixel. Torelate the dimensionless spatial frequency parameter uto the num"er of complete

    cycles of the sinusoid that !t into the width of the image from the starting pixelpositionxJ 7 to the ending positionxJ NO +, the function should "e speci!ed asf(x y) J f P A sin-KNNO+//ux P / so that u corresponds to the num"er of

  • 8/10/2019 unit 2 image processing and analysis cp7004

    11/55

    # few examples of more general -4 sinusoidal functions products ofx8 andy8oriented sinusoidsH

    Images fromHwww.canyonmaterials.comN

    grate3.html

    www.xahlee.orgN&pecial=laneBurvesQdirN&inusoidQdirNsinusoid.html

    In such arti!cial images, one can measure spatial frequency "y simply countingpeas and thoughs. Cost of real images lac any strong periodicity, and Fouriertransormis used to o"tain and analyse the frequencies.

    Return to the local ta"le of contents

    Fourier transorm

    The ey idea of FourierSs theory is that any periodic function, however complex it isalong the period, can "e exactly i.e. with no information loss/ represented as a

    weighted sum of simple sinusoids. Irrespectively of how irregular may "e an image,it can "e decomposed into a set of sinusoidal components having each a well8de!ned frequency. The sine and cosine functions for the decomposition are calledthe basis unctionsof the decomposition. The weighted sum of these "asisfunctions is called a Fouirier series

    where the weighting factors for each sine an/ and cosine bn/ function are theFourier coe$cients, and the index nspecifying the num"er of cycles of the

    sinusoid that !t within one period Lof the function f(x)is a dimensionless frequencyof a "asis function. # +4 function with period Lis uniquely represented "y twoin!nite sequences of coe;cients.

    The computation of the usual/ Fourier series is "ased on the integral identities seeon8line Cath Reference 4atafor more detail/H

    https://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/topic1.htm#sfdhttp://math-reference.com/s_fourier.htmlhttps://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/topic1.htm#sfdhttp://math-reference.com/s_fourier.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    12/55

    &ince the cosine and sine functions form a complete orthogonal "asis over theinterval 9OLN-, LN-:, the Fourier coe;cients are as followsH

    Figures "elow illustrate steps of summation of sine waves to approach a squarewaveH

    Images from the Cath Reference 4ata httpHNNmath8reference.comNsQfourier.htmland

    httpHNNwww."rad.ac.uNacadNlifesciNoptometryNresourcesNmodulesNstage+NNpvp+NB&F.html

    With only one term, it is a simple sine wave, and adding the next terms "rings thesum closer and closer to a square wave.

    The Fourier series decomposition equally holds for -4 images, and the "asisconsists in this case of -4 sine and cosine functions. # Fourier series representationof a -4 function, f(x,y), having a period Lin "oth thexandydirections isH

    where uand vare the num"ers of cycles !tting into one hori1ontal and verticalperiod, respectively, of f(x,y). In the general case, when "oth the periods are

    di@erent Lxand Ly, respectively/ the Fourier series is quite similarH

    The Fourier series representation of f(x,y)can "e considered as a pair of -4 arraysof coe;cients, each of in!nite extent.

    Return to the local ta"le of contents

    Discrete Fouirier transorm

    -4 Fourier transform represents an image f(x,y)as the weighted sum of the "asis-4 i id h th t th t i" ti d " " i f ti t th i i

    https://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/topic1.htm#sfdhttps://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/topic1.htm#sfd
  • 8/10/2019 unit 2 image processing and analysis cp7004

    13/55

    again !nite or periodic. The use of sampled -4 images of !nite extent leads to thefollowing discrete Fourier transorm4FT/ of an NNimage isH

    due to ejexp*/ J cos Pjsin . The forward/ 4FT results in a set of complex8valued Fourier coe;cients F(u,v)specifying the contri"ution of the correspondingpair of "asis images to a Fourier representation of the image. The term 6Fouriertransform6 is applied either to the process of calculating all the values of F(u,v)or tothe values themselves.

    The in%erse Fourier transormconverting a set of Fourier coe;cients into animage is very similar to the forward transform except of the sign of the exponent/H

    The forward transform of an NNimage yields an NNarray of Fourier coe;cientsthat completely represent the original image "ecause the latter is reconstructedfrom them "y the inverse transform/. Canipulations with pixel values f(x,y)orFourier coe;cients F(u,v)are called processing in the spatial domainorrequencyspectral/ domain, respectively. The transformation from one domain toanother via a forward or inverse Fourier transform does not, in itself, cause anyinformation loss.

    Return to the local ta"le of contents

    Spectra and &ltering

    Real, (u,v), and imaginary, !(u,v)parts of the complex num"er F(u,v)are notinformative in themselvesM more important representation is o"tained "yrepresenting each complex coe;cient F(u,v)with its magnitude, VF(u,v)V, andphase, u,v/H

    If an array of complex coe;cients is decomposed into an array of magnitudes andan array of phases, the magnitudes correspond to the amplitudes of the "asisimages in the Fourier representation. The array of magnitudes is called theamplitude spectrumof the image, as well as the array of phases is called thephase spectrum. The power spectrum, or spectral "ensityof an image is thesquared amplitude spectrumH #(u,v)J VF(u,v)V-J -(u,v)P !-(u,v). #ll the power,amplitude, and phase spectra can "e rendered as images themselves forvisualisation and interpretation. While the amplitude spectrum reveals the presence

    of particular "asis images in an image, the phase spectrum encodes their relativeshifts. Thus, without phase information, the spatial coherence of the image isd t d t h t t th t it i i i"l t i d i t d "* t With t

    https://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/topic1.htm#sfdhttps://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/topic1.htm#sfd
  • 8/10/2019 unit 2 image processing and analysis cp7004

    14/55

    important to eep the overall visuall appearance of an image, most of imageprocessing operations in the frequency domain do not alter the phase spectrum andmanipulate only the amplitude spectrum.

    'roperties o the Fourier transorm

    The "asic properties of the 4FT of an image are its periodicityand comple(con)ugate symmetry. The spectrum repeats itself endlessly in "oth directions withperiod N, i.e. F(u,v)J F(u $ %N, v $ lN)where %, l 9OX, ..., O+, 7, +, -,..., X:. TheNN"loc of the Fourier coie;cients F(u,v)computed from an NNimage with the-4 4FT is a single period from this in!nite sequence. The second property arises"ecause the image is real8valued whereas the 4FT operates on complex num"ers.Bomplex con*ugate symmetry means that VF(u,v)V J VF(&u,&v)V, so that there existnegative frequencies which are mirror images of the corresponding positivefrequencies as regarding the amplitude spectrum.

    4ue to periodicity and con*ugate symmetry, the computed spectra have one

    peculiarityH for the computed values of F(u,v), frequency increases up to uJ NN- anddecreases thereafterM the half of the spectrum for which uY NN- is a 6dou"lereZection6 of the half with u[ NN-, and the same applies to frequencies either sideof vJ NN-, as illustrated "elowH

    # portion of an in!nite, periodic spectrum exhi"iting complex con*ugate symmetry,and the sample of the spectrum "eing computed "y the 4FT.

    The interpretation of spectra is made much easier if the results of the 4FT arecentred on the point u J 7 v J 7/ such that frequency increases in any direction

  • 8/10/2019 unit 2 image processing and analysis cp7004

    15/55

    #lternatively, "y the shift theorem of the Fourier transformsee Wiipediafor a "riefdescription of the shift theorem/, the same result can "e achieved "y maing thead*acent input values positive and negative "y multiplying f(x,y)"y O+/xPyi.e. "yeeping the input values positive and negative for even and odd sumsxPy,respectively/. Typically, all the spectra are represented with the centre point as theorigin to see and analyse dominant image frequencies. )ecause the lower frequency

    amplitudes mostly dominate over the mid8range and high8frequency ones, the !nestructure of the amplitude spectrum can "e perceived only after a non8linearmapping to the greyscale range 97, -55:. #mong a host of possi"le ways, commonlyused methods include a truncated linear amplitude mapping with the scale factor for the amplitude the scaled amplitudes aare cut out a"ove the level -55M it is aconventional linear mapping if the maximum amplitude amax[ -55N/ or the lietruncated linear mapping after some continuous non8linear, e.g. logarithmicamplitude transformation. The examples "elow show amplitude spectra of the sameimage o"tained with the linear or truncated linear mapping of the initial amplitudesand the logarithms of amplitudesH

    (riginal image#mplitude spectrumHlinear scale J 2.D-

    Truncated linearmapping J +5.G

    Truncated linearmapping J -57.D

    =hase spectrumLog8amplitude

    spectrumH linear

    scale J E7.D

    Truncated log8linear

    mapping J -32.E

    Truncated log8linear

    mapping J 3G.-

    ' t f i l i "i tt f -4 i id l tt th

    http://en.wikipedia.org/wiki/Discrete_Fourier_transformhttp://en.wikipedia.org/wiki/Discrete_Fourier_transform
  • 8/10/2019 unit 2 image processing and analysis cp7004

    16/55

  • 8/10/2019 unit 2 image processing and analysis cp7004

    17/55

    (riginal image =ower spectrum #mplitude spectrum

    =hase spectrum $igh8pass !ltering Low8pass !ltering

    For a more detailed analysis of Fourier transform and other examples of -4 imagespectra and !ltering, see introductory materialsprepared "y 4r. meritus, 4epartment of Bomputer &cience, ]niversity of 0ew Cexico,#l"uquerque, 0ew Cexico, ]/.

    Windowing

    Fourier theory assumes that not only the Fourier spectrum is periodic "ut also theinput 4FT data array is a single period of an in!nite image repeating itself in!nitelyin "oth directionsH

    https://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/fourier.htmlhttps://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/fourier.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    18/55

    >quivalently, the image may "e considered on a torus, i.e. wrapped around itself, sothat the left and right sides and the top and "ottom coincide. #ny mismatch alongthese coinciding lines, i.e. any discontinuity in the periodic image, distort the Fourierspectrum. )ut this pro"lem is minimised "y windowingthe images prior to the 4FTin such a way as to gradually reduce the pixel values to 1ero at the edges of theimage. The reduction is performed with a windowing unctiondepending on the

    distance rof each image pixel x,y/ from the centre xc,yc/ of the image, r

    -

    J xOxc/-P yOyc/-, and a given maximum distance rmax. There are several standardwindows such asH

    the cone8shaped -4 *artlett windowH (r)J + O rNrmax/ if r[ rmaxand (r)J7 otherwiseM

    the slightly smoother Hanning windowH (r)J 7.5 O 7.5cos9K+ O rNrmax/: if r[ rmaxand (r)J 7 otherwiseM or

    the similar "ut narrower *lac+man windowH (r)J 7.3- O 7.5cos9K+ OrNrmax/: P 7.7cos9-K+ O rNrmax/: if r[ rmaxand (r)J 7 otherwise.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    19/55

    window spectrumH J 25-.

    Fast Fourier transorm ,FFT-

    Bomputation of a single value of F(u,v)involves a summation over all image pixels,i.e. N-/ operations if the image dimensions are NNrecall the )ig8(h notation

    from B(C=&BI --7/. Thus, the overall complexity of a 4FT calculating the spectrumwith N-values of F(u,v)is N3/. &uch algorithm is impracticalH e.g. more than onehour or +- days for the 4FT of a -5E^-5E or +7-3^+7-3 image, respectively,assuming one microsecond per multiplication of a complex num"er.

    4ue to the separabilityof the 4FT, a +4 4FT can "e performed along each imagerow to form an intermediate NNarray. Then a +4 4FT is performed down eachcolumn of this array in order to produce the desired NNarray of the values ofF(u,v). In such a way the complexity of a -4 4FT is reduced from N3/ to N2/. )utthe cu"ic complexity is still too high to mae the algorithm practica"le.

    Fortunately, there exists a ast Fourier transormFFT/ algorithm that computes a+4 Fourier transform for Npoints in only Nlog N/ operations which maes FFT apractical and important operation on computers. The +4 FFT speeds up calculationsdue to a possi"ility to represent a Fourier transform of length N"eing a power of twoin a recursive form, namely, as the sum of two Fourier transforms of length NN-. Therecursion ends at the point of computing simple transforms of length -. Then theoverall complexity of this +4 FFT is proportional to Nlog-N, i.e. Nlog N/ comparedwith N-/ for a directly calculated +4 4FT. Therefore the complexity of thesepara"le -4 FFT "ecomes N-log N/. For a 5+-^5+- image, a -4 FFT is roughly27,777 times faster than direct 4FT.

    #n example of the +4 FFT programwill highlight the simplicity of this recursivecomputation. The classic -4 FFT requires that "oth image dimensions are powers oftwo. There exist more complex FFT algorithms that allow for less restricteddimensions. (therwise the image can "e either cropped or padded out with 1eropixel values to the appropriate dimensions. The former approach discards data andmay distort the spectrum "ut reduces processing time, while the latter increasestime "ut does not a@ect the spectrum.

    Filtering o images

    Filtering in the spatial domain is performed "y convolution with an appropriateernel. This operation impacts spatial frequencies "ut it is di;cult to quantify thisimpact in the spatial domain. The spectral frequency/ domain is more natural tospecify these e@ectsM also !ltering in the spectral domain is computationally simpler"ecause convolution in the spatial domain is replaced with the point8to8pointmultiplication of the complex image spectrum "y a &lter transer unction.

    Let F, *, and +denote the spectrum of the image f, the !lter transfer function i.e.the spectrum of the convolution ernel h/, and the spectrum of the !ltered image ,respectively. Then the con%olution theoremstates that f-h_ +(u,v) F(u,v)*(u,v)the derivation taes into account that the image is in!nite and periodicwith the period Nin the "oth directionsM the sign 6_6 indicates a Fourier transformpairsuch that each its side is converted into the opposite one "y a Fourier

    https://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/fft-program.htmlhttps://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/fft-program.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    20/55

    The !ltered image can "e computed using the inverse 4FT. ?enerally, !ltering inthe spectral domain impacts "oth the amplitude and phase of the image spectrumF(u,v). In practice, most !lters do not a@ect phases and change only magnitudes,i.e. they are ero/phase/shit &lters.

    Bonvolving an image with a certain ernel has the same e@ect on that image as

    multiplying the spectrum of that image "y the Fourier transform of the ernel.Therefore, linear !ltering can always "e performed either in the spatial or thespectral domains.

    # low pass &lteringsuppresses high frequency components and producessmoothed images. #n ideal sharp cut8o@ !lter simply "locs all frequencies atdistances larger than a !xed !lter radius r7from the centre 7,7/ of the spectrumH

    *(u,v)J + if r(u,v)[ r7and *(u,v)J 7 if r(u,v)Y r7

    where r(u,v)J 9u-P v-:+N-is the distance form the centre of the spectrum. )ut such

    a !lter produces a rippled e@ect around the image edges "ecause the inverse 4FT ofsuch a !lter is a 6sinc function6, sinr/Nr. To avoid ringing, a low pass transferfunction should smoothly fall to 1ero. (ne of most nown !lters of such type is the*utterworth low pass &lterof order nH *(u,v)J +N+ P 9r(u,v)Nr7:-n/ where thevalue r7de!nes the distance at which *(u,v)J 7.5 rather than the cut8o@ radius.When the order increases, the )utterworth !lter approaches the ideal low pass !lter.Cany other transfer functions perform low pass !ltering. #n important example of asmooth and well8"ehaved spectral !lter is a ?aussian transfer function its Fouriertransform results in another ?aussian/.

    # high pass &lteringsuppresses low frequency components and produces imageswith enhanced edges. #n ideal high pass !lter suppresses all frequencies up to thecuto@ one and does not change frequencies "eyond this "orderH

    *(u,v)J 7 if r(u,v)[ r7and *(u,v)J + if r(u,v)Y r7

  • 8/10/2019 unit 2 image processing and analysis cp7004

    21/55

    transfer function of a )utterworth "and stop !lter with radius r7J rlowP rhigh/N- andthe "and width J rhigh& rlowis speci!ed as *sJ + N + P 9r(u,v)Nr-(u,v)O r7-/:-n/where r(u,v)J 9u-P v-:+N-. The corresponding "and pass !lter is *pJ + O *s. >venmore versatile !ltering is produced "y selective editing of speci!c frequencies, inparticular, the removal of periodic sinusoidal noise "y suppressing narrow spies inthe spectrum.

    on%olution and decon%olution

    #dditive random noise caused "y an imaging device is not the only source of imagedegradation. For example, image "lurring might "e induced "y the poor lensfocusing, o"*ect movements, and N or atmospheric tur"ulence. # conventional modelof the degraded image assumes that a perfect image fis "lurred "y !ltering with acertain convolution ernel hand further corrupted "y the addition of noise H

    The convolution ernel h, which models the "lurring caused "y all degradationsources in the scene and imaging device, is called the point spread unction=&F/. ?enerally, "oth hand may vary spatially, "ut usually the model is simpli!ed"y assuming that the degradation his spatially invariant. The =&F speci!es how apoint source is impacted "y the imaging process. The perfect process forms for apoint source an image with a single "right point and other 1ero8valued pixels, whilethe real process produces an area of non81ero pixels such that a grey level pro!leacross this area follows the =&F. To deconvolve an image, its =&F has to "e nown orestimated from measurements of the image.

    The way to inverting the convolution is clearer in the spectral domainH in accord withthe convolution theorem, the spectra of the perfect and degraded images, noisespectrum 0, and 4FT of the =&F, called the modulation transer unctionCTF/relate as followsH

    #ssuming the noise is negligi"le, the simplest deconvolution to restore an initialperfect/ image from the degraded one is "ased on in%erse &lteringH

    where +N*(u,v)is the in%erse &lterto remove the degradation. )ut in practice thisapproach encounters numerous pro"lems, !rst, with 1eros of the CTF that result inindeterminate or in!nite ratios/, and secondly, with noisy data when the term0(u,v)N*(u,v)may "ecome large and dominate F(u,v)which should "e recovered.>mpirical solutions to these pro"lems set a threshold on *(u,v)"elow which thecorresponding values of F(u,v)are set to 1ero and limit inverse !ltering to a certaindistance from the origin of the spectrum. In some cases these heuristics aresu;cient to clearly improve the output restored/ image over the input degraded/one.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    22/55

    # more theoretically *usti!ed solution is the Wiener &lteringthat minimises theexpected squared error "etween the restored and perfect images. # simpli!edWiener &lteris as followsH

    where 1is a constant value directly proportional to the variance of the noise presentin the image and inversely proportional to the variance of the image with respect tothe average grey value. If 1J 7 no noise/, the Wiener !lter reduces to a simpleinverse !lter. If 1is large compared with V*(u,v)V, then the large value of the inverse!ltering term +N*(u,v)is "alanced out with the small value of the second term insidethe "racets.

    Image smoothing and &harpening

    &C((T$I0?N#>R#?I0? FILT>R&

    To smooth an image might do a S0x0 pixel moving window averageS of image 8 e.g.

    with the 2x2 `lter "elow. =lace centre pixel of window over given pixel, multiply

    pixels of image with pixels in window, sum results and copy as value of output

    pixel. Then shift window one place to right or down and repeat.

    +ND +ND +ND

    & J +ND +ND +ND

    +ND +ND +ND

    or could "e a -4 gaussian function within a 2x2 or 5x5 etc etc window.

    such a moving average is similar to a convolution of the image with the `lter,

    except that the `lter is 0(T `rst rotated +7 degrees. The operation is nown as

    ScorrelationS and denoted "y . 0ote for a rotationally symmetric `lter correlation

    and convolution are the same.

    Why% +/ To reduce random noise. -/ To Stouch upS im8ages, remove wrinles etc. 2/

    )efore su"sampling images, so remain 0yquist sampled. 3/ To SconnectS parts of

    o"*ects "e8

    &C((T$I0?N#>R#?I0? FILT>R&

    Local $istogram >qualisation Lie histogram equali8sation "ut use some region

    a"out pixel not whole image to compute transfer function for each pixel. )etter

    than glo"al equalisation if image contains "ig variations in "rightness.

    Image &moothing (ften done to reduce the ebect of pixel noise in images. )ox

  • 8/10/2019 unit 2 image processing and analysis cp7004

    23/55

    $igh =ass Filtering To &harpen up images.

    >dge 4etection detect edges and add "ac to original image to maes edgesclearer eye does this itself 8see later lecture/.

    Last three operations can implemented via convolutionNcorrelation operations.

    fore analysing an image into separate o"*ects, i.e. counting galaxies example in"oo.

    0oise Reduction If there is large pixel8to8pixel noise which is independant at

    each pixel can reduce it "y correlating with a uniform smoothing `lter. For

    instance the 2x2 `lter with value +ND at each element will increase signal to

    noise "y factor 2.

    =racticalities 8 use matla" command fspecial to create `lter functions, then `lter- to

    do `ltering. what happens at edges of image% arious `lter- options.

    SfullS #s long as at least one pixel of the `lter overlaps the image create an output.

    =ixels SoutsideS of image considered to have value 7. If a CxC `lter is correlated

    with an 0x0 image the output image has si1e 0PC8+/ x 0PC8+/.

    SsameS Breate an ouput as long as central pixel of the `lter function lines within theinput image, output is same si1e as input. 4efault option.

    SvalidS #ll pixels within the `lter must "e inside the image. (utput si1e of imag is 08

    CP+/ x 08C8+/.

    for images on a "lac "acground e.g astronomy images/ get no edge ebect in

    output imge. For other images though the `rst - options give dar "order in the

    output image.

    If there is only smooth structure in true image is correct thing to do 8 reduce noise

    without abecting underlying image.

    In general case, if image has `ne details then we SwinS some8thing "y reducing

    noise "ut we SloseS "y removing `ne de8tails. What is optimum si1e and form of

    `lter% Ban have adaptive `lters see nect lecture/ or Wiener `lter command in

    C#TL#)/8 #mount of smoothing changes "ased on the contents of the `lter 8 `nd

    "est compromise "etween smooth8ing too little gives high noise/ or too much

    lose detail/.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    24/55

    &$#R=>0I0? FILT>R&

    ("viously useful to "ring out `ne details of an image. Want to estimate

    details on top of a smooth "acground. Find a way to estimate "acground

    and then remove from original. )acground can "e estimated "y smoothing

    an image, if we remove this image from original get a sharpened image.

    Was implemented "efore computers using photographic tech8niques. Unown

    as unsharp masing. Tae in focus and out of focus images, mae negative

    of second image and overlay ontop of `rst and re8photograph.

    Cathematically the process of su"racting a "lurred version of original can"e written as

    I7mM n/ J ImM n/ ImM n/ &

    I7mM n/ J ImM n/ &/

    where the is a `lter which is + in the centre and 1ero else8where and the

    smoothing or "lurring matrix & is given "y

    +ND+ND

    +ND

    & J +ND

    +N

    D

    +N

    D

    +ND+ND

    +ND

    Which is equivalent to I 7mM n/ J ImM n/ &7, where &7is

    8+ND 8+ND 8+ND

    &S J 8+ND ND 8+ND

    8+ND 8+ND 8+ND

    $I?$ =#&&N$I?$ )((&T FILT>RI0?

    The a"ove `ltering option except for a constant is the same as correlatingwith the 2x2 `lter function $ "elow directly. (ther `lters that enhance `nddetail and sharpen images include the Laplacian L/ `lter "elow.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    25/55

    8+ 8+ 8+ 7 8+ 7$ J

    8+ 8+LJ 8+ 3

    8+

    8+ 8+ 8+ 7 8+ 7

    =ure highpass often overdoes it, too much high frequency information, canStrecognise image. )etter to add original image to the high frequency `ltered

    image.

    I7mM n/ J aImM n/ L P ImM n/

    where SaS is a constant, then since I J I where is de`ned as

    7 7 7

    7 + 7

    7 7 7

    Is equivalent to I 7J I aL / or I7J I L7where

    7 8a 7

    LS J 8a +P3a 8a

    7 8a 7

    &elective !lters

    Low/pass H to extract short8term average or to eliminate high8frequencyZuctuationseg. noise !ltering, demodulation, etc./High/pass H to follow small8amplitude high8frequency pertur"ations inpresenceof much larger slowly8varying component e.g. recording theelectrocardiogramin the presence of a strong "reathing signal/*and/pass H to select a required modulated carrier frequency out of manye.g.radio/*and/stop H to eliminate single8frequency e.g. mains/ interference alsonownas notch !ltering/

  • 8/10/2019 unit 2 image processing and analysis cp7004

    26/55

    Low 'ass Filters

    Low pass !ltering, otherwise nown as 6smoothing6, is employed to removehigh spatial frequencynoise from a digital image. 0oise is often introducedduring the analog8to8digital conversion process as a side8e@ect of the

    physical conversion of patterns of light energy into electrical patterns9Tanimoto:.

    There are several common approaches to removing this noiseH

    If several copies of an image have "een o"tained from the source,some static image, then it may "e possi"le to sum the values for eachpixel from each image and compute an average. This is not possi"le,however, if the image is from a moving source or there are other timeor si1e restrictions.

    If such averaging is not possi"le, or if it is insu;cient, some form of

    low pass spatial &lteringmay "e required. There are two maintypesH

    o reconstruction &ltering, where an image is restored "ased onsome nowledge of the type of degradation it has undergone.Filters that do this are often called 6optimal !lters6.

    o enhancement &ltering, which attempts to improve thesu"*ectively measured/ quality of an image for human ormachine interpreta"ility. >nhancement !lters are generallyheuristic and pro"lem oriented 90i"lac:M they are the type thatare discussed in this tutorial.

    #o%ing Window !perations

    &elect digital convolutionfor a more detailed derivation of this section./

    The form that low8pass !lters usually tae is as some sort of mo%ingwindow operator. The operator usually a@ects one pixel of the image at atime, changing its value "y some function of a 6local6 region of pixels6covered6 "y the window/. The operator 6moves6 over the image to a@ect allthe pixels in the image. &ome common types areH

    0eighborhood/a%eraging &ltersThese replace the value of eachpixel, a2i,j3say, "y a weighted8average of the pixels in someneigh"orhood around it, i.e. a weighted sum of a2i$p,j$43, withp 5%to %, 4 5% to %for some positive %M the weights are non8negative withthe highest weight on thep 4 6term. If all the weights are equalthen this is a mean!lter. 6linear6

    http://www.cs.washington.edu/research/metip/tutor/tutor.glossary.html#Spatial%20Frequencyhttp://www.cs.washington.edu/research/metip/tutor/tutor.refs.htmlhttp://www.cs.washington.edu/research/metip/tutor/tutor.refs.htmlhttp://www.cs.washington.edu/research/metip/tutor/tutor.digconv.htmlhttp://www.cs.washington.edu/research/metip/tutor/tutor.glossary.html#Spatial%20Frequencyhttp://www.cs.washington.edu/research/metip/tutor/tutor.refs.htmlhttp://www.cs.washington.edu/research/metip/tutor/tutor.refs.htmlhttp://www.cs.washington.edu/research/metip/tutor/tutor.digconv.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    27/55

    #edian &ltersThis replaces each pixel value "y the median of itsneigh"ors, i.e. the value such that 57 of the values in theneigh"orhood are a"ove, and 57 are "elow. This can "e di;cult andcostly to implement due to the need for sorting of the values. $owever,this method is generally very good at preserving edges.

    #ode &lters>ach pixel value is replaced "y its most commonneigh"or. This is a particularly useful !lter for classi7cationprocedureswhere each pixel corresponds to an o"*ect which must "e placed into aclassM in remote sensing, for example, each class could "e some typeof terrain, crop type, water, etc..

    The a"ove !lters are all space in%ariantin that the same operation isapplied to each pixel location. # non8space invariant !ltering, using thea"ove !lters, can "e o"tained "y changing the type of !lter or the weightingsused for the pixels for di@erent parts of the image. 0on/linear!lters also

    exist which are not space invariantM these attempt to locate edges in thenoisy image "efore applying smoothing, a di;cult tas at "est, in order toreduce the "lurring of edges due to smoothing. These !lters are notdiscussed in this tutorial.

    Frequency 1nalysis 2sing the Wa%elet 'ac+et Transorm

    "ntroduction

    The wavelet transform is commonly used in the time domain. For example,

    wavelet noise !lters are constructed "y calculating the wavelet transform fora signal and then applying an algorithm that determines which waveletcoe;cients should "e modi!ed usually "y "eing set to 1ero/. Waveletcoe;cients are the result of the high pass !lter applied to the signal or tocom"inations of low pass !lters of the signal./ #lthough these coe;cients areassociated with frequency components, they are modi!ed in the time domaineach coe;cient, ci, corresponds to a time range/.

    In contrast to the wavelet transform, the Fourier transform taes a signal inthe time domain e.g., a signal sampled at some frequency/ and transformsit into the frequency domain, where the Fourier transform result represents

    the frequency components of the signal. (nce the signal is transformed intothe frequency domain, we lose all information a"out time, only frequencyremains.

    What would "e nice is a a signal analysis tool that has the frequencyresolution power of the Fourier transform and the time resolution power ofthe wavelet transform. To some extent the wavelet pacet transform gives usthis tool. I write 6to some extent6 "ecause as this we" pages shows, the

  • 8/10/2019 unit 2 image processing and analysis cp7004

    28/55

    wavelet pacet transform does not produce as exact a result as the Fouriertransform and the wavelet pacet result is more di;cult to interpret. Thewavelet pacet transform can "e applied to time varying signals, where thesimple Fourier transform does not produce a useful result.

    1c+nowledgment

    Wavelets and digital signal processing are topics that are too complex tocover easily in a set of we" pages, or even in a single "oo as my growingli"rary of wavelet and 4&= references attests/. The contri"ution that I seethese we" pages maing is the pu"lication of BPP and

  • 8/10/2019 unit 2 image processing and analysis cp7004

    29/55

    transform to the high and low pass result at each level, generating two new!lter results which have half the num"er of elements. The standardtransform is shown in !gure +. The result of the wavelet high pass/ !lter isshaded.

    Figure +

    If we thin of the lower and upper halves of the array that results from thewavelet transform as two children in the wavelet pacet tree, a frequencyordered wavelet pacet result can "e calculated inverting the location of the!lter results in the left hand child. This is shown in Figure -. In this diagramthe low pass !lter is shown as Hand the high pass !lter is shown as 3. Thehigh pass !lter results are shaded as well.

    The !rst wavelet trasform produces the result

    left child J $+J -+, -D, 2-.5, 2E, -+, +2.5, -2.5, 2+ right child J ?+J ++, 8D, 3.5, -, 82, 3.5, 87.5, 82

    The standard wavelet transform is applied to the left child e.g., the result ofthe low pass !lter His placed in the lower half o the result array and theresult of the high pass !lter 3is placed in the upper half of the array.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    30/55

    # modi!ed wavelet transform is applied to the right child. $ere the result ofthe high pass !lter 3is placed in the lower half of the array and the result ofthe low pass !lter His placed in the upper half of the array.

    >ach recursive step generates two more children, where the standard

    transform is applied to the left child and the modi!ed transform is applied tothe left child.

    Figure -

    The "est timeNfrequency resolution is o"tained "y taing a level "asisthrough the tree which results in a square matrix. For the wavelet pacet treethis in Figure - this is a matrix composed from the four element element

    arrays that result from the second application of the wavelet transform. Thetree is waled from left to right. If the maximum frequency is f, the !rst arraywill contain the frequency range 7 .. fN3/8+, the second array will containfrequencies fN3 .. fN-/8+, the third array will contain frequencies fN- .. 2N3f/8+ and the four array will contain 2N3f.. f. (n the time axis there arefour time steps.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    31/55

    #s Figure 2 shows, these arrays are staced to form a matrix, where the x8axis is time and the y8axis is frequency. This is shown "elow in Figure 2.

    Figure 2

    Why Does Frequency !rdering Wor+4

    #s the timeNfrequency plots on this we" page demonstrate, the modi!edversion of the wavelet pacet transform does indeed produce a frequencyorders result. The fact that this is the case is not immediately o"vious.

    Let us assume that the wavelet transform is a perfect !lter and that we havea signal that ranges from 7..E3$1/. The low pass scaling function $/ resultsin exactly the lower half of the frequency spectrum 7..2-$1 and the highpass wavelet function results in exactly the upper half of the spectrum2-..E3$1. #fter the !rst transform step, the low pass result is on the left"ranch of the tree and the high pass result is on the right "ranch. The usual!lter pair H, 3/ is applied to the right "ranch and the inverse !lter pair 3,H/ is applied to the right "ranch. #s the modi!ed wavelet pacet tree isrecursively "uilt this way, it is not o"vious that the result is frequencyordered.

    )oth ipples in Mathematicsand :avelet Metho"s for ;ime 'eries Analysissee the references at the end of the page/ spend several pages explaininghow frequency ordering wors in the wavelet pacet transform. &o far I havenot found a shorter way to explain this. Cy intent in writing these we" pagesis not to replace references lie ipples in Mathematics"ut to expand on thematerial covered in these references. &o ISm going to 6punt6 on this issue andrefer the reader to Bhapter D of ipples in Mathematicsand Bhapter E of

  • 8/10/2019 unit 2 image processing and analysis cp7004

    32/55

    :avelet Metho"s for ;ime 'eries Analysisfor those who are moremathematically 6hard core6, as the Carines would say if they weremathematicians/. For the purposes of this we" page ISll as the reader to6stipulate6 as the lawyers suing >nron would say/ that the result of themodi!ed wavelet pacet transform shown in Figure - is frequency ordered.

    The Square Le%el *asis #atri( 5iewed as a 'lane

    # square matrix constructed from a level "asis can "e used to "uild a threedimensional plot, where the 18axis is a function of the value at m9y:9x:. Canyauthors use a grey scale plot to represent the 18axis values e.g., an x8y plotwhere the 18dimension is the shade of grey. Cath and statistics environmentslie Catla" and &P support grey scale plots. #lthough I have access to thesepacages at wor, this material is developed with my own computerresources, so I have used 284 surface plots rendered with gnu=lot.

    Wa%elet Time6Frequency 1nalysis o a Simple Sine Wa%e

    The power of the wavelet transform is that it allows signal variation throughtime to "e examined. Frequently the !rst example used for wavelet pacettimeNfrequency analysis is the so called linear chirp, which exponentiallyincreases in frequency over time. Rather than *umping into the linear chirp,let us !rst loo at a simple sine function. Figure 3 shows the functionsin3#ix/, in the range 7..#i, sampled at +7-3 evenly spaced points.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    33/55

    Figure 3

    # magnitude plot of the result of a Fourier transform of the sampled signal isshown in Figure 5 here only the relevant part of the plot is shown/. This

    shows a signal of a"out 5+ cycles, which is what I get when I count the cycles"y hand. The data for this discrete Fourier transform 4FT/ plot wascalculated using

  • 8/10/2019 unit 2 image processing and analysis cp7004

    34/55

    Figure 5

    The Fourier transform plots on this we" page do not show ad*ustedmagnitude where ad*Cag J -MaN0/, so the magnitudes do not properly

    represent the signal magnitude.

    Figure Ea shows a frequencyNtime plot using wavelet pacet frequencyanalysis. #s with the examples a"ove, this plot samples the signal sin3#ix/in the range 7..#i at +7-3 equally spaced points. # square 2-x2- matrixis constructed from 2- elements arrays from the !fth level of the modi!edwavelet pacet transform tree where we count from 1ero, starting at the toplevel of the tree, which is the original signal/. Frequency is plotted on the x8axis and time on the y8axis. The 18axis plots the founction log+Ps9i:-/. #gradient map is also shown on the x8y plane.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    35/55

    Figure Ea/

    Why are there peas in this plot% The peas are formed "y the !ltered signalat the resolution of the level "asis. &ince the 18axis plots log+Ps9i:-/, the

    part of the sine wave that would "e "elow the plane is Zipped up a"ove theplane.

    The wavelet frequencyNtime plot in Ea/ is not as easy to interpret as theFourier transform magnitude plot. The signal region is shown in Figure E"/,scaled to show the signal region in more detail.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    36/55

    Figure E"/

    The wavelet signal is spread out through a range of a"out 7 cycles,centered at slightly over +77. The Fourier transform of sin3x/ shows that

    there are 5+ cycles in the sample. Is the wavelet pacet transform reportinga value that is dou"le the value reported "y the Fourier transformm% I donStnow the answer. The wavelet pacet transform has "een developed in thelast decade. Where "oos lie Richard LyonsS

  • 8/10/2019 unit 2 image processing and analysis cp7004

    37/55

    Figure G

    When these two signals are added together we get the signal show "elow inFigure shown in detail/

  • 8/10/2019 unit 2 image processing and analysis cp7004

    38/55

    Figure

    The same signal, plotted through a range of 7..2-#i and sampled at +7-3equally spaced points is shown "elow.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    39/55

    Figure D

    The Fourier transform result in Figure +7 shows that this signal is composedthe 5+ cycle sin3#i(/ signal and another signal of a"out -77 cycles

    sin+E#i(//. This is a case where the Fourier transform really shines as asignal analysis tool. The two signal components are widely spaced, allowingclear resolution.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    40/55

    Figure +7

    The wavelet pacet transform plotted in Figure ++ shows two signalcomponents, the sin3#i(/ component we saw in Figures Ea/ and E"/ and

    the higher frequency component from sin+E#i(/. #gain, the wavelet pacettransform result is not entirely clear. #s the Fourier transform result shows,the higher frequency signal component is a"out four times the frequency ofthe lower frequency component. This is not quite the case with the waveletpacet transform, where the second frequency component appears to "eslightly less than four times the frequency of the sin3#i(/ component. Thesurface plot also shows two echo artifacts at higher frequencies.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    41/55

    Figure ++

    Wa%elet Time6Frequency 1nalysis o Time 5arying Signals

    For stationary signals that repeat through in!nity, where the signalcomponents are su;ciently separated, the Fourier transform can clearlyseparate the signal components. $owever, the Fourier transform result isonly in the frequency domain. The time component ceases to exist. #lso, the"asic Fourier tranform does not provide very useful answers for signals thatvary through time. Figure +- shows a plot of a sine wave where thefrequency increases "y #iN- in each of eight steps.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    42/55

    Figure +-

    Figure +2 a/ shows a surface plot of the modi!ed wavelet pacet transformapplied to this signal using the $aar wavelet/. The surface ridge shows the

    increasing frequency, although the steps cannot "e clearly isolated, perhaps"ecause the frequency di@erence "etween the steps is not su;ciently large.The ridges a"ove 5+- on the frequency spectrum are artifacts.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    43/55

    Figure +2 a/

    Figure +2 "/ shows a gradient plot, using the same data as Figure +2 a/. #swith the surface plot representation, we can see the frequency increase, "ut

    the step wise nature of this increase cannot "e seen.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    44/55

    Figure +2 "/

    The modi!ed wavelet pacet transform is frequently demonstrated using a6linear chirp6 signal. This is a signal with an exponentially increasing

    frequency, calculated from the equationH

    Figure +3 shows a plot of the linear chirp signal in the region 7..-, sampledat +7-3 points. #s the linear chirp frequency increases, the signal "ecomesundersampled, which accounts for the *agged arrowhead shape of the signalaround 7 asxigets closer to -.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    45/55

    Figure +3

    Figure +5 shows the result of the modi!ed wavelet pacet transform, usingthe $aar wavelet, applied to the linear chirp. The peas exist "ecause the

    signal is sampled at a particular resolution and the a"solute value of thesignal is plotted. 0ote that as the frequency increases the peas seem todisappear as the signal cycles get close together.

    The ridge along the diagonal shows that the signal frequency increasesthrough time. In theory the linear chirp frequency increases exponentially,not linearly as this plot suggests. $owever, the signal is sampled at a !nitenum"er of points, so the exponential nature of the signal disappears as thesignal "ecomes under sampled. The ridges that are perpendicular to themain diagonal line are artifacts.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    46/55

    Figure +5

    In theory the 4au"echies 43 wavelet transform e.g., four scaling H/ andfour wavelet coe;cients 3// is closer that the $aar wavelet transform to a

    perfect !lter that exactly divides the frequency spectrum. The closer the H,3/ !lters are to an ideal !lter, the fewer the artifacts in the wavelet pacettransform result. The result of applying the modi!ed wavelet pacettransform, using 4au"echies 43 !lters, to the linear chirp is shown in !gure+E.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    47/55

    Figure +E

    The result in Figure +E is certainly not "etter than that o"tained using the$aar transform and, in fact, may "e worse. In ipples in Mathematics, the

    authors give an example of wavelet pacet transform results using4au"echies 4+- !lters. There are nota"le fewer artifacts in this case.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    48/55

    Figure +G

    The plot in Figure + is generated from an x+- matrix. )y further reducingthe time regions, all the frequency "ands "ecome compressed into a smaller

    time region. Cultiple frequency "ands "ecome associated with a given timeregion.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    49/55

    Figure +

    Loo+ing *ac+ward

    The modi!ed wavelet pacet transform gives us a tool that can "e used toanaly1e time varying signals. #lthough this tool can "e used in cases wherethe simple Fourier transform does not provide good results either "ecause atimeNfrequency answer is needed or "ecause the signal varies through time/,the wavelet pacet transform is more di;cult to use and understand. (n thiswe" page, the wavelet pacet transform has "een examined using only twowaveletsH $aar and 4au"echies 43. (ther wavelets can produce "etteranswers. #ll the examples here use a 6level "asis6. # non8level "ases can "echosen using a cost function &hannon entropy, as discussed on this relatedwe" page/. # non8level "asis is even more di;cult to interpret not tomention plot/ since it is composed of several timeNfrequency regions from

    the wavelet pacet tree.

    In short, this we" page is hardly the last word on using the wavelet pacettransform for timeNfrequency analysis. #t most this we" page provides someexamples drawn from a complex topic. I suspect that if I understood wavelet!lter "an theory "etter some of the issues of timeNfrequency locali1ationwould "ecome clearer.

    http://www.bearcave.com/misl/misl_tech/wavelets/packet/index.htmlhttp://www.bearcave.com/misl/misl_tech/wavelets/packet/index.htmlhttp://www.bearcave.com/misl/misl_tech/wavelets/packet/index.htmlhttp://www.bearcave.com/misl/misl_tech/wavelets/packet/index.html
  • 8/10/2019 unit 2 image processing and analysis cp7004

    50/55

    he H117 8(pansion 7e%isited

    Let us split our original set of 0 input samples into

    successive "locs of two, that is, and apply the

    $aar transform of order . For each pair of input samples, a pair oftransformed samples is o"tained,

    3.G

    3.G

    This can "e interpreted as the action on the sequence of 0 input samples of

    two noncausal/ !lters with impulse responses andrespectively. The corresponding transfer functions are

    and

    Figure 9.:,a- ;Subsamplingoperation

  • 8/10/2019 unit 2 image processing and analysis cp7004

    51/55

    Figure 9.:,b-; Filtering interpretation o Haar transormation

    In other words, the order . $aar transform computes the output samplesof the two !lters when they are fed with the input sequence

    . Furthermore, the output sequence samples arecomputed for every other sample of the input sequence, at even time

    instants as 3.G.+/and 3.G.-/ suggest. This operation is portrayed in

    Figure 3.G"/. The operation at the output of the two !lters is nown assu"sampling "y C, in this case and it is de!ned in Figure 3.Ga/. In

    other words, from the samples generated at !lter output we eep one very

    .. In the time domain and for an input sequence consisting of eight

    samples, the output, of the "ranch of Figure / will consist of foursamples given "y,

    Figure,9.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    52/55

  • 8/10/2019 unit 2 image processing and analysis cp7004

    53/55

    Figure ,9.>?-; Tree/Structure Filter ban+

    This is nothing "ut the action of the third and fourth rows of the x $aartansform on the input vector. If we now carry on the splitting one stepfurther, as in Figure 3.+7/, it is straightforward to show "y repeating thepreceding arguments that

    Figure,9.>>- #agnitude response o the Haar &lters H?and H>

    These equations are the actions of the second and !rst rows of the $aartansform on the input vector. The structure of Figure 3.+7/ is nown as a

  • 8/10/2019 unit 2 image processing and analysis cp7004

    54/55

    three8level/ tree8structured !lter "an generated "y the !lters and

    . Figure 3.++/ shows the frequency responses of these two !lters. (ne

    is a high8pass !lter and the other a low8pass !lter. $ere in lies theimportance of the !lter "and interpretation of the $aar transform. The input

    sequence is !rst split into two versions of lower resolution with respect tothe original oneH a low8pass average/ coarser resolution version and a high8pass di@erence/ detailed resolution one. In the sequel the coarser resolutionversion is further split into two versions, and so on. This leads to a num"er ofversions with a hierarchy of resolutions. This decomposition is nown asmultiresolution decomposition .

    Cultiresolution expansion

    Laplacian pyramids

    &ome applications of Laplacian pyramids4iscrete Wavelet Transform 4WT/Wavelet theory

    Wavelet image compression

    Wavlet "ased image processing

    =reprocessing H modi!es "oth the sensed input/ and reference "ase/ image

    in order to improve the performance of the feature selection and featurecorrespondence of image registration "ecause some images may "e "lurry orhave signi!cant amount of noise which will dramatically a@ect the outcomeof the algorithm.

    &ome techniquesalleviating the noise Image &moothing/ are median !lters, mean !lters,gaussian !lters, etc.

    -. Feature >xtraction H selects the ey features such as corners, lines, edges,

    contours, templates, regions, etc. which will "e used to do featurecorrespondence.

    2. Feature Borrespondence H matches the ey features selected in thereference image and the sensed image to see which points in the referenceimage matches with the points in the sensed image.3. Bross correlation, mutual information, template matching, Bhamfer, etc.are a few examples of feature correspondence.

  • 8/10/2019 unit 2 image processing and analysis cp7004

    55/55

    3. Transformation Functionaligns the sensed image to the reference image "y the mapping function.

    # few example of transformation functions are a;ne, pro*ective, piecewise

    linear, thin8plate spline, etc.

    5. Resamplingtaes the coordinate points location of the discrete points and transformsthem into a new coordinate system "ecause the sensed image is anuniformly spaced sample of a continuous image.

    &ome examples arenearest neigh"or, "ilinear, cu"ic spline, etc.