# Connexions

You are here: Home » Content » Use of Laplacian PDFs in Image Compression

### Lenses

What is a lens?

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

#### In these lenses

• eScience, eResearch and Computational Problem Solving

This module is included inLens: eScience, eResearch and Computational Problem Solving
By: Jan E. OdegardAs a part of collection: "Image Coding"

Click the "eScience, eResearch and Computational Problem Solving" link to see all content selected in this lens.

### Recently Viewed

This feature requires Javascript to be enabled.

# Use of Laplacian PDFs in Image Compression

Module by: Nick Kingsbury. E-mail the author

Summary: This module introduces the use of Laplacian PDFs in image compression.

It is found to be appropriate and convenient to model the distribution of many types of transformed image coefficients by Laplacian distributions. It is appropriate because much real data is approximately modeled by the Laplacian probability density function (PDF), and it is convenient because the mathematical form of the Laplacian PDF is simple enough to allow some useful analytical results to be derived.

A Laplacian PDF is a back-to-back pair of exponential decays and is given by:

px=12 x0 e|x| x0 p x 1 2 x0 x x0
(1)
where x0 x0 is the equivalent of a time constant which defines the width of the PDF from the centre to the 1e 1 points. The initial scaling factor ensures that the area under px p x is unity, so that it is a valid PDF. Figure 1 shows the shape of px p x .

The mean of this PDF is zero and the variance is given by:

v x0 =x2pxdx=2x22 x0 ex x0 dx=2 x0 2 v x0 x x 2 p x 2 x x 2 2 x0 x x0 2 x0 2
(2)
(using integration by parts twice).

Hence the standard deviation is:

σ x0 =v x0 =2 x0 σ x0 v x0 2 x0
(3)
Given the variance (power) of a subimage of transformed pels, we may calculate x0 x0 and hence determine the PDF of the subimage, assuming a Laplacian shape. We now show that, if we quantise the subimage using a uniform quantiser with step size QQ, we can calculate the entropy of the quantised samples and thus estimate the bit rate needed to encode the subimage in bits/pel. This is a powerful analytical tool as it shows how the compressed bit rate relates directly to the energy of a subimage. The vertical dashed lines in Figure 1 show the decision thresholds for a typical quantiser for the case when Q=2 x0 Q 2 x0 .

First we analyse the probability of a pel being quantised to each step of the quantiser. This is given by the area under px p x between each adjacent pair of quantiser thresholds.

• Probability of being at step 0, p0 =Pr(12Q)<x<12Q=2Pr0<x<12Q p0 1 2 Q x 1 2 Q 2 0 x 1 2 Q
• Probability of being at step kk, pk =Pr(k12)Q<x<(k+12)Q pk k 1 2 Q x k 1 2 Q
First, for x2 x1 0 x2 x1 0 , we calculate: Pr x1 <x< x2 = x1 x2 pxdx=(12)ex x0 | x1 x2 =12(e x1 x0 e x2 x0 ) x1 x x2 x x1 x2 p x x1 x2 1 2 x x0 1 2 x1 x0 x2 x0 Therefore,
p0 =1eQ2 x0 p0 1 Q 2 x0
(4)
and, for k1 k 1 ,
pk =12(e(k12)Q x0 e(k+12)Q x0 )=sinhQ2 x0 ekQ x0 pk 1 2 k 1 2 Q x0 k 1 2 Q x0 Q 2 x0 k Q x0
(5)
By symmetry, if kk is nonzero, p - k = pk =sinhQ2 x0 e|k|Q x0 p - k pk Q 2 x0 k Q x0

Now we can calculate the entropy of the subimage:

H=k= pk log2 pk =(( p0 log2 p0 ))2k=1 pk log2 pk H k pk 2 pk p0 2 p0 2 k 1 pk 2 pk
(6)
To make the evaluation of the summation easier when we substitute for pk pk , we let pk =αrk pk α r k where α=sinhQ2 x0 α Q 2 x0 and r=eQ x0 r Q x0 . Therefore,
k=1 pk log2 pk =k=1αrklog2(αrk)=k=1αrk(log2α+klog2r)=αlog2αk=1rk+αlog2rk=1krk k 1 pk 2 pk k 1 α r k 2 α r k k 1 α r k 2 α k 2 r α 2 α k 1 r k α 2 r k 1 k r k
(7)
Now k=1rk=r1r k 1 r k r 1 r and, differentiating by rr: k=1krk1=11r2 k 1 k r k 1 1 1 r 2 . Therefore,
k=1 pk log2 pk =αlog2αr1r+αlog2rr1r2=αr1r(log2α+log2r1r) k 1 pk 2 pk α 2 α r 1 r α 2 r r 1 r 2 α r 1 r 2 α 2 r 1 r
(8)
and
p0 log2 p0 =(1r)log2(1r) p0 2 p0 1 r 2 1 r
(9)
Hence the entropy is given by:
H=(((1r)log2(1r)))2αr1r(log2α+log2r1r) H 1 r 2 1 r 2 α r 1 r 2 α 2 r 1 r
(10)
Because both αα and rr are functions of Q x0 Q x0 , then HH is a function of just Q x0 Q x0 too. We expect that, for constant QQ, as the energy of the subimage increases, the entropy will also increase approximately logarithmically, so we plot HH against x0 Q x0 Q in dB in Figure 2. This shows that our expectations are born out.

We can show this in theory by considering the case when x0 Q1 x0 Q 1 , when we find that: αQ2 x0 α Q 2 x0 r1Q x0 12α r 1 Q x0 1 2 α r1α r 1 α Using the approximation log2(1ε)εln2 2 1 ε ε 2 for small εε, it is then fairly straightforward to show that Hlog2α+1ln2log22e x0 Q H 2 α 1 2 2 2 x0 Q We denote this approximation as Ha Ha in Figure 2, which shows how close to HH the approximation is, for x0 >Q x0 Q (i.e. for x0 Q>0 x0 Q 0 dB).

We can compare the entropies calculated using Equation 10 with those that were calculated from the bandpass subimage histograms, as given in these figures describing Haar transform energies and entropies; level 1 energies, level 2 energies, level 3 energies, and level 4 energies. (The Lo-Lo subimages have PDFs which are more uniform and do not fit the Laplacian model well.) The values of x0 x0 are calculated from: x0 =std.  dev.2=subimage  energy2  (no  of  pels  in  subimage) x0 std.  dev. 2 subimage  energy 2  (no  of  pels  in  subimage) The following table shows this comparison:

Table 1
Transform level Subimage type Energy (× 106 10 6 ) No of pels x0 x0 Laplacian entropy Measured entropy
1 Hi-Lo 4.56 16384 11.80 2.16 1.71
1 Lo-Hi 1.89 16384 7.59 1.58 1.15
1 Hi-Hi 0.82 16384 5.09 1.08 0.80
2 Hi-Lo 7.64 4096 30.54 3.48 3.00
2 Lo-Hi 2.95 4096 18.98 2.81 2.22
2 Hi-Hi 1.42 4096 13.17 2.31 1.75
3 Hi-Lo 13.17 1024 80.19 4.86 4.52
3 Lo-Hi 3.90 1024 43.64 3.99 3.55
3 Hi-Hi 2.49 1024 34.87 3.67 3.05
4 Hi-Lo 15.49 256 173.9 5.98 5.65
4 Lo-Hi 6.46 256 112.3 5.35 4.75
4 Hi-Hi 3.29 256 80.2 4.86 4.38

We see that the entropies calculated from the energy via the Laplacian PDF method (second column from the right) are approximately 0.5 bit/pel greater than the entropies measured from the Lenna subimage histograms. This is due to the heavier tails of the actual PDFs compared with the Laplacian exponentially decreasing tails. More accurate entropies can be obtained if x0 x0 is obtained from the mean absolute values of the pels in each subimage. For a Laplacian PDF we can show that

Mean  absolute  value=|x|pxdx=20x2 x0 ex x0 dx= x0 Mean  absolute  value x x p x 2 x 0 x 2 x0 x x0 x0
(11)
This gives values of x0 x0 that are about 20% lower than those calculated from the energies and the calculated entropies are then within approximately 0.2 bit/pel of the measured entropies.

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks