# Wavelets (Chapter 7) CS474/674 – Prof. Bebis. STFT - revisited Time - Frequency localization depends on window size. –Wide window  good frequency localization,

## Presentation on theme: "Wavelets (Chapter 7) CS474/674 – Prof. Bebis. STFT - revisited Time - Frequency localization depends on window size. –Wide window  good frequency localization,"— Presentation transcript:

Wavelets (Chapter 7) CS474/674 – Prof. Bebis

STFT - revisited Time - Frequency localization depends on window size. –Wide window  good frequency localization, poor time localization. –Narrow window  good time localization, poor frequency localization.

Wavelet Transform Uses a variable length window, e.g.: –Narrower windows are more appropriate at high frequencies –Wider windows are more appropriate at low frequencies

What is a wavelet? A function that “waves” above and below the x-axis with the following properties: –Varying frequency –Limited duration –Zero average value This is in contrast to sinusoids, used by FT, which have infinite duration and constant frequency. Sinusoid Wavelet

Types of Wavelets There are many different wavelets, for example: Morlet Haar Daubechies

Basis Functions Using Wavelets Like sin( ) and cos( ) functions in the Fourier Transform, wavelets can define a set of basis functions ψ k (t): Span of ψ k (t): vector space S containing all functions f(t) that can be represented by ψ k (t).

Basis Construction – “Mother” Wavelet The basis can be constructed by applying translations and scalings (stretch/compress) on the “mother” wavelet ψ(t): scale translate Example: ψ(t)

(dyadic/octave grid) Basis Construction - Mother Wavelet j k scale =1/2 j (1/frequency)

Continuous Wavelet Transform (CWT) translation parameter (measure of time) scale parameter (measure of frequency) mother wavelet (i.e., window function) normalization constant Forward CWT: scale =1/2 j (1/frequency)

Illustrating CWT 1.Take a wavelet and compare it to a section at the start of the original signal. 2.Calculate a number, C, that represents how closely correlated the wavelet is with this section of the signal. The higher C is, the more the similarity.

Illustrating CWT (cont’d) 3. Shift the wavelet to the right and repeat step 2 until you've covered the whole signal.

Illustrating CWT (cont’d) 4. Scale the wavelet and go to step 1. 5. Repeat steps 1 through 4 for all scales.

Visualize CTW Transform Wavelet analysis produces a time-scale view of the input signal or image.

Continuous Wavelet Transform (cont’d) Note the double integral! Inverse CWT: Forward CWT:

Fourier Transform vs Wavelet Transform weighted by F(u)

Fourier Transform vs Wavelet Transform weighted by C(τ,s)

Properties of Wavelets Simultaneous localization in time and scale - The location of the wavelet allows to explicitly represent the location of events in time. - The shape of the wavelet allows to represent different detail or resolution.

Properties of Wavelets (cont’d) Sparsity: for functions typically found in practice, many of the coefficients in a wavelet representation are either zero or very small.

Properties of Wavelets (cont’d) Adaptability: Can represent functions with discontinuities or corners more efficiently. Linear-time complexity: many wavelet transformations can be accomplished in O(N) time.

Discrete Wavelet Transform (DWT) (inverse DWT) (forward DWT) where

DFT vs DWT DFT expansion: DWT expansion or one parameter basis two parameter basis

Multiresolution Representation Using Wavelets j fine details coarse details wider, large translations

j fine details coarse details Multiresolution Representation Using Wavelets

j fine details coarse details narrower, small translations Multiresolution Representation Using Wavelets

high resolution (more details) low resolution (less details) … j Multiresolution Representation Using Wavelets

Pyramidal Coding - Revisited Approximation Pyramid (with sub-sampling)

Pyramidal Coding - Revisited Prediction Residual Pyramid (details) reconstruct (with sub-sampling) Approximation Pyramid

Efficient Representation Using “Details” details D 2 L0L0 details D 3 details D 1 (without sub-sampling)

Efficient Representation Using Details (cont’d) representation: L 0 D 1 D 2 D 3 A wavelet representation of a function consists of (1)a coarse overall approximation (2)detail coefficients that influence the function at various scales in general : L 0 D 1 D 2 D 3 …D J

Reconstruction (synthesis) H 3 =H 2 & D 3 details D 2 L0L0 details D 3 H 2 =H 1 & D 2 H 1 =L 0 & D 1 details D 1 (without sub-sampling)

Example - Haar Wavelets Suppose we are given a 1D "image" with a resolution of 4 pixels: [9 7 3 5] The Haar wavelet transform is the following: L 0 D 1 D 2 D 3 (with sub-sampling)

Example - Haar Wavelets (cont’d) Start by averaging and subsampling the pixels together (pairwise) to get a new lower resolution image: To recover the original four pixels from the two averaged pixels, store some detail coefficients. 1 [9 7 3 5]

Example - Haar Wavelets (cont’d) Repeating this process on the averages (i.e., low resolution image) gives the full decomposition: 1 Harr decomposition:

Example - Haar Wavelets (cont’d) The original image can be reconstructed by adding or subtracting the detail coefficients from the lower- resolution representations. 2 1 -1 [6] L 0 D 1 D 2 D 3

Example - Haar Wavelets (cont’d) Detail coefficients become smaller and smaller scale decreases. DjDj D j-1 D1D1 L0L0 How should we compute the detail coefficients D j ?

Multiresolution Conditions larger setIf a set of functions V can be represented by a weighted sum of ψ (2 j t - k), then a larger set, including V, can be represented by a weighted sum of ψ (2 j+1 t - k). low resolution high resolution j ψ(2 j t - k) ψ(2 j+1 t - k)

Multiresolution Conditions (cont’d) V j : span of ψ(2 j t - k): V j+1 : span of ψ(2 j+1 t - k):

ψ(t - k) ψ(2t - k) ψ(2 j t - k) … V0V0 V1V1 VjVj if f(t) V j then f(t) V j+1 j=0 j=1 j Nested Spaces Multiresolution Conditions (cont’d)

How to compute D j ? Define a set of basis functions that span the difference between V j+1 and V j IDEA:

Let W j be the orthogonal complement of V j in V j+1 V j+1 = V j + W j How to compute D j ? (cont’d)

If f(t) V j+1, then f(t) can be represented using basis functions φ(t) from V j+1 : V j+1 = V j + W j Alternatively, f(t) can be represented using two sets of basis functions, φ(t) from V j and ψ(t) from W j : V j+1

Think of W j as a means to represent the parts of a function in V j+1 that cannot be represented in V j V j W j How to compute D j ? (cont’d) differences between V j and V j+1 V j+1

How to compute D j ? (cont’d)  using recursion on V j : V 0 W 0, W 1, W 2, … basis functions V j+1 = V j-1 +W j-1 +W j = …= V 0 + W 0 + W 1 + W 2 + … + W j if f(t) V j+1, then: V j+1 = V j + W j

Summary: wavelet expansion (Section 7.2) Wavelet decompositions involve a pair of waveforms: φ(t) ψ(t) encodes low resolution info encodes details or high resolution info scaling function wavelet functionTerminology:

1D Haar Wavelets Haar scaling and wavelet functions: computes average (low pass) computes details (high pass) φ(t) ψ(t)

Let’s consider the spaces corresponding to different resolution 1D images: 1D Haar Wavelets (cont’d) etc.... …. 1-pixel 2-pixel 4-pixel (j=0) (j=1) (j=2) V0V0 V1V1 V2V2

1D Haar Wavelets (cont’d) V 0 represents the space of 1-pixel (2 0 -pixel) images Think of a 1-pixel image as a function that is constant over [0,1) Example: 0 1 width: 1 j=0

1D Haar Wavelets (cont’d) V 1 represents the space of all 2-pixel (2 1 -pixel) images Think of a 2-pixel image as a function having 2 1 equal- sized constant pieces over the interval [0, 1). Example: 0 ½ 1 = + width: 1/2 e.g., j=1 Note that:

1D Haar Wavelets (cont’d) V j represents all the 2 j -pixel images Functions having 2 j equal-sized constant pieces over interval [0,1). V j-1 Example: width: 1/2 j V j Note that: width: 1/2 j-1 width: 1/2 V1V1

1D Haar Wavelets (cont’d) V 0, V 1,..., V j are nested i.e., Vj…V1V0Vj…V1V0 coarse info fine details

Define a basis for V j Scaling function: Let’s define a basis for V j : Note new notation:

Define a basis for V j (cont’d) width: 1/2 0 width: 1/2width: 1/2 2 width: 1/2 3

Define a basis for W j Wavelet function: Let’s define a basis ψ j i for W j : Note new notation:

Define basis for W j (cont’d) Note that the dot product between basis functions in V j and W j is zero!

Basis for V j+1 Basis functions ψ j i of W j Basis functions φ j i of V j form a basis in V j+1

Define a basis for W j (cont’d) V 3 = V 2 + W 2

Define a basis for W j (cont’d) V 2 = V 1 + W 1

Define a basis for W j (cont’d) V 1 = V 0 + W 0

Example - Revisited f(x)= V2V2

φ 2,0 (x) φ 2,1 (x) φ 2,2 (x) φ 2,3 (x) Example (cont’d) V2V2 f(x)=

Example (cont’d) V 1 and W 1 V 2 =V 1 +W 1 φ 1,0 (x) φ 1,1 (x) ψ 1,0 (x) ψ 1,1 (x) (divide by 2 for normalization)

Example (cont’d)

V 2 =V 1 +W 1 =V 0 +W 0 +W 1 V 0,W 0 and W 1 φ 0,0 (x) ψ 0,0 (x) ψ 1,0 (x) ψ 1,1 (x) (divide by 2 for normalization)

Example

Example (cont’d)

Filter banks The lower resolution coefficients can be calculated from the higher resolution coefficients by a tree- structured algorithm (i.e., filter bank). h 0 (-n) is a lowpass filter and h 1 (-n) is a highpass filter Subband encoding (analysis)

