Hilbert Space Geometry in Wavelet Image Compression Algorithms

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 70

Hilbert Space Geometry in

Wavelet Image Compression


Algorithms
Myung-Sin Song
Southern Illinois University
Edwardsville
Overview
.

Input Forward wavelet Thresholding Entropy encoding Compressed


Image transform Image

Compressed Reconstruct wavelet Inverse wavelet Reconstructed


Image transformed image transform Image

Figure 1: A diagram demonstrating the steps in wavelet based image compression and reconstruction.
Wavelets
For each n, k  Z , define  n ,k ( x) by
 n ,k ( x)  2 n / 2  (2 n x  k )

constructing the function  (x ) , L2 on R, such that { n ,k ( x)}n ,kZ is an orthonormal basis


on R. As shown below  (x) is a wavelet and the collection { n ,k ( x)}n ,kZ is a wavelet
orthonomal basis on R. This framework for constructing wavelets involves the concept of
a multiresolution analysis or MRA.
Multiresolution Analysis
Multiresolution analysis is defined as follows:
Define Vn  { f ( x) | f ( x)  2 n / 2 g (2 n ), g ( x)  V0 } ,
where f ( x)    f ,  ( x  n)   ( x  n).
nZ

Then a multiresolution analysis on R is a sequence of subspaces {Vn }nZ of functions L2 on


R, satisfying the following properties.
(a) For all n, k  Z , Vn  Vn 1 .
(b) If f (x) is C c0 on R, then f ( x)  span{Vn }nZ . That is, given   0 , there is an n  Z and
a function g ( x)  Vn such that || f  g || 2   .
(c)  nZ
Vn  {0} .
(d) A function f ( x)  V0 if and only if 2 n / 2 f (2 n x)  Vn .
(e) There exists a function  (x) , L2 on R, called the scaling function such that the
collection { ( x  n)} is an orthonormal system of translates and V0  span{ ( x  n)} .
MRA (cont’d)

Now, then let {Vn } be an MRA with scaling function  (x) and scaling filter h(k ) ,
x
where h(k )  2 1 / 2  ( ),  ( x  k )  .
2
Then the wavelet filter g (k ) is defined by
g (k )  (1) k h(1  k )
and the wavelet by
 ( x)   g (k ) 2 (2 x  k ) .
kZ

Then { n ,k ( x)} n ,kZ is a wavelet orthonormal basis of R.


Approximation and Detail
Operators
The orthogonal projection of an arbitrary function f  L2 onto Vn is given by
Pn f    f ,  n,k   n,k
kZ

Pn f is called an approximation to f at resolution 2  n .


An MRA provides a sequence of approximations Pn f of increasing accuracy to a given
function f.
The difference between the approximations at resolution 2  n and 2 n 1 is called the fine
detail at resolution 2  n :
Qn f ( x)  Pn 1 f ( x)  Pn f ( x)
Qn is also an orthogonal projection and its range Wn is orthogonal to Vn .
Approximation and Detail Spaces
Vn  Wn  Vn1 .
Vn  { f | Pn f  f }
Wn  { f | Qn f  f }
  V1  V0  { f | f  V1 , f  V0 }  W0
Qn f  
kZ
f , n , k   n , k
Transformations

L2 ( R)  L2 (T )  l 2 ( Z )
How Wavelets Work

Image taken from


http://www.mathworks.com/access/helpdesk/help/toolbox/wavelet/wavelet.s
html
Wavelet Decomposition

Image taken from


http://www.mathworks.com/access/helpdesk/help/toolbox/wavelet/w
avelet.shtml
Orthogonal Wavelets
• The orthogonality makes them energy or
norm preserving.
• They are not symmetric in general.
• Their filter has self-duality only.
Daubechies Wavelet
The pair H, G is called an orthogonal quadrature filter pair and the following conditions
hold:

Self-duality: H’H* = G’G* = I


Independence: GH* = HG* = 0 (2.1)
Exact reconstruction: H*H + G*G = I
Normalization: H1 = √21

H is the low-pass filter and G is the high-pass filter.

The first two conditions may be expressed in terms of the filter sequences h, g which
respectively define H, G:
 k h(k )h(k  2n)   (n)   k g (k ) g (k  2n) (2.2)
 k g ( k ) h( k  2n)  0   k h( k ) g ( k  2n)
Discrete Wavelet Transform
(Orthogonal Wavelet)
Assume that we have function s  Vn
s ( x )   sn , k n , k ( x ) ,
k

Represented by its coefficient vector s n . We decompose s into its components in Vn 1 ,


Wn 1 :

s  Pn 1 s  Qn 1 s

Lemma:
 n 1, j , n ,k  hk  2, j ,
 n 1, j , n ,k  g k  2, j
Discrete Wavelet Transform
(Orthogonal Wavelet) (cont’d)
• Algorithm:
The original signal is s  {s }. n n ,k

The decomposition is done as follows:


sn 1, j   hk  2, j sn ,k d n 1, j   g k  2, j sn , k
k
k

The decomposition signal consist of two pieces


s
n 1d n 1

The reconstruction is done as follows:


sn ,k   [hk  2, j sn 1, j  g k  2, j d n 1, j ].
j
Discrete Wavelet Transform
(Orthogonal Wavelet) (cont’d)
If a is a sequence { , a 1 , a 0 , a1 ,} , a() denotes the reversed sequence
{ , a1 , a 0 , a 1 , } .

The notation ( 2)a denotes the sequence downsampled by 2:


(( 2)a ) k  a 2 k .

The notation ( 2)a denotes the sequence upsampled by 2:


(( 2)a ) 2 k  a k ,
(( 2)a) 2 k 1  0 .
Discrete Wavelet Transform
(Orthogonal Wavelet) (cont’d)
There are two discrete convolutions involved in the decomposition step, namely
( h( )  sn ) j   h( j  k ) sn , k ,
k

( g (  )  sn ) j   g  ( j  k ) s n , k ,
k
which are followed by downsampling:
sn 1  ( 2)( h( ) * sn ) ,
d n 1  ( 2)( g () * sn ) .
Then the reconstruction step consists of upsampling, followed by two convolutions,
namely,
sn  h * ( 2) sn 1  g * ( 2)d n 1 .
Discrete Wavelet Transform
(Orthogonal Wavelet) (cont’d)

Doing this over several levels would give us


s n  s n1 , d n1
s n1  s n2 , d n2

sl 1  sl , d l
Wavelet Decomposition
(Orthogonal Wavelet)
The decomposition and reconstruction steps can be interpreted as infinite matrix vector
products. The decomposition step is as follows:

         
    s 
 s    h h h h 
n 1, 1 1 0 1 2  n , 1 
 sn 1, 0       h1 h0 h1 h2   sn , 0 
    
s
 n 1,1        h1 h0 h1 h2  s
 n ,1 
  
        

and similarly for the d-coefficients.


When we interleave the s- and d-coefficients:
       
s   
    h h h h 
n  1, 1 1 0 1 2   
 d n 1, 1    g 1 g 0 g1 g 2   s 
s      h h0 h1 h2   n , 1 
 n 1, 0
 1
 sn , 0 
 d n 1, 0      g 1 g 0 g1 g 2   
 sn 1,1       h1 h0 h1 h2   sn ,1 
     
 d n 1,1       g 1 g 0 g1 g 2  
    
       
Biorthogonal Wavelets
• Have bases with weaker definition compared to
the bases of orthogonal wavelet bases.
• Their filter has duality as opposed to self-duality
in orthogonal wavelets.
• Not energy preserving.
• The main advantage of the biorthogonal wavelet
transform is that it permits the use of a much
broader class of filters, and this class includes
the symmetric filters.
Biorthogonal Wavelets (cont’d)
• Symmetric wavelet transform solves the
problems of coefficient expansion and
border discontinuities.
Biorthogonal Wavelets (cont’d)
H, H’, G and G’ are called the biorthogonal set of quadrature filters, if the filters satisfy
the following conditions:

Duality: H’H* = G’G* = I = HH’* = GG’*


