You are on page 1of 21

FAST IMAGE COMPRESSION USING DIC

ALGORITHM
(EMBEDDED ZEROTREE WAVELET TRANSFORM)
Presented By
P.Anandakrishnan.
&
K.Arun.
INSTITUTE OF ROAD AND TRANSPORT TECHNOLOGY
ERODE-638316
Contact Address:
K.Arun
Pre-Final Yr, ECE
IRTT, Vasavi College Post,
Erode-638316.
E-Mail Address:
ABSTRACT
This paper aims at providing an efficient solution for image compression
technique using Embedded Zerotree wavelet coding. The quality of compression lies
only in the selection of wavelet filter and the decomposition level. The Embedded
Zerotree Wavelet comprises of both the quantization and encoding. As both the
processes are carried out in short time the reliability in compressing an image will be
high by Fast Image Compression Technique. Since the truncation of the redundant
data there is no any notable difference between the original image and synthesized image.
This algorithm is not much complex and the memory required to implement the
algorithm is not very high. With a strong mathematical background and quantitative
analysis, it provides a promising method DIC algorithm, which would enable efficient
compression in the growing trends. The compression using this algorithm can compress
32 bit data (16 million colors) and can give compression ratios of approximately 20:1
without any noticeable image distortion or even 100:1, but with some image distortion.
The above said algorithm has been simulated and implemented for the verification in the
platforms of MATLAB and C.
INTRODUCTION:
Everyday, an enormous amount of information is stored, processed
and transmitted digitally. Because much of this information is graphical or pictorial in
nature the storage and communications requirements are immense. For example in order
to digitally represent 1 second of video without compression (using CCIR 601 format ),
we need more than 20 megabytes, or 160 megabits. Therefore methods of compressing
the data prior to storage or transmission are of significant practical and commercial
interest. Data compression are used to reduce the number of bits required to represent an
image. In brief, data compression is the art or science of representing information in a
compact form. The concept of image compression reduces the burden of much storage
space, large transmission bandwidths and long transmission times. Therefore, it is
advantageous to compress the image by storing only the essential number of applications
depend on the efficient manipulation, storage, and transmission of binary, graysacle, and
colour images. Ours is a DIC Algorithm which works well on all form of pictures.
Need for compression:
An Image may be defined as a two dimensional function, f(x,y),
where x and y are special Co-ordinates and the amplitude of f at any pair of co-ordinates
(x, y) are called the Intensity of the image at that point. When x, y and the amplitude
values of f are all finite, discrete quantities we call the image a digital image .the digital
image can be represented as a matrix consisting of N rows and M columns. Since image
occupies much storage space and long transmission time, the only way currently to
improve on these resource requirements to compress images, such that they can be
transmitted quicker. Image compression address the problem of reducing the amount of
data required to represent a digital image. The underlying basis of the reduction process
is the removal of a redundant data. Redundancy reduction is aimed at removing
duplication in the image. By removing the redundant data the image can be compressed
in a smaller number of bits and hence can be compressed. From the mathematical
viewpoint, this amount to transform a 2-D pixel array into an uncorrelated data set. Then
the compressed image is decompressed to reconstruct the original image or an
approximation of it.
compression Techniques:
Compression techniques fall in two categories:
1) Information preserving.
2) Lossy.
Lossless compression:
They are particularly useful in image archiving. These methods allow
an image to be compressed and decompressed without losing information.
Lossy compression:
They provide higher level of data reduction but result in a less than perfect
reproduction of the original image. They are useful in applications such as broadcast
television, video conferencing and
facsimile transmission, in which a certain amount of error is an acceptable trade-off for
increased compression performance performance.
Coding:
There are two types of coding, one is predictive coding and the other one is transform
coding. When compared to predictive coding, the transform coding is more efficient.
Transform coding on the other hand, first transforms the image from its spatial domain
representation to a different type of represented using some well-known transform and
then code the transformed values (coefficients). For most natural images significant
number of co-efficient has small magnitudes and can be discarded entirely with little
image distortion.
Fundamentals of compression:
In most cases the data provide either no relevant information or simply
restate that which is already known, then it is said to contain data redundancy and it plays
a vital role in image compression. If n1 and n2 denote the number of information
carrying units in two data set that represents the same information, the relative data
redundancy RD of the first data set can be defined as
RD = 1-(1/CR),
Where CR commonly called Compression ratio is
CR = n1/n2
We have three cases
Case1: For the first case n2=n1, CR=1, RD=0 indicating that first representation of the
information contains no redundant data.
Case2: When n2<<n1, CR-> and RD->1, implying significant compression and
highly redundant data.
Case3: Finally when n2>>n1, CR->0 and RD-> indicating that second data set
contains much more data
Than the original representation.
Data redundancy:
In digital image compression, there are three basic redundancies can be
identified and exploited:
Coding redundancy:
If the gray levels of an image are coded in a way that use more code symbols
than absolutely necessary to represent each gray level, the resulting image is said to
contain coding redundancy.
Interpixel redundancy:
The difference between adjacent pixels can also be used to represent the
image and this is called interpixel redundancy. Because much of the visual construction
of a single pixel to an image is redundant; it could have been guessed on the basis of the
values of its neighbors.
Psycho visual redundancy:
Certain information simply has less relative importance than other
information in normal visual processing and this information is said to be psycho visual
redundancy. It can be eliminated without significantly impairing the quality of image
perception.
Why do we go for transforms?
Often signals we wish to process are process are in the time-domain, but in
order to process them more easily other information, such as frequency is required.
Mathematical transforms translate the information of signals into different
representations. The signals are operated on this domain and this domain and then return
to the original domain without losing any information.
A signal can be analyzed in many ways. The way which is best suited depends on the
type of transform involved. Let us see an overview each analysis.
Fourier analysis:
Signal anlysts already have at their disposal an impressive arsenal of tools.
Perhaps the most well-known of these is Fourier analysis, which breaks down signal
into constituent sinusoids of different frequencies. Another way to think of Fourier
analysis is as a mathematical technique for transforming our view of the signal from
time-based to frequency-based. Since Fourier transform are useful in providing good
frequency information, it is used widely. But while transforming in Fourier transform, we
will loose time information. This is the main drawback of using this transform. The
reason is that we cannot know when these frequencies occur, so they are not much useful
when both time and frequency information is required simultaneously.
Short-Time Fourier Analysis:



t
ft j
X
dt e t t w t x f t STFT
2 * ) (
)] ' ( ) ( [ ) , (
In an effort to correct this deficiency, Dennis Gabor (1946) adopted the
Fourier transform to analyze only a small section of the signal at a time a technique
called Windowing the signal. Gabors adoption, called the Short-Time Fourier
Transform (STFT), maps a signal into a two-dimensional function of time and
frequency. The STFT represents a sort of compromise between the time and frequency
based views of a signal.It gives some information about when and at what frequencies a
signal event occurs. But we can obtain the information with less precision. This is due to
the fact that the size of the window is fixed. There is only one enhancement in using this
transform (i-e) the frequency and time are easily mapped. If the window is very wide,
which makes the STFT approach the FT, we get very bad time resolution and very good
frequency resolution. If the window is very narrow we get very good time resolution and
very bad frequency resolution

Narrow window Wide window
Heisenbergs Uncertainty Principle:
According to Heisenbergs Uncertainty principle it is impossible to know
exactly what frequencies occur at what time, only range of frequencies can be found. This
means trying to gain more detailed frequency information causes the time information to
become less specific and vice versa. Therefore when using the STFT, there has to be a
sacrifice of either time or frequency information. Having a big window gives good
frequency resolution; small windows provide better time information, but poorer
frequency information.
Discrete Cosine transform:
DCT-based encoder can be thought of as an essentially compression of a
stream of 8x8 blocks of image samples. Each 8x8 block makes its way through each
processing step, and yields output in compressed form into
the data stream. For decompression the inverse DCT is carried out. The main
disadvantage of this transform is that the size of the window is not sizable.
Continuous wavelet transform:


,
_




dt
s
t
t x
s
s s CWT
x x