Example (revisited) [9 7 3 5] low-pass, down-sampling high-pass, down-sampling (9+7)/2 (3+5)/2 (9-7)/2 (3-5)/2 LP HP

Filter banks (cont’d) Next level: h 0 (-n) is a lowpass filter and h 1 (-n) is a highpass filter

Example (revisited) [9 7 3 5] high-pass, down-sampling low-pass, down-sampling (8+4)/2 (8-4)/2 LP HP

Convention for illustrating 1D Haar wavelet decomposition x x x x x x … x x detail (HP) average (LP) … re-arrange: LP HP … … … …

Examples of lowpass/highpass (analysis) filters Daubechies Haar h0h0 h1h1 h0h0 h1h1

Filter banks (cont’d) The higher resolution coefficients can be calculated from the lower resolution coefficients using a similar structure. Subband encoding (synthesis) g 0 (n) is a lowpass filter and g 1 (n) is a highpass filter

Filter banks (cont’d) Next level: g 0 (n) is a lowpass filter and g 1 (n) is a highpass filter

Examples of lowpass/highpass (synthesis) filters Daubechies: Haar (same as for analysis): + g0g0 g1g1 g0g0 g1g1

2D Haar Wavelet Transform The 2D Haar wavelet decomposition can be computed using 1D Haar wavelet decompositions. –i.e., 2D Haar wavelet basis is separable We’ll discuss two different decompositions (i.e., correspond to different basis functions): –Standard decomposition –Non-standard decomposition

Standard Haar wavelet decomposition Steps: (1) Compute 1D Haar wavelet decomposition of each row of the original pixel values. (2) Compute 1D Haar wavelet decomposition of each column of the row-transformed pixels.

Standard Haar wavelet decomposition (cont’d) x x x … x … …. x x x... x (1) row-wise Haar decomposition: … detail average … … …. … … re-arrange terms

Standard Haar wavelet decomposition (cont’d) (1) row-wise Haar decomposition: … detail average … … … …. … row-transformed result … … ….

Standard Haar wavelet decomposition (cont’d) (2) column-wise Haar decomposition: … detail average … … … …. … … … … row-transformed result column-transformed result

Example … … … … …. row-transformed result … … …. re-arrange terms

Example (cont’d) … … … … …. column-transformed result

Standard Haar wavelet decomposition (cont’d)

What is the 2D Haar basis for the standard decomposition? To construct the standard 2D Haar wavelet basis, consider all possible outer products of the1D basis functions. φ 0,0 (x) ψ 0,0 (x) ψ 1,0 (x) ψ 1,1 (x) V 2 =V 0 +W 0 +W 1 Example:

To construct the standard 2D Haar wavelet basis, consider all possible outer products of the1D basis functions. φ 00 (x), φ 00 (x) ψ 00 (x), φ 00 (x) ψ 10 (x), φ 00 (x) What is the 2D Haar basis for the standard decomposition? Notation:

V2V2 What is the 2D Haar basis for the standard decomposition? Notation:

Non-standard Haar wavelet decomposition Alternates between operations on rows and columns. (1) Perform one level decomposition in each row (i.e., one step of horizontal pairwise averaging and differencing). (2) Perform one level decomposition in each column from step 1 (i.e., one step of vertical pairwise averaging and differencing). (3) Rearrange terms and repeat the process on the quadrant containing the averages only.

Non-standard Haar wavelet decomposition (cont’d) x x x … x … …. x x x... x one level, horizontal Haar decomposition: … … … …. … … … one level, vertical Haar decomposition: …

Non-standard Haar wavelet decomposition (cont’d) one level, horizontal Haar decomposition on “green” quadrant one level, vertical Haar decomposition on “green” quadrant … … … …. … … re-arrange terms … … … … …. …

Example … … … …. … … re-arrange terms

Example (cont’d) … … … … ….

Non-standard Haar wavelet decomposition (cont’d)

What is the 2D Haar basis for the non- standard decomposition? Define 2D scaling and wavelet functions: Apply translations and scaling:

V2V2 What is the 2D Haar basis for the non- standard decomposition? Notation:

LL LH: intensity variations along columns (horizontal edges) HL: intensity variations along rows (vertical edges) HH: intensity variations along diagonal LL: average Detail coefficients Three sets of detail coefficients (i.e., subband coding) 2D Subband Coding

LL LH HLHH

Wavelets Applications Noise filtering Image compression –Special case: fingerprint compression Image fusion Recognition G. Bebis, A. Gyaourova, S. Singh, and I. Pavlidis, "Face Recognition by Fusing Thermal Infrared and Visible Imagery", Image and Vision Computing, vol. 24, no. 7, pp. 727-742, 2006. Image matching and retrieval Charles E. Jacobs Adam Finkelstein David H. Salesin, "Fast Multiresolution Image Querying", SIGRAPH, 1995.

Download ppt "Wavelets (Chapter 7) CS474/674 – Prof. Bebis. STFT - revisited Time - Frequency localization depends on window size. –Wide window  good frequency localization,"

Similar presentations