Independence: G’H* = H’G* = 0 = GH’* = HG’* (2.3)
Exact reconstruction: H*H’ + G*G’ = I = H’*H + G’*G
Normalization: H1 = H’1 = √21 and G1 = G’1 = 0

H and H’ are the low-pass filter and G and G’ are the high-pass filter.
Biorthogonal Wavelets (cont’d)
The first two conditions may be expressed in terms of the filter sequences h, h’, g, g’
which respectively define H, H’, G, G’:
 k h' ( k ) h( k  2n)   ( n)   k g ' ( k ) g ( k  2n)
 k g ' ( k ) h( k  2n)  0   k h' ( k ) g ( k  2n)

Notice the difference in (2.1) and (2.3) that self-duality no longer holds in (2.3) and the
conditions are weakened.
 h( k )  2 ;
k
 g (2k )   g (2k  1) ;
k k

 h' ( k ) 
k
2;  g ' (2k )   g ' (2k  1) .
k k
Having four operators gives plenty of freedom to construct filters with special properties,
such as symmetry.
Discrete Wavelet Transform
(Biorthogonal Wavelet)
Assume that we have function s  Vn
s( x)   sn*, kn ,k ( x) ,
k

Represented by its coefficient vector s n . We decompose s into its components in Vn 1 ,


Wn 1 :

s  Pn 1 s  Qn 1 s

Lemma:
~
 n 1, j , n ,k  hk  2, j ,
 n 1, j ,~n , k  g k  2, j ,
~ ~
 n 1, j , n ,k  hk  2, j ,
 ~ ,   g~
n 1, j n,k k  2, j
Discrete Wavelet Transform
(Biorthogonal Wavelet) (cont’d)
• Algorithm:
The original signal is sn  {snk }.
The decomposition is done as follows:
~ g~
s  h s
n 1, j
d
k  2 j nk
s n 1, j k 2 j nk
k
k

The decomposition signal consist of two pieces


s
n 1d n 1

The reconstruction is done as follows:


~
snk   [hk* 2 j sn 1, j  g~k* 2 j d n 1, j ].
j
Discrete Wavelet Transform
(Biorthogonal Wavelet) (cont’d)
There are two discrete convolutions involved in the decomposition step, namely
~ ~
(h ()  sn ) j   h( j  k ) sn, k ,
k

( g~ ()  sn ) j   g~( j  k ) sn ,k ,
k
which are followed by downsampling:
~
s n 1  ( 2)( h () * s n ) ,
d  ( 2)( g~ () * s ) .
n 1 n
Then the reconstruction step consists of upsampling, followed by two convolutions,
namely,
sn  h* * ( 2) sn 1  g * * ( 2)d n 1 .
Discrete Wavelet Transform
(Biorthogonal Wavelet) (cont’d)

Doing this over several levels would give us


s n  s n1 , d n1
s n1  s n2 , d n2

sl 1  sl , d l
Wavelet Decomposition
(Biorthogonal Wavelet)
The decomposition and reconstruction steps can be interpreted as infinite matrix vector
products. The decomposition step is as follows:

         
   ~ ~ ~ ~  
 s n 1, 1    h1 h0 h1 h2   s n , 1 
~ ~ ~ ~
 s n 1, 0       h1 h0 h1 h2   s n , 0 
   ~ ~ ~ ~  
s
 n 1,1        h 1 h 0 h1 h2  s
 n ,1 
         
    

and similarly for the d-coefficients.


When we interleave the s- and d-coefficients:
      
~ ~ ~ ~


s   h h h h 
 n  1, 1   1 0 1 2 
 d n 1, 1    g ~ ~
g g~ g ~    
s
1
     h~
0 1
~ 2 ~ ~  s n , 1 
 n 1, 0
   1 h 0 h1 h 2
  s 
 d n 1, 0      g ~ ~
g g~ g ~   n , 0 
1
 s n 1,1       h~  s
0 1
~ 2 ~ ~
   1 h0 h1 h2   n ,1 
~ ~ ~ ~   
 d n 1,1       g g g g2  
    1 0 1

       
Mathematical View of an Image
• A gray-scaled image can be viewed as the
following matrix, consisting functions as
entries:
 f 1,1 f 2 ,1  f M ,1 
 
 f 1, 2 f 2, 2  f M ,2 
