Image Processing: Image Compression
Image Processing: Image Compression
Image Processing:
Image Compression (2)
Image transformation represent the image as coefficients of a set of
basis functions
in the KLT case the basis functions are chosen in order to
decorrelate pixel values
they are dependent of the image and must be encoded together
Transform based compression with the coefficients !
Wavelet based compression for other global transforms (Fourrier, Walsh, Hadamard, ...), the set
Haar Transform of basis functions is fixed
Diadic Transfom the decorrelation is less performant
Compression of color images but the basis functions need not to be encoded !
Illustration of JPEG Compression
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
Mathematicaly, the continuous wavelet transform (CWT) is defined by The Haar wavelet can also be described as a step function
+∞
1 1 ⎛t − τ⎞
γ ( τ, σ) = x(t ) ∫
σ
ψ σ, τ (t ) dt ψ σ, τ (t ) = ψ⎜
σ ⎝ σ ⎠
⎟ ⎧ 1 0 ≤ x < 12
⎪
−∞ ψ ( x) = ⎨− 1 12 ≤ x < 1
where τ represents translation and σ a scale factor of the mother ⎪ 0 otherwise
wavelet ψ(τ) ⎩
Haar transforms can be understood as a combination of Haar wavelets
Then, the original function can be reconstructed using the inverse with different scale and shift parameters
transform
+∞ +∞ +∞ 2
1 ⎛ t − τ ⎞ dσ Ψ (ζ )
x (t ) = ∫∫
Cψ − ∞ − ∞
γ ( τ, σ)ψ⎜
⎝ σ ⎠ σ
⎟ dτ 2 Cψ = ∫
−∞
ζ
dζ
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
The Haar transform can be expressed as a combination of the The Haar Transform can be computed stepwise as follows
following basic functions separate odd samples and even samples
one step function compute their sum (mean value) and (half of) their differences
⎧1 0 ≤ t < 1 sn −1,l = ( sn, 2l + sn , 2l +1 ) / 2
φ(t ) = ⎨
⎩0 otherwise
d n −1,l = ( sn, 2l +1 − sn , 2l ) / 2
and several Haar wavelets at the end, keep the last sum and all differences
ψ ij (t ) = ψ ( 2 j t − i ) Example : the Haar transform of [8,4,9,7] is [7,-1,2,1]
[ 8 4 9 7 ]
[ 6 8 ] [ 2 1 ]
[ 7 ] [ -1 ]
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
Haar Transform in 2D space Illustration of the Haar Transform
The standard Haar The wavelet transform has many zero or near zero values !
decomposition in 2D space is
obtained by computing
a 1D Haar transform on each
row
then a 1D Haar transform on
each column
(or conversely)
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
Simple entropy coding of Haar wavelets can be used for loss-free Original Lena picture and its result of Haar based compression
compression removing 7/8 and 15/16 of coefficients
Lossy compression is obtained by
ordering coefficients according to their power
removing less significant coefficients
quantizing the other coefficients
applying entropy coding
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
A more efficient representation The resulting transform contains multi-resolution square subimages
for entropy coding can be
achieved by using a slightly
modified 2D Haar Transform
alternation between rows and
columns are applied within
each decomposition steps
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
Optimal coefficient encoding uses the Color image compression could be done bank-wise
quadtree structure of multi-resolution not very efficient because it ignores color correlation
subimages KLT transforms in RGB space can be used to decorrelate color
Various encoding schemes have been information
proposed Other methods work in "physiological" color spaces :
EZW (embedded zerotree wavelet) using different sampling
SPIHT (set partitioning in using different quantization steps
hierchical trees)
for luminance and chrominance
WDR (wavelet difference
reduction)
...
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
Schema of JPEG compression DCT basis functions
⎧⎪ 1
u=0
with α (u ) = ⎨
N
⎪⎩ 2
N
u>0
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
------------------------------ ------------------------------
16 11 10 16 24 40 51 61 17 18 24 47 99 99 99 99
12 12 14 19 26 58 60 55 18 21 26 66 99 99 99 99
14 13 16 24 40 57 69 56 24 26 56 99 99 99 99 99
14 17 22 29 51 87 80 62 47 66 99 99 99 99 99 99
18 22 37 56 68 109 103 77 99 99 99 99 99 99 99 99
24 35 55 64 81 104 113 92 99 99 99 99 99 99 99 99
49 64 78 87 103 121 120 101 99 99 99 99 99 99 99 99
72 92 95 98 112 100 103 99 99 99 99 99 99 99 99 99
------------------------------ ------------------------------
© 2004 Rolf Ingold, University of Fribourg © 2004 Rolf Ingold, University of Fribourg
JPEG Encoding