107
Wavelet-based image compression Marco Cagnazzo Multimedia Compression - MN907

Wavelet-based image compression

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Wavelet-based image compression

Wavelet-based imagecompression

Marco Cagnazzo

Multimedia Compression - MN907

Page 2: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Outline

Introduction

Discrete wavelet transform and multiresolution analysisFilter banks and DWTMultiresolution analysis

Images compression with waveletsEZWJPEG 2000

2/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 3: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Outline

Introduction

Discrete wavelet transform and multiresolution analysis

Images compression with wavelets

3/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 4: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Signal analysis

◮ Signal analysis: similitude to “atoms” φk (t) or φk [t] (if timeis discretized)

◮ Similitude: scalar product

c[k ] = 〈x [t], φk [t]〉

◮ Projection over a set of signals◮ Basis change◮ Linear Transform

4/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 5: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Signal analysis

time

freq

uenc

y

Time analysis

φk (t) = δ(t − k)

5/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 6: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Signal analysis

time

freq

uenc

y

Frequency Analysis

φk (t) = e−j2π kN t

6/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 7: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Signal analysis

time

freq

uenc

y

Short Time Fourier Transform

φk ,τ (t) = e−j2π kN twτ (t)

Where wτ (t) is a window cen-tred in τ .

E.g., wτ (t) = 1√2πσ2

e(t−τ)2

2σ2

7/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 8: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Signal analysis

time

freq

uenc

y

Wavelet Transform

φj ,k(t) = φ(2−j t − k)

8/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 9: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and images : Motivations

◮ Image model : trends + anomalies

9/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 10: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and images : Motivations

◮ Image model : trends + anomalies

9/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 11: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and images : Motivations

◮ Image model : trends + anomalies

9/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 12: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and images : Motivations

◮ Anomalies :◮ Abrupt variations of the signal◮ High frequency contributions◮ Objects’ contours◮ Good spatial resolution◮ Rough frequency resolution

◮ Trends :◮ Slow variations of the signal◮ Low frequency contributions◮ Objects’ texture◮ Rough spatial resolution◮ Good frequency resolution

10/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 13: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and images : Motivations

Signal model: an image row

11/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 14: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and images : Motivations

Signal model: an image row

11/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 15: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and images : Motivations

Signal model: an image row

11/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 16: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Wavelets and Multiple resolution analysis

◮ Approximation: low resolution version◮ “Details”: zeros when the signal is polynomial

0 50 100 150 200 250 300 350 400 450 500−20

0

20

40

60

0 50 100 150 200 250 300 350 400 450 500

−20

0

20

40

60

80

c1[k ] d1[k ]

x [k ] = c0[k ]

12/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 17: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Outline

Introduction

Discrete wavelet transform and multiresolution analysisFilter banks and DWTMultiresolution analysis

Images compression with wavelets

13/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 18: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

1D filter banks

Decomposition

c[k ] c[k ]

d [k ] d [k ]

x [k ]

h1

h0 ↓ 2

↓ 2

Analysis filter bank

2 ↓ : decimation : c[k ] = c[2k ]

14/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 19: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Reconstruction

c[k ]c[k ]

d [k ]d [k ]

x [k ]

f1

f0↑ 2

↑ 2

Synthesis filter bank

2 ↑ : interpolation operator, doubles the sample number

c[k ] =

{c[k/2] if k is even

0 if k is odd

15/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 20: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Filter properties

◮ Perfect reconstruction (PR)◮ FIR◮ Orthogonality◮ Vanishing moments◮ Symmetry

16/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 21: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Perfect reconstruction conditions

We want PR after synthesis and analysis filter banks :∀k ∈ Z,

xk = xk+ℓ ⇐⇒ X (z) = z−ℓX (z)

c[k ] c[k ]

d [k ] d [k ]

x [k ]

h1

h0

f1

f0↓ 2

↓ 2

c[k ]

d [k ]

x [k ]

↑ 2

↑ 2

17/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 22: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Z-domain relationships

filter C (z) =∞∑

n=−∞cnz−n = H0 (z)X (z)

decimation C (z) =12

[C(

z1/2)+ C

(−z1/2

)]

interpolation C (z) = C(

z2)

output X (z) = F0 (z)C(

z2)+ F1 (z)D

(z2)

X (z) =12[F0 (z)H0 (z) + F1 (z)H1 (z)]X (z)

+12[F0 (z)H0 (−z) + F1 (z)H1 (−z)]X (−z)

18/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 23: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

PR conditions in Z

∀k ∈ Z,

xk = xk+ℓ ⇐⇒ X (z) = z−ℓX (z)

m

T (z) =H0 (z)F0 (z) + H1 (z)F1 (z) = 2z−ℓ Non distortion (ND)

A(z) =H0 (−z)F0 (z) + H1 (−z)F1 (z) = 0 Aliasing cancelation (AC)

19/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 24: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Perfect reconstruction conditions

Matrix form

If the analysis filter bank is given, the synthesis one isdetermined by:

[H0 (z) H1 (z)

H0 (−z) H1 (−z)

]·[F0 (z)F1 (z)

]=

[2z−ℓ

0

]

We need that the modulation matrix is invertible, ie.

∀z ∈ C : |z| = 1, ∆(z) = H0(z)H1(−z)− H1(z)H0(−z) 6= 0

20/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 25: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Perfect reconstruction conditions

Synthesis filter bank

If ∆(z) 6= 0 = on the unit circle, then

F0 (z) =2z−ℓ

∆(z)H1 (−z)

F1 (z) = −2z−ℓ

∆(z)H0 (−z)

Question: if the analysis FB (AFB) is made up by FIR, how toimpose that the synthesis FB (SFB) is FIR as well?

21/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 26: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Perfect reconstruction with FIR filters

In order to F0, F1 be sum of powers, ∆(z) must be a single power ofz. A sufficient condition is the alternating sign (AS) condition:

F0(z) = H1(−z)

F1(z) = −H0(−z)

Exercise: find the relationships between the analysis and synthesisFB in the time domain; justify the name “AS”.Exercise: show that AS implies AC.

22/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 27: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Analysis filters

◮ AS assures that, if AFB is FIR, SFB is FIR also, and AC issatisfied

◮ Still we need to find H0 and H1 such that ND is satisfied◮ Typically we choose some structure for H0 and H1 and we

use ND to derive the first from the second◮ QMF: H1(z) = H0(−z)◮ CQF: H1(z) = −z−(N−1)H0(−z−1)◮ Biorthogonal

23/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 28: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Orthogonality

QMF and CQF are orthogonal, which assures energyconservation:

∞∑

k=−∞(xk )

2 =

∞∑

k=−∞(ck )

2 +

∞∑

k=−∞(dk )

2

⇒ reconstruction error = quantization error on DWT coefficientsFor bi-orthogonal filters, the reconstruction errors is a weightedsum of the quantization errors on the DWT subbands, withsuitable weights ωi

24/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 29: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Vanishing moments

◮ Vanishing moments (VM) represent filter ability toreproduce polynomials: a filter with p VM can representpolynomials with degree < p

◮ The High-pass filter will not respond to a polynomial inputwith degree < p

◮ In this case all the signal information is preserved in theapproximation signal (half the samples)

◮ A filter with p VM has at least 2p taps

25/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 30: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem

◮ Filterbank properties such as we saw, are valid forinfinite-size signals

◮ We are interested in finite support signals◮ How to interpret the previous results for finite support

signals?

26/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 31: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem

◮ Filterbank properties such as we saw, are valid forinfinite-size signals

◮ We are interested in finite support signals◮ How to interpret the previous results for finite support

signals?◮ Zero padding would introduce a coefficient expansion◮ Filtering an N-size signal with an M-size produces a signal

with size N + M − 1

26/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 32: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem

◮ Filterbank properties such as we saw, are valid forinfinite-size signals

◮ We are interested in finite support signals◮ How to interpret the previous results for finite support

signals?◮ Zero padding would introduce a coefficient expansion◮ Filtering an N-size signal with an M-size produces a signal

with size N + M − 1◮ Periodization?◮ Symmetrization?

26/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 33: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem: Coefficient expansion

−10 0 10 20 30

−2

0

2

4

6

8

10

12

14

16

x

−10 0 10 20 30

−0.2

0

0.2

0.4

0.6

0.8

h0

−10 0 10 20 30

−2

0

2

4

6

8

10

12

14

16

y = h0 ∗ x

27/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 34: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem: Periodization

◮ A signal x of support N is considered as a periodic signal xof period N

◮ Filtering x with h0 results into a periodic output y◮ y has the same period N as x◮ So we need to compute just N samples of y◮ However, periodization introduces “jumps” in a regular

signal

28/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 35: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem: Periodization

−10 0 10 20 30

−2

0

2

4

6

8

10

12

14

16

x

−10 0 10 20 30

−2

0

2

4

6

8

10

12

14

16

y

29/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 36: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem: Symmetry

◮ Symmetrization before periodization reduces the impact onsignal regularity

◮ But it doubles the number of coefficients...

30/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 37: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem: Symmetry

◮ Symmetrization before periodization reduces the impact onsignal regularity

◮ But it doubles the number of coefficients...◮ Unless the filters are symmetric, too

◮ We use x as half-period of xs◮ xs has a period of 2N samples◮ Filtering xs with h0, produces ys◮ If h0 is symmetric, ys is periodic and symmetric, with period

2N: we only need to compute N samples

30/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 38: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Borders problem: Symmetry

−10 0 10 20 30

−2

0

2

4

6

8

10

12

14

16

xs

−10 0 10 20 30

−2

0

2

4

6

8

10

12

14

16

ys

31/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 39: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Haar filter

h0(k) = 1 1 f0(k) = 1 1

h1(k) = 1 -1 f1(k) = -1 1

◮ Symmetric◮ Orthogonal (Haar is both QMF and CQF)◮ VM = 1

◮ Only capable to represent piecewise constant signals

32/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 40: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Summary: perfect reconstruction andborders

◮ Convolution involves coefficient expansion◮ Solution: circular convolution

◮ Circular convolution allows to reconstruct an N-samplessignal with N wavelet coefficients

◮ The periodization generates borders discontinuities, i.e.spurious high frequencies coefficients that demand a lot ofcoding resources

◮ Solution: Symmetric periodization◮ No discontinuities◮ Does it double the coefficient number?◮ No, if the filter is symmetric !

Bad news: the only orthogonal symmetric FIR filter is Haar!

33/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 41: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Biorthogonal filters

Cohen-Daubechies-Fauveau filters

With biorthogonal filters, if h0 has p VM and f0 has p VM, thefilter has at least p + p − 1 taps.The CDF filters have the following properties:◮ They are symmetric (linear phase)◮ They maximize the VM for a given filter length◮ They are close to orthogonality (weights ωi are close to

one)

They are by far the most popular in image compression

34/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 42: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

DWT and MRA

A multiresolution analysis (MRA) is a set of subspaces Vj in L2(R)such that:

1. ∀j ∈ Z,Vj ⊂ Vj+1

2.⋂

j Vj = {0}

3.⋃

j Vj = L2(R)

4. f (t) ∈ Vj ⇔ f (2t) ∈ Vj+1

5. f (t) ∈ V0 ⇔ ∀k ∈ Z, f (t − k) ∈ V0

6. ∃φ ∈ V0 : {φ(t − k)}k∈Z is a basis of V0

φ is called father wavelet.

35/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 43: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

MRA and DWT

◮ The projection fj of f into Vj is an approximation of f◮ Increasing j , we increase the resolution◮ The projection fj of f into Vj converges to f :

fj →j f

◮ MRA implies φj ,k = 2j/2φ(2j t − k) generates a basis of Vj

◮ ∆f = fj+1 − fj are the details at level j◮ The space of details is Wj

◮ Vj ⊕Wj = Vj+1

◮ Vj = V0 ⊕W0 ⊕W1 ⊕ . . . ⊕Wj−1

36/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 44: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

MRA and DWT

◮ Projection of f over V0 : approximation

◮ Projection of f over Wj : details allowing to increase theresolution (pass from Vj−1 to Vj

◮ The basis of Wj is generated by ψj,k (t) = 2jψ(2j t − k)

◮ ψ(t) is the mother wavelet

◮ ψ(t) =√

2∑

k b(k)φ(2t − k) (wavelet equation)

◮ φ(t) =√

2∑

k a(k)φ(2t − k) (dilation equation)

◮ c and d are related as CQF: B(z) = −z−(N−1)A(−z−1)

◮ Thus ψj,k (t) are a basis for L2(R) and the coefficients of f can begenerated through a FB

37/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 45: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

1D Multiresolution analysis

Decomposition

c0[k ]

c1[k ]

c2[k ]

c3[k ]

d1[k ]

d2[k ]

d3[k ]h1

h1

h1

h0

h0

h0

2 ↓

2 ↓

2 ↓

2 ↓

2 ↓

2 ↓

Three levels wavelet decomposition structure

38/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 46: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Multiresolution Analysis 1D

0 50 100 150 200 250 300 350 400 450 500-20

0

20

40

60

0 50 100 150 200 250 300 350 400 450 500

-200

20406080

0 50 100 150 200 250 300 350 400 450 500

-200

20406080

0 50 100 150 200 250 300 350 400 450 500

-50

0

50

100

150

c1[k ]

c2[k ]

d2[k ]

d2[k ]

d1[k ]

d1[k ]

d1[k ]

c3[k ] d3[k ]

x [k ] = c0[k ]

39/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 47: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Reconstruction

c0[k ]

c1[k ]

c2[k ]

c3[k ]

d1[k ]

d2[k ]

d3[k ]

f1

f1

f1f0

f0

f0

2 ↑

2 ↑

2 ↑

2 ↑

2 ↑

2 ↑

Reconstruction from wavelet coefficients

40/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 48: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

2D AMR

2D Filter banks for separable transform

One decomposition level

cj [n,m]

cj+1[n,m]

dH

j+1[n,m]

dV

j+1[n,m]

dD

j+1[n,m]

h0[k ]

h1[k ]

h0[ℓ]

h0[ℓ]

h1[ℓ]

h1[ℓ]

(2,1) ↓

(2,1) ↓

(1,2) ↓

(1,2) ↓

(1,2) ↓

(1,2) ↓

41/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 49: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

2D-DWT subbands: orientations

fver

fhor(A) (V)

(H) (D)

(A), (H), (V) and (D) respectively correspond to approximationcoefficients, horizontal, vertical and diagonal detail coefficients.

42/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 50: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

2D AMR: multiple levels

c0

c1

dH

1dV

1dD

1

c2

dH

2dV

2dD

2

c3

dH

3dV

3dD

3

Three levels of separable 2D-AMR.

43/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 51: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

2D-DWT subbands: orientations

fver

fhor

(A)

(V1)

(H1) (D1)

(V2)

(H2) (D2)

(V3)

(H3) (D3)

44/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 52: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Example

45/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 53: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Example

46/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 54: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Example

47/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 55: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Example

48/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 56: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Example

49/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 57: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Example

50/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 58: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

Filter banks and DWTMultiresolution analysis

Example

51/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 59: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Outline

Introduction

Discrete wavelet transform and multiresolution analysis

Images compression with waveletsEZWJPEG 2000

52/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 60: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Compression with DWT

◮ Methods based on inter-scale dependencies:

◮ EZW (Embedded Zerotrees of Wavelet coefficients),◮ SPIHT (Set Partitioning in Hierarchical Trees)◮ Tree-based representation of dependencies◮ Advantages: good exploitation of inter-scale dependencies,

low complexity◮ Disadvantage: no resolution scalability

◮ Methods not based on inter-scale dependencies

◮ Explicit bit-rate allocation among subbands◮ Entropy coding of coefficients◮ Advantages: Good exploitation of intra-scale dependencies,

random access, resolution scalability◮ Disadvantage: no exploitation of inter-scale dependencies

53/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 61: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Embedded Zerotrees of Wavelet coefficients

Main characteristics

◮ Quality scalability (i.e. progressive representation)

◮ Lossy-to-lossless coding

◮ Small complexity

◮ Rate-distortion performance much better than JPEG above allat small rates

54/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 62: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Progressive representation of DWTcoefficients

◮ Each new coding bit must convey the maximum ofinformation

m◮ Each new coding bit must reduce as much as possible

distortion◮ We first send the largest coefficients◮ Problem: localization overhead

55/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 63: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example: an image and its waveletcoefficients

LL HL

LH HH

ApproximationApproximation

Horizontal detailsHorizontal details

Vertical detailsVertical details

Diagonal detailsDiagonal details

DWT 2 further levels

56/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 64: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Progressive representation: subband order

57/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 65: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EZW Algorithm

◮ The subband scan order alone is not enough to assure thatlargest coefficients are sent first

◮ We need to localize the largest coefficients◮ Without having to send explicit localization information◮ Idea: to exploit the inter-band correlation to predict the

position of non-significant coefficients◮ If the prediction is correct we save many coding bits (for all

the predicted coefficients)

58/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 66: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Zero-tree of wavelet coefficients

59/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 67: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EZW idea

◮ Auto-similarity : When a coefficient is small (below a threshold)it is probable that its descendants are small as well

◮ In this case we use a single coding symbol to represent thecoefficient and all its descendants. If c and all its descendantsare smaller than the threshold, c is called a zero-tree root

◮ With just one symbol, (ZT) we code (1 + 4 + 42 + . . .+ 4N−n )coefficients

◮ The localization information is implicit in the significanceinformation

60/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 68: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EZW algorithm

1. k = 0

2. n = ⌊log2 (|c|max)⌋3. Tk = 2n

4. while (rate < available rate)◮ Dominant pass◮ Refining pass◮ Tk+1 ← Tk/2◮ k ← k + 1

5. end while

61/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 69: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Dominant pass

◮ For each coefficient c (in the scan order)

◮ If |c| ≥ Tn, the coefficient is significant

◮ If c > 0 we encode SP (Significant Positive)◮ If c < 0 we encode SN (Significant Negative)

◮ If |c| < Tn, we compare all its descendants with the threshold

◮ If no descendant is significant, c is coded as a zero-treeroot (ZT)

◮ Otherwise the coefficient is coded as Isolated Zero (IZ)

62/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 70: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Refining pass

◮ We encode a further bit for all significant coefficients◮ This is equivalent to halve the quantization step

63/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 71: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Iteration and termination

◮ The k-th dominant pass allows to encode the k-th bit-plane◮ A significant coefficient c is such that 2k ≤ |c| < 2k+1

◮ For the next step we halve the threshold: it is equivalent topass to the next bitplane

◮ Algorithm stops when◮ the bit budget is exhausted; or when◮ all the bitplanes have been coded

64/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 72: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EZW Algorithm: summary

◮ Bitplane coding: at the k-th pass, we encode the bitplanelog2 Tk

◮ Progressive coding: each new bitplane allows refining thecoefficients quantization

◮ Lossless coding of significance symbols◮ Lossless-to-lossy coding: When an integer transform is

used, and all the bitplanes are coded, the original imagecan be restored with zero distortion

65/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 73: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EZW Algorithm: Example

26 6 13 10-7 7 6 44 -4 4 -32 -2 -2 0

T0 = 2⌊log2 26⌋ = 16

66/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 74: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EZW Algorithm: Example

26 6 13 10-7 7 6 44 -4 4 -32 -2 -2 0

T0 = 2⌊log2 26⌋ = 16

Bitstream:SP ZR ZR ZR 1IZ ZR ZR ZR SP SP IZ IZ 0 1 0SP SN SP SP SP SP SN IZ IZ SP IZ IZ IZ

66/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 75: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

JPEG2000

◮ JPEG2000 aims at challenges unresolved by previous standards:

◮ Low bit-rate coding: JPEG has low quality for R < 0.25 bpp

◮ Synthetic images compression

◮ Random access to image parts

◮ Quality and resolution scalability

67/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 76: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

New functionalities

◮ Region-of-interest (ROI) coding◮ Quality and resolution scalability◮ Tiling◮ Exact coding rate◮ Lossy-to-lossless coding

68/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 77: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Algorithm

JPEG2000 is made up of two tiers◮ First tier

◮ DWT and quantization◮ Lossless coding of codeblocks

◮ Second tier◮ EBCOT: embedded block coding with optimized truncation◮ Scalability (quality, resolution) and ROI management

69/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 78: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Quantization in JPEG2000

◮ DWT coefficients are encoded with a very fine quantizationstep

◮ For the lossless coding case, DWT coefficients areintegers, and they are not quantified

◮ In summary, it is not in the quantization step that the reallylossy operations are performed

◮ The lossy coding is performed by the bitstream truncationof Tier 2

70/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 79: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EBCOT

Embedded Block Coding with Optimized Truncation◮ Each subband is split in equally sized blocks of

coefficients, called codeblocks◮ The codeblocks are losslessly and independently coded

with an arithmetic coder◮ We generate as much bitstreams as codeblocks in the

image

71/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 80: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Bitplane coding

Most significant bitplane

LL2 HL2

LH2 HH2

HL1

LH1 HH1

72/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 81: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Bitplane coding

Second bitplane

LL2 HL2

LH2 HH2

HL1

LH1 HH1

73/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 82: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Bitplane coding

Third bitplane

LL2 HL2

LH2 HH2

HL1

LH1 HH1

74/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 83: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Bitplane coding

Fourth bitplane

LL2 HL2

LH2 HH2

HL1

LH1 HH1

75/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 84: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Bitplane coding

Fifth bitplane

LL2 HL2

LH2 HH2

HL1

LH1 HH1

76/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 85: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example of bitstreams associated tocodeblocks

BP2

BP3

BP4

BP5

BP6

BP7

BP8

BP1

LL2 HL1LH2 HL2 HH2 HH1LH177/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 86: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EBCOTOptimization

◮ If we keep all the bitstreams of all the codeblocks, we endup with a huge bitrate

◮ We have to truncate the bitstream to attain the targetbit-rate

◮ Problem: how to truncate the bitstreams with a minimumresulting distortion?

min∑

i

Di subject to∑

i

Ri ≤ Rtot

◮ Solution : Lagrange multiplier

J =∑

i

Di + λ

(∑

i

Ri −R

)

78/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 87: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EBCOTRate-distortion curve per each codeblock

79/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 88: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EBCOTRate-distortion curve per each codeblock

79/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 89: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

EBCOT

Embedded block coding with optimized truncation

◮ Optimal truncation point:

∂Di

∂Ri= −λ

◮ The value of the Lagrange multiplier can be find by aniterative algorithm.

◮ We can have several truncations for several target rates(quality scalability)

80/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 90: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example of bit-rate allocation with EBCOTAllocation for maximal quality and minimal resolution

BP2

BP3

BP4

BP5

BP6

BP7

BP8

BP1

LL2 HL1LH2 HL2 HH2 HH1LH1

81/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 91: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example of bit-rate allocation with EBCOTAllocation for maximal quality and medium resolution

BP2

BP3

BP4

BP5

BP6

BP7

BP8

BP1

LL2 HL1LH2 HL2 HH2 HH1LH1

82/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 92: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example of bit-rate allocation with EBCOTAllocation for maximal quality and maximal resolution

BP2

BP3

BP4

BP5

BP6

BP7

BP8

BP1

LL2 HL1LH2 HL2 HH2 HH1LH1

83/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 93: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example of bit-rate allocation with EBCOTAllocation for perceptual quality and maximal resolution

BP2

BP3

BP4

BP5

BP6

BP7

BP8

BP1

LL2 HL1LH2 HL2 HH2 HH1LH1

84/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 94: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example of bit-rate allocation with EBCOTAllocation for a given bit-rate, maximal quality and resolution

BP2

BP3

BP4

BP5

BP6

BP7

BP8

BP1

LL2 HL1LH2 HL2 HH2 HH1LH1

85/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 95: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Example of bit-rate allocation with EBCOTAllocation pour several layers and maximal resolution

BP2

BP3

BP4

BP5

BP6

BP7

BP8

BP1

LL2 HL1LH2 HL2 HH2 HH1LH1

86/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 96: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

JPEGComparison JPEG / JPEG2000

Image Originale, 24 bpp

87/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 97: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Comparison JPEG / JPEG2000

Rate: 1bpp

88/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 98: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Comparison JPEG / JPEG2000

Rate: 0.75bpp

89/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 99: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Comparison JPEG / JPEG2000

Rate: 0.5bpp

90/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 100: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Comparison JPEG / JPEG2000

Rate: 0.3bpp

91/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 101: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Comparison JPEG / JPEG2000

Rate: 0.2bpp

92/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 102: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Comparison JPEG / JPEG2000

Rate: 0.2bpp pour JPEG, 0.1 pour JPEG2000

93/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 103: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Error effect: JPEG

JPEG, pE = 10−4 JPEG, pE = 10−4

94/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 104: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Error effect: JPEG and JPEG 2000

JPEG, pE = 10−4 JPEG 2000, pE = 10−4

95/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 105: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Error effect: JPEG and JPEG 2000

JPEG, pE = 10−3 JPEG 2000, pE = 10−3

96/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 106: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Image coding and robustness

◮ Markers insertion◮ Markers period◮ Marker emulation prevention◮ Trade-off between robustness and rate

97/98 07.12.20 Une école de l’IMT Wavelet-based image compression

Page 107: Wavelet-based image compression

IntroductionDWT and MRA

Images compression with wavelets

EZWJPEG 2000

Error robustness in JPEG2000

◮ Data priorization is possible◮ No dependency among codeblocks

◮ No error propagation◮ No block-based transform

◮ No blocking artifacts

98/98 07.12.20 Une école de l’IMT Wavelet-based image compression