f 
    
 
 f 1, N f 2, N  f M , N 

Image Matrix
Image Matrices
 fR1,1 fR 2 ,1  fR M ,1 
 
 fR1, 2 fR 2 , 2  fR M , 2 
fR  
    
 
 f 1f,R11, N ffR22 ,,1  f  ,1
fR M , N M 
 
N  
 f1,f2 ff2, 2  fG M ,1 f M, 2 
f  f
G1,1 G 2 ,1 


f  
G1, 2 f
G 2, 2 
  
fG M , 2
G

 f  
ff2 , N

f M, N 

 fG M , N
 1,fN G1, N G 2, N 

 fB1,1 fB 2 ,1  fB M ,1 
 
 fB1, 2 fB 2 , 2  fB M , 2 
fB  
    
 
 fB fB 2 , N  fB M , N 
 1, N 
Wavelets on Images
• A discrete image can be viewed as a
single column consisting of M signals
having length N,  f  M

 
f  
f
 2
f 
 1

with rows being the signals:


f M  ( f 1,M , f 2, M , , f N , M ) ….. f 2  ( f1, 2 , f 2, 2 ,, f N , 2 ) f1  ( f 1,1 , f 2,1 ,, f N ,1 )
Implementation
• Color Conversion 1
Applying the compression to the RGB components of
the image would result in undesirable color changes.
• The image is transformed into its intensity, hue and
color saturation components.
• The color transformation used in JPEG 2000 standard
[2] has been adopted. For the lossy compression,
equations (1) and (2) were used in the program.

1 A. Skodras, C. Christopoulos, and T. Ebrahimi, “ JPEG 200 Still Image Compression Standard,”
IEEE Signal Processing Magazine, vol. 18, pp. 36-58, Sept,

33
Implementation (cont’d)

Y   0.299 0.587 0.114   R   R  1.0 0 1.402  Y 


Cb    0.16875  0.33126 0.5  G  G   1.0 0.34413  0.71414 Cb 
   (1)      (2)
Cr   0.5  0.41869  0.08131  B   B  1.0 1.772 0  Cr 

In the case of lossless compression equations (3) and (4) were used.

  R  2G  b    Ur  Vr  
Yr    4 
   Yr   4  
G
Vr   
R  G (3)  R    Vr  G 
   
    (4)
Ur   BG 
   B   Ur  G 
   
 
1-level Wavelet Decomposition
• A 1-level wavelet transform of an NxM image can be represented
as
a | h 
1 1 a 1
 V m
1
 V 1
n h 1
 V 1
m  W n
1

  a 1
  ( x , y )   ( x ) ( y ) h 1
  H
( x, y )   ( x) ( y)
f  
 v1 | d1  v1  Wm1  Vn1 d 1  Wm1  Wn1

v1   V ( x, y )   ( x) ( y ) d 1   D ( x, y )   ( x) ( y )
where the subimages h1, d1, a1, and v1 each have the dimension
of N/2 by M/2.
a1 : first averaged image, which consists of average intensity
values of the original image.
v1 : the first detail image of vertical components.
h1 : the first detail image of horizontal components.
d1 : the first detail image of diagonal components.
1-level Wavelet Decomposition
(cont’d)
a 1   ( x, y )   ( x) ( y )   hi h j (2 x  i) (2 y  j )  Vm1  Vn1
i j

h1   H ( x, y )   ( x) ( y )   g i h j (2 x  i ) (2 y  j ) Wm1  Vn1


i j

v1   V ( x, y )   ( x) ( y )   hi g j (2 x  i ) (2 y  j ) Vm1  Wn1


i j

d 1   D ( x, y)   ( x) ( y)   g i g j (2 x  i) (2 y  j )  Wm1  Wn1


i j
Operator Notation
Operator Notation (cont’d)
• Vn and W can also be define as
n
Vn  S 0 en and Wn  S1en
where en  (0,...0,1,0,...0).
• The operations between two different spaces
can be compared as follows:
The Whole Process ( ( ))
L2