*
) (
| |
1
) , ( ) , (
In continuous wavelet transform we are going to take transform of the
continuous time signal. While transforming we will split it into number of fragments
called windows. The two main drawbacks for to why this transform is expelled out are:
1. Redundancy of the CWT.
2. For most of the functions there is no analytical solution.
Discrete wavelet transforms:
To reduce the computation a different strategy was discovered and it was
named as Discrete Wavelet Transform. It turns out, rather remarkably, that if we choose
scales and positions based on powers of two so called dyadic scales and positions
then our analysis will be much more efficient and just as accurate. This is achieved using
Discrete Wavelet Transform. This very practical filtering algorithm yields a Fast Wavelet
Transform.
Image compression techniques:
In order to compress an image, the decomposition level, the type of transform to
carry out compression and the type of filter used for taking transform are needed.
Selection of image:
An image of a Facet (256 x 256) is taken. Compression of that image is carried out
at the fore-coming steps. First the image is transformed to wavelet co-efficient by using
efficient filters. At the time of taking transform the decomposition level is more
important. The decomposition level only determines the quality of the image after
compression.
Decomposition:
Selection of wavelet:
Several different criteria can be used in selecting an optimal wavelet
function. The objective is to minimize reconstructed error variance and maximize signal
to noise ratio. In general optimal wavelet can be selected based on the energy
conservation properties in the approximation part of the wavelet co-efficient. Wavelets
with more vanishing moments provide better reconstruction quality. Haar wavelet is the
only wavelet which has more advantage over image compression. Hence haar wavelet is
chosen.
Fast wavelet transform implementation:
The DWT is implemented using a filter bank structure. The input sequence is
decomposed into two subsequences by passing it through a low pass filter and a high pass
filter and downsampling the output of the filter by 2. the low and high pass filters are half
band filters called the conjugate quadratic filters(CQF), related by
G[n]=(-1)n h[L-1-n]
Where g[n] is the LP filter and L is the filter length and is even. Thus the two
subsequences obtained belong to the LP and HP pass bands respectively. The filtering
increases the frequency resolution by 2 and the sub sampling reduces the time resolution
by 2. This process is iterated on the LP branch to obtain finer frequency resolution at
lower frequencies.
What wavelet actually does:
At first the wavelet transform is applied to the entire input image and its
coefficients are determined. Since image is a 2-D functions a two-dimensional scaling
function, (x , y), and three dimensional wavelets, h (x , y), v (x , y) and d (x ,
y) are required. Each is a product of a one-dimensional wavelets, and corresponding
wavelet . Excluding the product that produces one-dimensional results; the remaining
products produce the separable scaling function.
(x , y) = (x) (y)
h (x , y) = (x) (y)
v (x , y) = (x) (y)
d (x , y) = (x) (y)
These wavelets measure functional variations-intensity or gray-level
variation for images-along different directions: h measures variations along columns
(for example horizontal edges), v responds to variations along rows (like vertical edges)
and d corresponds to variation along diagonals.
The 2-D DWT can be implemented using digital filters and downsamplers. In
two dimensional case, We get three sets of detail coefficients the horizontal, vertical,
and diagonal details. The signal-scale filter can be Iterated (by typing the
approximation output to the input of another filter bank) to produce a P scale transform in
which scale j =J-1, J-2J-P. At first the image is inputted as W (J, m, n) input.
Convolving its rows with h (-n) And h (-n) and downsampling its columns, we get
two subimages whose horizontal resolutions are reduced by a factor of 2. The high pass
or detail component characterizes the images high frequency information with vertical
information. Both subimages are then filtered column-wise and down-sampled to yield
four quarter-size output subimages - W d , W h , W v and W d. these
subimages are inner products of f (x ,y) and the two-dimensional scaling and wavelet
functions followed downsampling by two in each dimension.
Decomposition level:
Scales and
filter bank
iteration
Approximation co-
efficient
image
Truncated co-
efficients
(%)
Reconstruction
error
(rms)
1
2
3
4
5
256 x 256
128 x 128
64 x 64
32 x 32
16 x 16
75
93
97
98
98
1.93
2.69
3.12
3.25
3.27
Another factor affecting wavelet coding computational complexity and
reconstruction error is the number of transform decomposition levels, since a p-scale fast
wavelet transform involves P filter bank iterations, the number of operations in the
computation of the forward and inverse transforms increases with the number of
decomposition levels.
Resulting decomposition level:
compressed image



The above figure shows the decomposition at level 1 with signal histogram.

The above figure shows the decomposition at level 2 with signal histogram.


The above figure shows the decomposition at level 3 with signal
histogram
Embedded Zero Tree Wavelet Coder:
It is a quantization and coding strategy that incorporates some characteristics
of the wavelet decomposition. The particular characteristic used by the EZW coder is that
there are wavelet co-efficients in different subbands that represent the same spatial
location in the image. If the decomposition is such that the size of the different subbands
is different, then a single co-efficient in the smaller subband may represent the same
spatial location as multiple co-efficients in the other subbands.
The EZW encoder is based on the two important observations:
1. Natural images in general have a low pass spectrum. When an image is wavelet
transformed the energy in the subbands decreases (low scale means high resolution), so
the wavelet co-efficients will, on average, be smaller in the higher subbands than in the
lower subbands. This shows that progressive encoding is a very natural choice for
compressing wavelet transformed images, since the higher subbands only add detail.
2. Large wavelet co-efficient are important than small wavelet co-efficients.
These two observations are exploited by encoding the wavelet co-efficients in decreasing
order, in several passes. For every pass a threshold is chosen against which all the
wavelet co-efficients are measured. If a wavelet co-efficient is larger than the threshold it
is encoded and removed from the image, if it is smaller it is left for the next pass. When
all the wavelet co-efficients have been visited the threshold is lowered and the image is
scanned again to add more detail the already encoded image. This process is repeated
until all the wavelet co-efficients have been encoded completely or another criterion has
satisfied.
Before we describe the EZW coder, we need to introduce some terminology.
Given a threshold t, if a given co-efficient has a magnitude greater than T, it is called a
significant co-efficient at level T.
If the magnitude of the co-efficient is less than T (it is significant), and all its
descendants have less than T, then the co-efficient is called a Zerotree root.
Finally, it might happen that the co-efficient itself is less than T but some of its
descendants have a value greater than T. such a co-efficient is called an isolated zero.
The EZW encoder is a multiple-pass encoder, with each pass consisting of two
pass significant map encoding or dominant pass, and refinement or subordinate pass.
If Cmax is the value of the largest co-efficient, the initial value of the threshold
To is given by
To=2[log2 cmax]
This selection guarantees that the largest co-efficient will lie in the interval [To ,
2To]. In each pass, the threshold Ti is reduced to half the value it had in the previous
pass:
Ti=(Ti-1)/2
For a given value of Ti, we assign one of four possible labels to the co-efficient:
Significant positive (sp), Significant negative (sn),
Zerotree root (zr), and isolated zero (iz).
The relation between wavelet coefficients in different subbands as quad-trees.


Image reconstruction:
In order to obtain the reconstructed image, there must be some way to reverse the process
or decompress the image back to its original state. This can be done using the inverse
wavelet transform. The equation for inverse wavelet transform is given below:




s
x
ds d
s
t
s
s
c
t x

2 2
1
) , (
1
) (
This inverse transform, however, is only valid if the admissibility condition holds true.
<

'

2 / 1
2
| |
| ) (

|
2

d c


original image
reconstructed image
There is no any notable difference between the original and reconstructed
image. Even if there is any slight change our human eyes cant diagnose that.
Fidelity criteria:
We can measure the closeness or fidelity of a reconstructed source to the original.
Since it is difficult to incorporate the human the human response into mathematical
design procedures, a natural thing to do when looking at the fidelity of a reconstructed
sequence is to look at the difference between the original and reconstructed values. Two
popular measures are available.
1. Squared error measure
2. Absolute difference measure
Mean square error:
In general, it is difficult to examine the difference on a term-by-term basis, a number
of average measures are used to summarize the information in the difference sequence.
This can be represented by MSE. It is given by 2= 1/N (x
n
-y
n
)2
The SNR is given by the ratio of average squared value of the source output and
the MSE lower the better, means lesser error.
SNR =
x
2/
y
2
The SNR is given by the ratio of average squared value of the source output and the
MSE.
Conservation and compaction of energy:
An important property of wavelet analysis is the compaction of energy. The
energy of the image is the sum of the squares of the pixel values, the energy in the
wavelet transform of an image is sum of the square of the transform coefficients. During
the wavelet analysis the energy the energy of the signal is divided between approximation
and details signals but the total energy doses not change. During compression however,
energy is lost .Because thresholding changes the coefficient values and hence the
compressed version contains less energy.
The compaction of energy describe how much energy has been compacted into
the approximation signal during wavelet analysis .compaction will occurs whenever the
magnitudes of the detail co-efficient are significantly smaller than those of the
approximation co-efficient. Compaction is important when compressing signals because
the more energy that has been compacted into the approximation signal the less energy
can be lost during compression.
Algorithm :
Below given are the steps taken for implementing the compression in MATLAB.
Start
Load the image
Digitize the image which is the array of values pixel (M x N)
Obtain the wavelet transform of the input image and the
approximation coefficient retains image.
Apply the EWZ coding to the wavelet coefficient and store the
result in a file which contains compressed form of image
Apply the reverse process, the compressed file is sent to the
EWZ encoder.
Then the inverse wavelet transform is applied to the output of
EWZ decoder and which is the decompressed form of image.


CONCLUSION:
Wavelet anlysis is a powerful and extremely useful for
compressing data. Its power comes from its multiresolution. Although many transforms
have been used, wavelet anlysis can be seen to be far superior, and in that it doesnt
create any artifacts. This is because the wavelet analysis is done on the entire image
rarher than sections at a time. DIC Algorithm provides an advanced standardization in
image coding system. It can be used in internet applications, mobile applications, digital
photography due to its high resolution, error resilence and low complexity. The main
objective of it is to improve the compression efficiency. This allows selected parts of an
image to be coded with higher quality(ROI coding). This algorithm is simulated using
Wavelet Toolbox in MATLAB and in C platform.
REFERENCES:
Raghuveer M.rao and Ajit S.bopardikar, wavelet transforms, Addison Welsey
Longman Inc.,2000.
Aboufadel, edward and Steven Schlicker. Discovering Wavelets, New york:
John Wilsey &
sons,1999.
S.Haykin communication Systems, John Wilsey & Sons, 2001
M.Misiti, Y.Misiti, G.Oppenheim and J.Poggi, Matlab Wavelet Tool Box, The
Math works
Inc.,2000
Aboufadel, Edward and Steven Schlicker. Discovering Wavelets. New York:
John Wiley & Sons, 1999.
Lepley, Margaret A., Adaptive Wavelet Image Compression. . September
1998. Polikar, Robi, The Engineers Ultimate Guide to Wavelet Analysis. Iowa
State University. 22 October 1998.

You might also like