Example - Haar Wavelets - IIT Delhipkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start...

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

Transcript of Example - Haar Wavelets - IIT Delhipkalra/csl783/haar.pdfExample - Haar Wavelets (contʼd) • Start...

  • 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

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

  • Example - Haar Wavelets (cont’d)

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

  • 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

  • Example - Haar Wavelets (cont’d)

    Note small magnitude detail coefficients!

    Dj

    Dj-1

    D1 L0

    How to compute Di ?

  • 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 )jkk

    f t c t kϕ += −∑

    ( ) (2 ) (2 )j jk jkk k

    f 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

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

    1( ) (2 )jkk

    f t c t kϕ += −∑

    ,( ) (2 ) (2 )j j

    k j kk k

    f t c t k d t kϕ ψ= − + −∑ ∑Vj, Wj

    How to compute Di ? (cont’d)

    differences between Vj and Vj+1

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

    ,( ) ( ) (2 )j

    k j kk k j

    f 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

  • 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 jkk k j

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

    scaling function wavelet function

  • 1D Haar Wavelets (cont’d)

  • 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

  • 1D Haar Wavelets (cont’d)

    j=1

    basis W 1 :

    basis for V 1 :

    Note that inner product is zero!

  • 1D Haar Wavelets (cont’d)

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

    form a basis in V j+1

  • 1D Haar Wavelets (cont’d)

    ψ(t)

    φ(t)

  • Example - Haar basis (revisited)

  • Decomposition of f(x)

    V2

    φ0,2(x)

    φ1,2(x)

    φ2,2(x)

    φ3,2(x)

    f(x)=

  • Decomposition of f(x) (cont’d)

    V1and W1

    V2=V1+W1

    φ0,1(x)

    φ1,1(x)

    ψ0,1(x)

    ψ1,1(x)

  • Example - Haar basis (revisited)

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

  • Example - Haar basis (revisited)

  • Example

  • Example (cont’d)

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

    x x x x x x … x x detail average

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

  • 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 … … . 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 from previous slide:

  • 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

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

  • 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

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

    … … .