Sunteți pe pagina 1din 65

The Lifting Scheme - Topics

 Reminder:approximations,details
 Haar wavelet transform
 Lifting scheme
 Update
 Higher order extensions
One Stage Filtering
Approximations and details:
 The low-frequency content is the most
important part in many applications, and gives
the signal its identity.
This part is called “Approximations”

 The high-frequency gives the ‘flavor’, and is


called “Details”
Approximations and Details:

 Approximations:low-frequency
components of the signal
 Details: high-frequency components

LPF A

Input Signal
HPF D
Decimation

 The former process produces twice the data


 To correct this, we Down sample (or: Decimate) the
filter output by two.

A complete one stage block :


LPF A*

Input
Signal HPF D*
Example*:

* Wavelet used: db2


Multi-level Decomposition

 Iterating the decomposition process, breaks


the input signal into many lower-resolution
components: Wavelet decomposition tree:
Low pass filter high pass filter
A Simple Example:
The Haar Wavelet
 Consider two neighboring samples a and b of
a sequence.
- a and b have some correlation.
A simple linear transform:

 High correlation
- small |d|, fewer bits representation.
(i.e. a=b,d=0)
The Haar Wavelet Con’t
 No loss of any information
 Reconstruction formula of a and b:

The key behind Haar Wavelet Transform:


these reconstruction formulas can be found by
inverting a 2x2 matrix.
The Haar Wavelet Con’t
 Signal Sn of 2n sample values Sn,l:

Sn = {Sn,l | 0=< l <= 2n}

 Apply average (Sn-1) and difference (dn-1) transform onto


each pair:

a = S2l, b = S2l+1 Sn-1,l = Sn,2l+Sn,2l


- 2n-1 pairs (l=0…2n-1) 2
dn-1,l = Sn,2l+1-Sn,2l
 Recover the original signal Sn from Sn-1 and dn-1
The Haar Wavelet Con’t
 Sn-1 as Approximations
 dn-1 as Details

 Signal with local coherence


- approximations closely resembles the
original signal
- detail is very small (efficient representation)
The Haar Wavelet Con’t
 Applying the same transform (averages and
differences) to Sn-1 itself.
 Split Sn-1 to (yet) coarser signal Sn-2 and
another difference signal dn-2,each of them
contain 2n-2 samples.
 We can repeat this transform n times till S0
contains only one sample S0,0.

This is the Haar transform


The Haar transform
Sn

Sn-1 dn-1
Sn-2 dn-2

S1 d1

S0 d0
Structure of the wavelet transform: recursively split into
averages and differences
The Haar transform Con’t

 We end up with:

- n detail signals dj (0<=j<=n-1),


each with 2j coefficients

- one signal s0 containing only one sample


s0,0 - the average of all the samples
of the original signal.
Inverse Haar transform
 Start from S0 and dj for 0<=j<n and obtain
Sn again.
* note that the total number of coefficients after
transform is 1 for S0 plus 2j for each dj.
(the exact number of samples of the original
signal). n-1
1+∑ 2j = 2n
j=0
The Haar transform
d0 d1 dn-2,l dn-1,l

S0 S1 S2 … Sn-1,l Sn,l

 Structure of the inverse wavelet transform:


recursively merge averages and differences.
The Haar transform Con’t

 The Haar transform can be thought of as


n
applying a NxN matrix (N = 2 ) to the
signal Sn.
- The cost of computing the transform is
O(N).
(FFT cost is O(NlogN) and linear
transformation of
an N vector is O(N2)).
Haar Transform in-place
 We want to overwrite old values with new values.

 First step:
compute the difference: d=b-a
and store it in b location.

 Second step:
We use a and d to compute the average: S=a+d/2
and store it in a location.
a+ = b/2 ; b -= a
Haar Transform in-place
Con’t
 Inverse: run code backwards!

a- = b/2 ; b+ = a

 This particular scheme is a simple instance


of the lifting scheme
The Lifting Scheme
 Consider a signal Sn with 2n samples .
 Goal: transform the signal into:
- a coarser signal Sn-1
- a detail signal dn-1
 3 steps:
- Split
- Predict
- Update
The Lifting Scheme - Split
 divide the input data into:

- even indexed samples Sn.


- odd indexed samples Sn+1.
Lazy wavelet transform
The Lifting Scheme - Predict
 predict the odd elements from the even
elements-output detail.

Sn-1

detail
Example – Predict using Haar
 The even sample is the prediction for the odd
sample.
 The detail dn-1 is the difference between the
odd sample and its predictor:
odd sample left neighbouring even sample - predictor

dn-1= Sn,2l+1- Sn,2l


detail
Predict
- - -

Note: perfect if function is constant, detail coefficients zero


General Case - Predict
 Detail = difference between odd element and
predict function calculated from the even
elements

dn-1=oddn - P(evenn)
The Lifting Scheme - Update
 follows the predict phase.
 The approximations Sn-1 (the signal for next
step) should maintain the average of the
original signal Sn.

 smoother input for the next step of the


wavelet transform.

Sn-1 = evenj,i + U( dn-1)
Example – Update Haar

 Sets Sn-1 to be the average of the


even/odd
pair (e.g., the even element si and its odd
successor, si+1):

Sn-1 = even j,i + odd j, i


2
Haar transform update step:
 recover the original value (from predict step) :
dn-1= oddj,i - evenj,i => oddj,i = evenj,i + dn-1
 Substituting this into the average (prev),
we get :
Sn-1 = even j,i + even j,i + dn-1
2
Sn-1 = even j,I + dn-1 = even + U(dn-1)
2
The Lifting Scheme
 The averages (even elements) become the
input for the next recursive step of the
forward transform.
Sn-1 Sn-2

Sn dn-2
dn-1
The Lifting Scheme
 In place computation:
- (oddj-1,evenj-1): = Split(Sj)
- oddj-1- = P(evenj-1)
- evenj-1+ = U(oddj-1)
Inverse Lifting Scheme
Inverse Lifting Scheme-3 steps
Undo Update

 dn,S0 given
recover even samples by subtructing the update
info:

 Sn-1 = evenj,i + U( dn-1)

evenj,i = Sn-1 -U(dn-1)


Haar: Sn,2l = Sn-1,l - dn-1,l/2
Inverse Lifting Scheme -
Undo Predict
 evenn-1,dn-1 given
recover odd samples by adding prediction info:

dn-1 =oddn-1 - P(evenn-1)

oddn-1= dn-1 + (evenn-1)

 Haar: Sn,2l+1=dn-1,l+Sn,2l
Inverse Lifting Scheme-
Merge
 zipper odd and even samples
recover original signal-inverse Lazy wavelet:
Sn=Merge(evenn-1,oddn-1)
 Inverse in place
 Evenj-1 - = U(oddj-1)
 Oddj-1 + = P(evenj-1)
 Sj := Merge(oddj-1,evenj-1)
 Inverse transform: reversing the order of the
operations and flipping the signs
Inverse Lifting Scheme
Even values
-

Undo Update Undo Predict Merge

+
Odd values
The Lifting Scheme-Example
Sn = X = [ 1 2 3 4 5 6 7 8 ] 2n=8 , n=3
Split:
Xe=[2 4 6 8] Xo=[1 3 5 7]

Pred: averaging neighboures (edges:simple subtruction of


one neighbour-can fix by zero padding or wrap
around or reflection)
Pred{Xe} = [2 3 5 7]
dn-1 = d2 = Xo- Pred{Xe} = [-1 0 0 0]
The Lifting Scheme-Example
Update: Sn-1= even j,I + dn-1,l
2
Xe=[2 4 6 8] dn-1 = [-1 0 0 0]
S2 = even+d2/2 = [1.5 4 6 8]
We repeat recursively:
 Split: S2 is splitted simillarly:
Xe=[4 8] Xo=[1.5 6]
Pred{Xe} = [4 6] dn-2 = d1 = Xo- Pred{Xe} = [-2.5 0]
S1 = even+d1/2 = [2.75 8]
Xe=[8] Xo=[2.75]
Pred{Xe} = [8] dn-3 = d0 = Xo- Pred{Xe} = [-5.25]
S0 = even+d0/2 = [5.375]
The Lifting Scheme-Example
 The pyramid will be:

d2 = [-1 0 0 0]
d1 = [-2.5 0]
d0 = [-5.25]
S0 = [5.375]

Good result(most of elements are 0).