Perfect reconstruction (Operator Notation): S 0 S 0*  S1 S1*  I


2
Filter Diagram (l )
( )
Octagon

ch1
ca1
H1H
1

cv1 cd1
Octagon
Wavelet Decomposition
Wavelet Decomposition
Wavelet Decomposition
Test Image
Wavelet Decomposition
Wavelet Decompostion
Strange Circle

ca1 ch1
H 1

cv1 cd1

Image taken from : http://www.cs.ucla.edu/~klinger/circle.jpg


Thresholding
• Soft threshold was used in this project in the hope that
the drastic differences in gradient in the image would be
noted less apparently. The soft and hard thresholdings
Tsoft, Thard are defined as follows:
Tsoft (x) = 
0 if | x |  T hard (x) = 0 if | x | 
 
 x   if x
 x   if  x if | x | 
 x  

where     . As it could be observed by looking at the definitions, the


difference between them is related to how the coefficients larger than a
threshold value in absolute values are handled. In hard thresholding, these
coefficient values are left alone. Unlike in hard thresholding, the coefficient
values area decreased by if positive and increased by if negative.
Entropy Encoding
• Entropy - a quantity that measures the
amount of uncertainty in a probability
distribution.
- a statistical measure of randomness that
can be used to characterize the texture of
the input image.
• Entropy is defined as
q
E ( s )   P ( si ) log 2 ( P( si ))
i 1
Compact Support
• It is effective for locating jump
discontinuities and also for the efficient
representation of signals with small
support.
• The fact that they have jump
discontinuities, may result in blockiness in
reconstructed images.
Symmetry
• Symmetric filters are good for minimizing
the edge effects in the wavelet
representation of discrete wavelet
transform (DWT) of a function.
• Large coefficients resulting from false
edges due to periodization can be
avoided.
Vanishing Moments
Vanishing Moments are defined as follows:

From the definition MRA, any wavelet  (x) that comes from an MRA must satisfy
  ( x)dx  0

(*).
The integral (*) is referred to as the zeroth moment of  (x)

 If (*) holds, we say that  (x) has its zeroth moment vanishing.

 The integral 
x k ( x) dx is referred to as the kth moment of  (x) .
 If  x k ( x)dx  0 , we say that  (x ) has its kth moment vanishing.

Vanishing Moments
• Artifacts such as wave-shaped
irregularities in the reconstructed image
could occur with the number of vanishing
moments.
• Results in lots of zero values for the
wavelet coefficients, which leads to
efficient coding.
Size of Filters
• Long analysis filters
- greater computation time for the wavelet
transform.
- can create unpleasant artifacts in the
compressed image .
Lena
lena.png

Image taken from http://www.lenna.org


Results(thr=10)
Daubechies wavelet (db1) Coiflet(coif1)

Biorthogonal Wavelet(bior1.1) Symlet(sym2)


Results(thr=20)
Original Daubechies wavelet (db1) Coiflet(coif1)

Biorthogonal Wavelet(bior1.1) Symlet(sym2)


Results (cont’d)
• In order to support the claims made by comparison of the resulting
images and the theoretical knowledge that we obtained from the
texts, some numerical comparisons are made. They are the
compression ratio, the root mean square error, rms, the relative two
norm difference, D, and the peak signal to noise ratio, PNSR. The
formulas used are as follows:

1
ratio = X * Y * 3  ( L2 norm _ re cov ery _ in % * X * Y * 3 / 100)
X *Y * 3

n1  j 1 i1
3 Y X
rms =
( f i , j , n  g i , j , n ) 2

X *Y * 3
Results (cont’d)
n1  j 1 i1
3 Y X
( f i , j , n  gi , j , n ) 2

D=

  
Y X 2
n 1 j 1 i 1
f i, j, n

