052600 VU Signal and Image Processing Torsten Möller + Hrvoje Bogunović + Raphael Sahann torsten.moeller@univie.ac.at hrvoje.bogunovic@meduniwien.ac.at raphael.sahann@univie.ac.at vda.cs.univie.ac.at/teaching/sip/17s/
Wavelets II 052600 VU Signal and Image Processing (SIP) Hrvoje Bogunović / Torsten Möller hrvoje.bogunovic@meduniwien.ac.at
Neither Time nor Fourier representation is ideal Fourier domain tells us "what" (frequencies) but not "where Time domain tells us "where" (location) but not "what We want a signal/image representation that gives a local description of "frequency-spatial-events" i.e. what is happening where. 3
Short-time Fourier Transform in a nutshell 4
Time-Frequency analysis Representation that is a function of both time and frequency time-frequency distribution 5
STFT Example: Two sinusoids Time resolution - Frequency resolution tradeoff Wider window Narrower window Hertz Hertz Hertz seconds seconds seconds 6
Time-Frequency Analysis The area of the cells are bounded below by the minimum time-bandwidth product Heisenberg uncertainty of signal processing 7
STFT: Two views Filter-bank view DFT view 8
Subsampled STFT There is much redundancy in the STFT when the analysis window slides 1 sample at a time We can decimate the output and it will still be possible to reconstruct x[n] exactly Bank of N filters 9
STFT filtering view: Filter bank 10
From STFT To Wavelet Transform Need for Multiresolution analysis Good time resolution and poor frequency resolution at high frequencies Good frequency resolution and poor time resolution at low frequencies 11
The Wavelet Transform 052600 VU Signal and Image Processing (SIP) Hrvoje Bogunović / Torsten Möller hrvoje.bogunovic@meduniwien.ac.at
What Are Wavelets? Wavelets are functions defined over a finite interval and having an average value of zero. In general, a family of representations using: hierarchical (nested) basis functions finite ( compact ) support basis functions often orthogonal fast transforms, often linear-time Haar wavelet 13
Wavelet transform Linear combination of wavelet basis functions Father wavelet or scaling function Characterizes basic wavelet scale Mother wavelet or wavelet function Characterizes basic wavelet shape Each wavelet has a characteristic location and scale 14
Wavelet transform Wavelet transforms are based on small wavelets with limited duration. The translated-version wavelets locate where we concern. Whereas the scaled-version wavelets allow us to analyze the signal at different scales. As we dilate and translate the mother wavelet we can see very low freq. components at large scale while very high frequency components can be located at small scale. A balance between time domain and frequency domain due to Heisenberg uncertainty: we cannot locate both time and frequency 15
Continuous Wavelet Transform (CWT) Fourier Transform + ò - F( w ) = f ( t) e - jwt dt FT is the sum over all the time of signal f(t) multiplied by a complex exponential. 16
Continuous Wavelet Transform (CWT) Similarly, the Continuous Wavelet Transform (CWT) is defined as the sum over all time of the signal multiplied by scale, shifted version of the wavelet function: ( ) Y s, t t * g ( s, t ) = f ( t) Ys ( t) dt ò where * denotes complex conjugation. This equation shows how a function ƒ(t) is decomposed into a set of basis functions (,) called the wavelets.,t Y s, t t The variables s and t are the new dimensions, scale and translation (position), after the wavelet transform. 17
CWT: Forward (analysis) time-series ignore the complex conjugate from now on, assuming that we re using real wavelets coefficient of wavelet with scale, s and time, t complex conjugate of wavelet with scale, s and time, t 18
CWT: Inverse (synthesis) time-series wavelet with scale, s and time, t coefficients of wavelets build up a time-series as sum of wavelets of different scales, s, and positions, t 19
CWT: Wavelet normalization shift in time wavelet with scale, s and time, t change in scale: big s means long wavelength Mother wavelet 20
CWT The wavelets are generated from a single basic wavelet Y(t), the so-called mother wavelet, by scaling and translation: Y s, t ( t) = 1 æ t -t ö y ç s è s ø s is the scale factor, t is the translation factor and the factor s -1/2 is for energy normalization across the different scales. It is important to note that in the above transforms the wavelet basis functions are not specified. This is a difference between the wavelet transform and the Fourier transform, or other transforms. 21
Shannon Wavelet Y(t) = 2 sinc(2t) sinc(t) mother wavelet t=5, s=2 time 22
CWT vs FT Fourier Analysis is based on an indefinitely long cosine wave of a specific frequency time, t Wavelet Analysis is based on an short duration wavelet of a specific center frequency. Offers localized time-frequency analysis time, t 23
Notion of Scale Scale is inverse of frequency 24
Scaling 25
Scaling Scaling a wavelet simply means stretching (or compressing) it. 26
Notion of Scale. Scale and Frequency S > 1 dilates the signal S < 1 compresses the signal Low frequency => high scale Global view of the signal High frequency => low scale Detailed view of the signal Low scale a Compressed wavelet Rapidly changing details High frequency w High scale a stretched wavelet slowly changing details low frequency w 27
Shifting Shifting means delaying/hastening its onset 28
Shifting 29
CWT in five steps 1. Take a wavelet and compare it to a section at the start of the original signal 2. Calculate a correlation coefficient c. 30
CWT in five steps 3. Shift the wavelet to the right and repeat steps 1 and 2 until you have covered the whole signal. 4. Scale (stretch) the wavelet and repeat steps 1 through 3. 5. Repeat steps 1 through 4 for all scales. 31
CWT: Coefficients plot 32
Wavelets: Time-Frequency analysis Localized time-frequency analysis 33
Wavelets: Common types 34
Discrete Wavelet Transform (DWT) Subset of scale and position based on power of two As opposed to every possible set of scale and position in CWT Provides sufficient information both for analysis and synthesis Reduce the computation time sufficiently Easier to implement Analyze the signal at different frequency bands with different resolutions Decompose the signal into a coarse approximation and detail information 35
DWT Discrete wavelet is written as y j, k ( t) 1 æ t - kt 0s y ç è s0 = j j s0 j 0 ö ø j and k are integers and s0 > 1 is a fixed dilation step. The translation factor t 0 depends on the dilation step. The effect of discretizing the wavelet is that the time-scale space is now sampled at discrete intervals. We usually choose s 0 = 2 ò * y j, k ( t) y m, n ( t) dt ì1 = í î 0 If j=m and k=n others 36
Band pass filter The wavelet has a band-pass like spectrum From Fourier theory we know that compression in time is equivalent to stretching the spectrum and shifting it upwards: Suppose a=2 F 1 a w ç è a æ ö { f ( at) } = F ø This means that a time compression of the wavelet by a factor of 2 will stretch the frequency spectrum of the wavelet by a factor of 2 and also shift all frequency components up by a factor of 2. 37
Band pass filter Fourier spectrum of Shannon Wavelet frequency, w w Spectrum of higher scale wavelets 38
Dyadic grid (log 2 ) Natural choice for human ear and music 39
Dyadic grids The factor of two scaling means that the spectra of the wavelets divide up the frequency scale into octaves (frequency doubling intervals) w 1 / 8 w ny ¼w ny ½w ny w ny 40
DWT As we showed previously, the coefficients of Y 1 is just the band-passes filtered time-series, where Y 1 is the wavelet, now viewed as a bandpass filter. This suggests a recursion. Replace: w 1 / 8 w ny ¼w ny ½w ny w ny with low-pass filter w ½w ny w ny 41
DWT And then repeat the processes, recursively 42
DWT Splitting the signal spectrum with an iterated filter bank. 8B f LP 4B HP 4B f LP 2B HP 2B 4B f LP HP 2B 4B f B B Summarizing, if we implement the wavelet transform as an iterated filter bank, we do not have to specify the wavelets explicitly! This is a remarkable result. 43
DWT: Approximation and Details The approximations are the high-scale, low-frequency components of the signal. The details are the low-scale, high-frequency components. The filtering process, at its most basic level, looks like this: The original signal, S, passes through two complementary filters and emerges as two signals. 44
DWT: Downsampling Unfortunately, if we actually perform this operation on a real digital signal, we wind up with twice as much data as we started with. Suppose, for instance, that the original signal S consists of 1000 samples of data. Then the approximation and the detail will each have 1000 samples, for a total of 2000. To correct this problem, we introduce the notion of downsampling. This simply means throwing away every second data point. 45
DWT An example: 46
Reconstructing Approximation and Details 47
Subband coding 48
Multi-level wavelet analysis Decomposition tree 49
Resolution of time and frequency 50
DWT Low frequency: Approximation High frequency: Details Decomposition: iterative 51
Multiresolution analysis (MRA) Analyze the signal at different frequencies with different resolution Good time resolution and poor frequency resolution at high frequencies Good frequency resolution and poor time resolution at low frequencies Suitable for short duration of high frequency components and long duration of low frequency components 52
Example: MRA Three-scale Haar transform of a sinusoidal signal 500 point signal into 500 point transformed 53
Example: MRA Coefficients 54
Example: MRA Replace all entries but one in the transform by zeros and do the inverse transform 55
Example: MRA 56
Example MRA chirp signal 57
Example MRA Two sinusoidal signals Concatenated Wavelet: Haar (db1) 58
Example MRA Wavelet: db4 59
Comparison: FT vs. STFT vs. WT Forward Inverse 60
Comparison: Signal decomposition Linear combination of basis functions Discrete Fourier Transform 0 20 40 60 80 100 120 140 X X' 0 Discrete Wavelet Transform DWT 0 20 40 60 80 100 120 140 Haar 0 X X' 1 Haar 1 2 Haar 2 3 4 Haar 3 5 Haar 4 6 Haar 5 7 Haar 6 8 9 61 Haar 7
Comparison: Basis view 62
Comparison: Basis view Fourier analysis Basis is global Sinusoids with frequencies in arithmetic progression Short-time Fourier Transform Basis is local Sinusoid times Gaussian Fixed-width Gaussian window Wavelet Basis is local Frequencies in geometric progression Basis has constant shape independent of scale 63
Comparison: Time-Frequnecy 64
Comparison: Resolution of time and frequency STFT WT 65
Example: Singularity detection 66
Example: denoising 67
Example: denoising 15% of largest coeffs 10% of largest coeffs 68
Example denosing db8 and db12 instead of db2 69
Separating slow and fast component 70
Example: Separating slow and fast comp. 6 scales 71
Example: Separating slow and fast comp. Reconstruction from detail coefs only 72