The Lifting Scheme-
Inverse Example
We will recover the original signal from the
pyramid:
The pyramid : d2 = [-1 0 0 0] , d1 = [-2.5 0],
d0 = [-5.25] , S0 = [5.375]
Inverse transform:
Xe =S0 – d0/2 = [8] Pred{Xe} = [8]
Xo=d0+Pred{Xe} = [2.75]
S1 = [2.75 8]
The Lifting Scheme-
Inverse Example
Xe=S1 – d1/2 = [4 8] Pred{Xe} = 4 6
Xo=d1+ Pred{Xe} = [1.5 6]
S2 = [1.5 4 6 8]
Xe=S2– d2/2 = [2 4 6 8] Pred{Xe} = 2 3 5 7
Xo=d0+ Pred{Xe} = [1 3 5 7]
S3 = [1 2 3 4 5 6 7 8]
The Lifting Scheme

 Suppose Predict and Update are linear.


description of their operation as matrices
P and U:
new
Xo =Xo-PXe
Xenew =Xe+UXonew=Xe+UXo-UPXe
or:
Xonew I -P Xo
Xenew U I-UP Xe
The Lifting Scheme - Example 2
 Assume: P=I and U=0.5I
Xonew I -p Xo I -I Xo
Xenew U I-UP Xe 0.5I 0.5I Xe
Odd elements Even elements
differences average
of
neighbouring pairs
An example:
linear wavelet transform
 Haar
- simple and fast wavelet transform
 Limitations
- not smooth enough: blocky
 Erasing Haar Coefficients:

 Fourier analysis not


always applicable
The Lifting Scheme
 Lifting
Build more powerful
versions
 An example
linear wavelet
transform
linear wavelet transform –
Prediction
 Linear Prediction
- Use even on either side
- Predictor for odd sample Sn,2l+1: average of
neighboring samples:on left Sn,2l, on right
Sn,2l+2
linear wavelet transform -
Prediction
linear wavelet transform
 Even values are subsampled
linear wavelet transform -
Update
 Sets Sn-1 to be the average of even and odd
elements
 2n elements => 2n-1 even elements/averages
 Example: 2n=8
linear wavelet transform -
Update Ex.
 Example: 2n=8

-
linear wavelet transform -
Update Ex.
 sum of the sj-1 elements is equal to the sum
of the sj elements, divided by two:
linear wavelet transform -
Update
 Signal average is not preserved
 Update Sn-1,l using previously compute detail
signals dn-1,l.
 Using Neighboring wavelet coefficients:

Sn-1,l=Sn,2l+A(dn-1,l-1+dn-1,l)
Update
 Sn-1,l = Sn,2l+A(dn-1,l-1+dn-1,l)
 A=1/4 to maintain the average

 Inverse-easy to compute:
Sn,2l = Sn-1,l - 1/4(dn-1,l-1+dn-1,l)
to recover even
Sn,2l+1=dn,l+1/2(Sn,2l+Sn,2l+2)
to recover odd
samples
linear wavelet transform

Original signal
linear wavelet transform
linear wavelet transform
 Extend
- build higher polynomial order predictors
- Use more (D) neighbors on left and right
Example:
- Cubic polynom interpolating 4 values
- Bilinear Interpolation: the assigned value is
an intermediate value between the 4
nearest pixels :
aweighted sum of the 4 nearest pixels
- Each weight is proportional to the distance
from each existing pixel.
effective weights: -1/16 9/16 9/16 -1/16
Higher Order Prediction
Lifting Scheme - Predict
Haar
The even sample is the
prediction for the odd sample.
dn-1= Sn,2l+1- Sn,2l

Linear
average of
neighboring samples:on
dn-1= Sn,2l+1-1/2(S2n+S2n+2)

Bilinear
intermediate value between the 4
nearest pixels
Summary
 Lifting Scheme
- construction of transforms
- Haar example
- rewriting Haar in place

 Three steps
- split
- Predict
- Update
Summary
 Predict
- detail coefficient is failure of prediction

 Update
- smooth coefficient to preserve average
- B spline C2-ensure smoothness
 Higher order extensions
- increase order of prediction and update
linear wavelet transform -
Update (why A=1/4)

=1/2∑Sj[n]

S-ar putea să vă placă și