255
PSNR  20  log
rms
Thr=10
Results(cont’d)
Thr=20
Wavelet ratio rms D PSNR Wavelet ratio rms D PSNR
Coif1 37.0173 6.3527 0.0450 32.0716 Coif1 93.0199 8.3876 0.0594 29.6580
Coif3 26.8321 6.1489 0.0436 32.3549 Coif3 51.7268 8.0346 0.0569 30.0316
Coif5 17.9320 6.1404 0.0435 32.3669 Coif5 30.4181 8.0154 0.0568 30.0523
bior1.1 34.2627 6.8373 0.0484 31.4331 bior1.1 95.8129 9.1988 0.0652 28.8562
bior2.2 30.2723 6.0565 0.0429 32.4863 bior2.2 73.2145 7.7818 0.0551 30.3092
bior5.5 43.9978 6.8879 0.0488 31.3691 bior5.5 104.6662 9.3134 0.0660 28.7487
sym2 38.4340 6.3633 0.0451 32.0571 sym2 100.6590 8.3909 0.0594 29.6546
sym5 34.3523 6.1740 0.0437 32.3195 sym5 76.9412 8.0751 0.0572 29.9878
sym8 28.2633 6.1511 0.0436 32.3518 sym8 56.9009 8.0363 0.0569 30.0296
db1 34.2627 6.8373 0.0484 31.4331 db1 95.8129 9.1988 0.0652 28.8562
db2 38.4340 6.3633 0.0451 32.0571 db2 100.6590 8.3909 0.0594 29.6546
db3 38.2236 6.2446 0.0442 32.2208 db3 94.7768 8.1916 0.0580 29.8635
References
[1] Ingrid Daubechies, Ten Lectures on Wavelets, SIAM, 1992.
[2] R.C. Gonzalez, R.E. Woods and S. L. Eddins, Digital Image Processing
Using MATLAB, . Prentice Hall, 2004.
[3] A. Skodras, C. Christopoulos, and T. Ebrahimi, “JPEG 2000 Still Image
Compression Standard,” IEEE Signal Processing Magazine, vol. 18, pp. 36-
58, Sept, 2001.
[4] James S. Walker, A Primer on Wavelets and their Scientific Applications,
Chapman Hall, CRC, 1999.
[5] David F. Walnut, An Introduction to Wavelet Analysis, Birkhäuser, 2002.
[6]MATLAB Wavelet Toolkit User Guide
http://www.mathworks.com/access/helpdesk/help/pdf_doc/wavelet/wavelet_
ug.pdf

[7] Fritz Keinert, Wavelets and Multiwavelets, Chapman & Hall/CRC, 2004.
[8] Myung-Sin Song, “Wavelet Image Compression”, Proceedings of the 2005
Symposium on Great Plains Operator Theory, AMS Contemporary
Mathematics book series
Daubechies Wavelet
• Daubechies wavelets are compactly-
supported, orthogonal wavelets which are
energy or norm preserving.
• It has moment-vanishing condition.
Haar Wavelet
• The Haar wavelet can be described as a step
function f(x) with
Haar Wavelet (cont’d)
• A discrete signal is expressed in the form
f   f 1, f 2,......, fN 

• The l-level Haar transform H1 of discrete signal f


is defined as
a | d1 
H1
1
f

a1  (a1 , a 2 ,....., a N / 2 )

d1  (d1 , d 2 ,....., d N / 2 )
Haar Wavelet (cont’d)
• The l-level Haar transform H1 of discrete signal f
is defined as

• The fluctuation subsignal, also known as the


running difference is computed as
Inverse Haar Transform
• The inverse of the Haar transform is
computed in the following manner:
 a1  d1 a1  d1 a N/ 2  d N/ 2 a N/ 2  d N/ 2 
f  , , , , 
 2 2 2 2 
Haar Wavelet (cont’d)
• The 1-level Haar wavelets are defined as
 1 1   1 1   1 1 
W11   , ,0,0, ,0  , W21   0,0, , ,0,0, ,0  ,…….., WN/1 2   0,0, ,0, , 
 2 2   2 2   2 2

• and the corresponding 1-level Haar


scaling signals are defined as
 1 1   1 1   1 1 
V11   , ,0,0,  ,0  , V21   0,0, , ,0,0,  ,0  ,…….., VN/1 2   0,0,  ,0, , 
 2 2   2 2   2 2

a m  f  Vm1 for m  1,2,  , N / 2

d m  f  Wm1 for m  1,2,  , N / 2

You might also like