35
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

Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

  • Upload
    others

  • View
    29

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

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:

L0 D1 D2 D3

Page 2: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example - Haar Wavelets (cont’d)

•  Start by averaging 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.

Page 3: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example - Haar Wavelets (cont’d)

•  Repeating this process on the averages gives the full decomposition:

Page 4: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example - Haar Wavelets (cont’d)

•  The Harr decomposition of the original four-pixel image is:

•  We can reconstruct the original image to a resolution

by adding or subtracting the detail coefficients from the lower-resolution versions.

2 1 -1

Page 5: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example - Haar Wavelets (cont’d)

Note small magnitude detail coefficients!

Dj

Dj-1

D1 L0

How to compute Di ?

Page 6: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

How to compute Di ? (cont’d) •  If f(t) ϵ Vj+1, then f(t) can be represented using basis functions φ(t) fromVj+1:

1( ) (2 )jk

kf t c t kϕ += −∑

( ) (2 ) (2 )j jk jk

k kf t c t k d t kϕ ψ= − + −∑ ∑

Vj+1 = Vj + Wj

Alternatively, f(t) can be represented using two basis functions, φ(t) from Vj and ψ(t) from Wj:

Vj+1

Page 7: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Think of Wj as a means to represent the parts of a function in Vj+1 that cannot be represented in Vj

1( ) (2 )jk

kf t c t kϕ += −∑

,( ) (2 ) (2 )j jk j k

k kf t c t k d t kϕ ψ= − + −∑ ∑

Vj, Wj

How to compute Di ? (cont’d)

differences between Vj and Vj+1

Page 8: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

How to compute Di ? (cont’d) •  à using recursion on Vj:

,( ) ( ) (2 )jk j k

k k jf t c t k d t kϕ ψ= − + −∑ ∑∑

V0 W0, W1, W2, … basis functions basis functions

Vj+1 = Vj-1+Wj-1+Wj = …= V0 + W0 + W1 + W2 + … + Wj

if f(t) ϵ Vj+1 , then:

Vj+1 = Vj + Wj

Page 9: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Wavelet expansion (cont’d)

•  f(t) is written as a linear combination of φ(t-k) and ψ(2jt-k) :

Note: in Fourier analysis, there are only two possible values of k ( i.e., 0 and π/2); the values j correspond to different scales (i.e., frequencies).

( ) ( ) (2 )jk jk

k k jf t c t k d t kϕ ψ= − + −∑ ∑∑

scaling function wavelet function

Page 10: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

1D Haar Wavelets (cont’d)

Page 11: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

1D Haar Wavelets (cont’d)

•  Mother wavelet function:

•  Note that φ(x) . ψ(x) = 0 (i.e., orthogonal)

1

-1 0 1/2 1

0 1 . = 0 1

-1 0 1/2 1

1

Page 12: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

1D Haar Wavelets (cont’d)

j=1

basis W 1 :

basis for V 1 :

Note that inner product is zero!

Page 13: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

1D Haar Wavelets (cont’d)

Basis functions ψ ji of W j Basis functions φ ji of V j

form a basis in V j+1

Page 14: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

1D Haar Wavelets (cont’d)

ψ(t)

φ(t)

Page 15: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example - Haar basis (revisited)

Page 16: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Decomposition of f(x)

V2

φ0,2(x)

φ1,2(x)

φ2,2(x)

φ3,2(x)

f(x)=

Page 17: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Decomposition of f(x) (cont’d)

V1and W1

V2=V1+W1

φ0,1(x)

φ1,1(x)

ψ0,1(x)

ψ1,1(x)

Page 18: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example - Haar basis (revisited)

Page 19: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Decomposition of f(x) (cont’d)

V2=V1+W1=V0+W0+W1

V0 ,W0 and W1

φ0,0(x)

ψ0,0(x)

ψ0,1(x)

ψ1,1(x)

Page 20: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example - Haar basis (revisited)

Page 21: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example

Page 22: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example (cont’d)

Page 23: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Convention for illustrating 1D Haar wavelet decomposition (cont’d)

x x x x x x … x x detail average

Page 24: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

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).

•  Two decompositions –  Standard decomposition –  Non-standard decomposition

•  Each decomposition corresponds to a different set of 2D basis functions.

Page 25: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

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.

Page 26: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Standard Haar wavelet decomposition (cont’d)

x x x … x x x x … x … … . x x x ... x

(1) row-wise Haar decomposition:

detail average

… … .

… … .

re-arrange terms

Page 27: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Standard Haar wavelet decomposition (cont’d)

(1) row-wise Haar decomposition:

detail average

… … .

… … . …

row-transformed result from previous slide:

Page 28: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Standard Haar wavelet decomposition (cont’d)

(2) column-wise Haar decomposition:

detail average

… … .

… … . …

row-transformed result column-transformed result

Page 29: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example

… … .

row-transformed result

… … .

re-arrange terms

Page 30: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example (cont’d)

… … .

column-transformed result

Page 31: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

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) Repeat the process on the quadrant containing averages

only (i.e., in both directions).

Page 32: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Non-standard Haar wavelet decomposition (cont’d)

x x x … x x x x … x … … . x x x . . . x

one level, horizontal Haar decomposition:

… … .

… … .

one level, vertical Haar decomposition:

Note: averaging/differencing of detail coefficients shown

Page 33: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

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

… … .

Page 34: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example

… … .

… …

re-arrange terms

Page 35: Example - Haar Waveletspkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start by averaging the pixels together (pairwise) to get a new lower resolution image: • To recover

Example (cont’d)

… … .