1 / 62

With Applications in Image Processing

With Applications in Image Processing. The Story of Wavelets. Polikar, (C) 2007. Guest Lecture Dr. Robi Polikar. Outline . Review of Fourier based methods Analyzing non-stationary signals Short-time Fourier transform Continuous wavelet transform Discrete wavelet transform Applications

ghada
Télécharger la présentation

With Applications in Image Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. With Applications in Image Processing The Story of Wavelets Polikar, (C) 2007 Guest Lecture Dr. Robi Polikar

  2. Outline • Review of Fourier based methods • Analyzing non-stationary signals • Short-time Fourier transform • Continuous wavelet transform • Discrete wavelet transform • Applications • Discontinuity detection • Signal denoising • Compression • 2-D wavelet transform • Image analysis and compression Polikar, (C) 2007

  3. What is a Transformand Why Do we Need One ? • Transform: A mathematical operation that takes a function or sequence and maps it into another one • Transforms are good things because… • The transform of a function may give additional /hidden information about the original function, which may not be available /obvious otherwise • The transform of an equation may be easier to solve than the original equation (recall Laplace transforms for “Defeques”) • The transform of a function/sequence may require less storage, hence provide data compression / reduction • An operation may be easier to apply on the transformed function, rather than the original function (recall convolution) Polikar, (C) 2007

  4. f F f T T-1 Properties of Transforms • Most useful transforms are: • Linear: we can pull out constants, and apply superposition • One-to-one: different functions have different transforms • Invertible:for each transform T, there is an inverse transform T-1 using which the original function f can be recovered (kind of – sort of the undo button…) • Continuous transform: map functions to functions • Discrete transform: map sequences to sequences • Semi-discrete transform: relate functions with sequences Polikar, (C) 2007

  5. What Does a Transform Look Like…? • Complex function representation through simple building blocks • Compressed representation through using only a few blocks (called basis functions / kernels) • Sinusoids as building blocks: Fourier transform • Frequency domain representation of the function Polikar, (C) 2007

  6. What Transforms Are Available? • Fourier series • Continuous Fourier transform • Discrete Fourier transform • Laplace transform • Z-transform Polikar, (C) 2007

  7. How Does FT Work Anyway? • Recall that FT uses complex exponentials (sinusoids) as building blocks. • For each frequency of complex exponential, the sinusoid at that frequency is compared to the signal. • If the signal consists of that frequency, the correlation is high  large FT coefficients. • If the signal does not have any spectral component at a frequency, the correlation at that frequency is low / zero,  small / zero FT coefficient. Polikar, (C) 2007

  8. FT At Work Polikar, (C) 2007

  9. FT At Work F Polikar, (C) 2007 F F

  10. FT At Work Polikar, (C) 2007 F

  11. Stationary and Non-stationary Signals • FT identifies all spectral components present in the signal, however it does not provide any information regarding the temporal (time) localization of these components. Why? • Stationary signals consist of spectral components that do not change in time • all spectral components exist at all times • no need to know any time information • FT works well for stationary signals • However, non-stationary signals consists of time varying spectral components • How do we find out which spectral component appears when? • FT only provides what spectral components exist , not where in time they are located. • Need some other ways to determine time localization of spectral components Polikar, (C) 2007

  12. Stationary and Non-stationary Signals • Stationary signals’ spectral characteristics do not change with time • Non-stationary signals have time varying spectra Polikar, (C) 2007 Concatenation

  13. Non-stationary Signals 50 Hz 20 Hz 5 Hz Polikar, (C) 2007 Perfect knowledge of what frequencies exist, but no information about where these frequencies are located in time

  14. FT Shortcomings • Complex exponentials stretch out to infinity in time • They analyze the signal globally, not locally • Hence, FT can only tell what frequencies exist in the entire signal, but cannot tell, at what time instances these frequencies occur • In order to obtain time localization of the spectral components, the signal need to be analyzed locally • HOW ? Polikar, (C) 2007

  15. Short Time Fourier Transform (STFT) • Choose a window function of finite length • Put the window on top of the signal at t=0 • Truncate the signal using this window • Compute the FT of the truncated signal, save. • Slide the window to the right by a small amount • Go to step 3, until window reaches the end of the signal • For each time location where the window is centered, we obtain a different FT • Hence, each FT provides the spectral information of a separate time-slice of the signal, providing simultaneous time and frequency information Polikar, (C) 2007

  16. STFT Example 300 Hz 200 Hz 100Hz 50Hz Polikar, (C) 2007

  17. STFT Example Polikar, (C) 2007

  18. STFT Example Polikar, (C) 2007 a=0.01

  19. STFT Example Polikar, (C) 2007 a=0.001

  20. STFT Example Polikar, (C) 2007 a=0.0001

  21. STFT Example Polikar, (C) 2007 a=0.00001

  22. Time – Frequency Resolution • Time – frequency resolution problem with STFT • Analysis window dictates both time and frequency resolutions, once and for all • Narrow window  Good time resolution • Narrow band (wide window)  Good frequency resolution • When do we need good time resolution, when do we need good frequency resolution? Polikar, (C) 2007

  23. Heisenberg Principle Polikar, (C) 2007 Frequency resolution: How well two spectral components can be separated from each other in the transform domain Time resolution: How well two spikes in time can be separated from each other in the transform domain Both time and frequency resolutions cannot be arbitrarily high!!! We cannot precisely know at what time instance a frequency component is located. We can only know what interval of frequencies are present in which time intervals

  24. The Wavelet Transform • Overcomes the preset resolution problem of the STFT by using a variable length window • Analysis windows of different lengths are used for different frequencies: • Analysis of high frequencies Use narrower windows for better time resolution • Analysis of low frequencies  Use wider windows for better frequency resolution • This works well, if the signal to be analyzed mainly consists of slowly varying characteristics with occasional short high frequency bursts. • Heisenberg principle still holds!!! • The function used to window the signal is called the wavelet Polikar, (C) 2007

  25. Polikar, (C) 2007 1:44,500,000 1:2,500,000 1:375,500 1:62,500

  26. Continuous Wavelet Transform translation Mother wavelet Polikar, (C) 2007 Normalization factor Scaling: Changes the support of the wavelet based on the scale (frequency) CWT of x(t) at scale a and translation b Note: low scale  high frequency

  27. Why Wavelet? • We require that the wavelet functions, at a minimum, satisfy the following: Polikar, (C) 2007 Wave… …let

  28. Time-Frequency Gridin CWT Scale Polikar, (C) 2007 a=1/4 4Δf Δt/4 Δt/2 a=1/2 2Δf Δt a=1 Δf 2Δt a=2 Δf/2 4Δt Time Δt *Δf ≥ ½

  29. Matlab Demos on CWT Polikar, (C) 2007

  30. Discretization of Time & Scale Parameters • Recall that, if we use orthonormal basis functions as our mother wavelets, then we can reconstruct the original signal by where W(a,b) is the CWT of x(t) • Q: Can we discretize the mother wavelet a,b(t) in such a way that a finite number of such discrete wavelets can still form an orthonormal basis (which in turn allows us to reconstruct the original signal)? If yes, how often do we need to sample the translation and scale parameters to be able to reconstruct the signal? • A: Yes, but it depends on the choice of the wavelet! Polikar, (C) 2007

  31. Dyadic Grid • We do not have to use a uniform sampling rate for the translation parameters, since we do not need as high time sampling rate when the scale is high (low frequency). • Let’s consider the following sampling grid: Polikar, (C) 2007 b where a is sampled on a log scale, and b is sampled at a higher rate when a is small,that is, where a0 and b0 are constants,and j,k are integers. log a

  32. j= j=- j=-2 j=-1 j=0 j=1 j=2 j=4 j=5 An example on MRA Let’s suppose we wish to approximate the function f(t) using a simpler function that has constant values over set intervals of 2j, such that the error ||f(t)-fj(t)|| is minimum for any j. The best approx. would be the average of the function over the interval length. In general, then… f(t) Polikar, (C) 2007 f0(t) f2(t)

  33. An Example (cont.) • As we go from a value of j to a higher value, we obtain a coarser approximation of the function, hence some detail is lost. • Let’s denote the detail lost at each approximation level with a function g(t): Polikar, (C) 2007 Detail function Approximation function That is, the original functioncan be reconstructed simply by adding all the details (!)

  34. Scaling & Wavelet Functions The scaling function Smoothed, scaling-function-dependentapproximation of x(t) at scale j Approximation coefficientsat scale j Polikar, (C) 2007 The wavelet function Wavelet-function-dependentdetail of x(t) at scale j Detail coefficientsat scale j Furthermore: & Wavelet Reconstruction

  35. Putting ItAll Together (cont.) • We can start reconstruction from any level (scale) in between: Polikar, (C) 2007 Detail coefficientsat scale j0and below Approximation coefficientsat some arbitrary scale j0 Wavelet-function-dependentdetails of x(t) at scales j0 and below Smoothed, scaling-function-dependentapproximation of x(t) at the scale j0 The essence of wavelet transform: A signal can be obtained from (or decomposed into) an approximation at a specific level, and sum of details lost up to that level.

  36. x[n] x[n] ~ G 2 2 2 2 2 2 2 2 ~ ~ G H G G + + ~ H H H Decomposition Reconstruction 2 2 Discrete Wavelet TransformImplementation Polikar, (C) 2007 Down-sampling Up-sampling Half band high pass filter Half band low pass filter G H 2-level DWT decomposition. The decomposition can be continues as long as there are enough samples for down-sampling.

  37. |H(jw)| w /2 -/2 |G(jw)| w -/2 /2 -  2 2 2 2 2 DWT - Demystified Length: 512 B: 0 ~  g[n] h[n] Length: 256 B: 0 ~ /2 Hz Length: 256 B: /2 ~  Hz Polikar, (C) 2007 a1 d1: Level 1 DWT Coeff. g[n] h[n] Length: 128 B: 0 ~  /4 Hz Length: 128 B: /4 ~ /2 Hz a2 d2: Level 2 DWT Coeff. g[n] h[n] 2 Length: 64 B: 0 ~ /8 Hz Length: 64 B: /8 ~ /4 Hz …a3…. d3: Level 3 DWT Coeff. Level 3 approximation Coefficients

  38. Matlab ImplementationCommand Line • Single level decomposition and reconstruction • [cA1 cD1]=dwt(x, ‘db4’) single level decomposition • x=idwt(cA1, cD1, ‘db4’):3 single level inverse transform • Direct reconstruction of approximation and detail signals • D1=upcoef(‘d’, cD1, ‘db4’, 1, N): one-level reconstruction of detail signal from detail coefficient • A1=upcoef(‘a’, cA1, ‘db4’, 1, N): one level reconstruction of approximation signal from approximation coefficients • Multi-level decomposition & reconstruction • [C L]=wavedec(x, K, ‘db4’): k-level decomposition • A0=waverec(C, L, ‘db4’):reconstruct the signal • Extracting coefficients • cA3=appcoef(C, L, ‘db4’, 3); • cD5=detcoef(C, L, 5); • Single branch reconstruction • A3=wrcoef(‘a’, C, L, ‘db4’, 3); Reconstruct level 3 approx. signal • D2=wrcoef(‘d’, C, L, ‘db4’, 2); Reconstruct level 2 detail signal Polikar, (C) 2007 L=[lA3 lD3 lD2 lD1 lsignal] C= D3 D1 A3 D2 lA3 lD3 lD2 lD1

  39. Quadrature Mirror Filters • It can be shown that that is, h[] and g[] filters are related to each other: in fact, that is, h[] and g[] are mirrors of each other, with every other coefficient negated. Such filters are called quadrature mirror filters. For example, Daubechies wavelets with 4 vanishing moments….. Polikar, (C) 2007

  40. DB-4 Wavelets ~ h = -0.0106 0.0329 0.0308 -0.1870 -0.0280 0.6309 0.7148 0.2304 g = -0.0106 -0.0329 0.0308 0.1870 -0.0280 -0.6309 0.7148 -0.2304 h = 0.2304 0.7148 0.6309 -0.0280 -0.1870 0.0308 0.0329 -0.0106 g = -0.0106 -0.0329 0.0308 0.1870 -0.0280 -0.6309 0.7148 -0.2304 ~ L: filter length (8, in this case) Polikar, (C) 2007

  41. Implementation of DWT on MATLAB Choose wavelet and number of levels Load signal Hit Analyze button s=a5+d5+…+d1 Polikar, (C) 2007 Approx. coef. at level 5 Level 1 coeff. Highest freq. (Wavedemo_signal1)

  42. Details vs. Approximations Polikar, (C) 2007

  43. Applications Polikar, (C) 2007 Detect discontinuities

  44. Applications Polikar, (C) 2007 Detect hidden discontinuities

  45. Applications Polikar, (C) 2007 Simple denoising

  46. Compression • DWT is commonly used for compression, since most DWT are very small, can be zeroed-out! Polikar, (C) 2007

  47. Compression Polikar, (C) 2007

  48. 1D-DWT2D-DWT • Recall fundamental concepts of 1D-DWT • Provides time-scale (frequency) representation of non-stationary signals • Based on multiresolution approximation (MRA) • Approximate a function at various resolutions using a scaling function, (t) • Keep track of details lost using wavelet functions, (t) • Reconstruct the original signal by adding approximation and detail coeff. • Implemented by using a series of lowpass and highpass filters • Lowpass filters are associated with the scaling function and provide approximation • Highpass filters are associated with the wavelet function and provide detail lost in approximating the signal Polikar, (C) 2007

  49. 2-D DWT • How do we generalize these concepts to 2D? • 2D functions  images f(x,y)  I[m,n] intensity function • What does it mean to take 2D-DWT of an image? How do we interpret? • How can we represent an image as a function? • How do we define low frequency / high frequency in an image? • How to we compute it? • Why would we want to take 2D-DWT of an image anyway? • Compression • Denoising • Feature extraction Polikar, (C) 2007

  50. 2D Scaling/Wavelet Functions • We start by defining a two-dimensional scaling and wavelet functions: • If (t) is orthogonal to its own translates, is also orthogonal to its own translates. Then, if fo(x,y) is the projection of f(x,y) on the space Vogenerated by s(x,y): Polikar, (C) 2007

More Related