You are on page 1of 7

An Improved Approach For Image Compression

During Transmission
Author - C Shravani Rao
GITAM UNIVERSITY
shravanirao@live.com
Co-Author - C Srujana
SLC’s institute of engineering and technology
Srujana.chintal@gmail.com

Abstract— Image compression techniques play an important role An image is two dimensional function, f(x,y), where x and y
in image processing. While transmitting an image we have to are spatial coordinates, and the amplitude of f at any pair of
reduce the size of the image in order to decrease the time needed coordinates (x,y) is called the intensity or grey level of the
to transmit the image. There are several compression techniques
image at that point. Image is a spatial representation of an
to shrink image like Huffman coding and truncated Huffman
coding. The compression method suggested in this article is based
object or a scene. (Image of a person, place, object). An image
on “pairing up of more than two least probabilities” compression has the following ways of representation.
technique with the utility of Dynamic Huffman coding. Proposed a) Binary (Bitonal) Image:
method is more effective than normal dynamic Huffman method These images have two possible values of pixel intensities:
because it reduced the average no of bits by 11.8-27.2 % or even
black and white. Also called 1-bit monochrome image, since
more depending on the size of sample. The purpose of this
technique is very impressive for images. it contains only black and white. Typical applications of
bitonal images include office/business documents,
handwritten text, line graphics, engineering graphics etc. The
Keywords— Image processing, image compression, Huffman scanned output contains a sequence of black or white pixels.
coding Binary 1 represents a black pixel and binary 0 represents a
white pixel.
1. Introduction b) Grayscale Image
In electrical engineering and computer science, image They contain several shades of grey. Typical applications
processing is any form of signal processing for which the of grayscale images include newspaper photographs (non-
input is an image, such as photographs or frames of video; the color), magnetic resonance images and cat-scans. An
output of image processing can be either an image or a set of uncompressed grayscale image can be represented by n bits
characteristics or parameters related to the image. Most per pixel, so the number of gray levels supported will be 2 n.
image-processing techniques involve treating the image as a For example, 8-bit Grayscale Image. It consists of 256 gray
two-dimensional signal and applying standard signal- levels. A dark pixel might have a pixel value of 0, a bright one
processing techniques to it. might be 255
c) Color Image
The field of digital image processing refers to processing
of digital images by means of digital computer. Fundamental They are characterized by the intensity of three primary
colors (RGB). For example, 24-bit image or 24 bits per pixel.
steps of digital image processing
There are 16,777,216 (224) possible colors. In other words, 8
1. Image Acquisition bits for R(Red), 8 bits for G(Green), 8 bits for B(Blue). Since
2. Image Enhancement each value is in the range 0-255, this format supports 256 x
3. Image Restoration 256 x 256 or 16,777,216 different colors.
4. Image Analysis d) RGBA / 32-bit images
5. Image Reconstruction An important point: many 24-bit color images are actually
6. Image Compression stored as 32-bit images, with the extra byte of data for each.
This article will present a a brief introduction to image Allows RGBA color scheme; Red, Green, Blue, Alpha. Pixel
compression, its techniques.Towards the end of the paper a used to store an alpha value representing the degree of
technique of image compression would be proposed which “transparency”.
would supplement techniques like Huffman coding by
reducing the size further. 2. Introduction to Image Compression
Image compression address the problem of reducing the
1.1 Image types and representations amount of data required to represent a digital image with no
significant loss of information. Interest in image compression
dates back more than 25 years. The field is now poised nc; bits or bytes are typically used. When nc<<n1, CR has got
significant growth through the practical application of the large values and Larger values of CR indicate better
theoretic work that began in 1940s, when C.E. Shannon and compression.
others first formulated the probabilistic view of information
2.1 A general algorithm for data compression and
and its representation, transmission and compression. The
goal of image compression is to reduce the amount of data image reconstruction
required to represent a digital image. i.e., remove redundant
data from the image

Fig 2 Image construction and re-construction

An input image is fed into the encoder which creates a set of


Fig 1. Basic model for image compression symbols from the input data. After transmission over the
channel, the encoded representation is fed to the decoder,
• Images take a lot of storage space where a reconstructed output image f’(x,y) is generated . In
1024 x 1024 x 32 x bits images requires 4 MB. Suppose you general, f’(x,y) may or may not an exact replica of f(x,y). If it
have some video that is 640 x 480 x 24 bits x 30 frames per is, the system is error free or information preserving, if not,
second, 1 minute of video would require 1.54 GB. Many bytes some level of distortion is present in the reconstructed image.
take a long time to transfer in slow connections – suppose we 2.1.1 Data compression model
have 56,000 bps, 4MB will take almost 10 minutes and 1.54
GB will take almost 66 hours. Storage problems, plus the A data compression system mainly consists of three major
desire to exchange images over the Internet, have lead to a steps
large interest in image compression algorithms. 1. Removal or reduction in data redundancy
• The same information can be represented many ways:
Data are the means by which information is conveyed. 2. Reduction in entropy
Various amounts of data can be used to convey the same 3. Entropy encoding.
amount of information. Example: Four different
representation of the same information ( number five) 1) a
picture ( 1001,632 bits ); 2) a word “five” spelled in English
using the ASCII character set ( 32 bits); 3) a single ASCII
digit ( 8bits); 4) binary integer ( 3bits)
• Compression algorithms remove redundancy

If more data are used than is strictly necessary, then we say


that there is redundancy in the dataset. Data redundancy is not
abstract concept but a mathematically quantifiable entity. If
n1 and nc denote the number of information carrying units in
two data sets that represent the same information, the relative
data redundancy RD of the first data set ( n1 ) can be defined
as RD= 1 – 1/CR (1).
Where CR is compression ratio, defined as
CR = n1/nc (2). Fig 3. Data compression model
Where n1 is the number of information carrying units used in
the uncompressed dataset and nc is the number of units in the
compressed dataset. The same units should be used for n1 and
2.1.2 Reduction in Data Redundancy – A statistically significant number of observers are
randomly chosen to evaluate visual quality of the
Removal or reduction in data redundancy is typically achieved
reconstructed images.
by transforming the original data from one form or
representation to another. Popular transformation techniques – Each observer assigns a numeric score to each
are reconstructed image based on his or her perception of
quality of the image, say within a range 1–5 to describe
1. Discrete Cosine Transform (DCT)
the quality of the image—5 being the highest quality and
2. Discrete Wavelet Transformation (DWT) etc 1 being the worst quality.
This step leads to the reduction of entropy for Lossless – MOS is the average of these scores
compression this transformation is completely reversible.
Common quality metrics are
2.1.3. Reduction in Entropy
i. root-mean-squared error (RMSE)
• Non reversible process
• Achieved by dropping insignificant information in
ii. signal-to-noise ratio (SNR)
the transformed data (Lossy!!!) iii. peak signal-to-noise ratio (PSNR).
• Done by some quantization techniques If I is an M × N image and I is the corresponding
• Amount of quantization dictates the quality of the reconstructed image after compression and decompression,
reconstructed data RMSE is calculated by
• Entropy of the quantized data is less compared to the
original one, hence more compression.
2.2 Compression Performance
The performance measures of data compression
algorithms can be looked at from different perspectives The SNR in decibel unit (dB) is expressed as
depending on the application requirements
a) Amount of compression achieved
b) Objective and subjective quality of the reconstructed data
c) Relative complexity of the algorithm
d) Speed of execution, etc.
Compression ratio : the ratio of the number of bits to
represent the original data to the number of bits to represent
the compressed data. Achievable compression ratio using a 2.2.2. Coding Delay and Complexity
lossless compression scheme is totally input data dependent.
Coding delay, a performance measure for compression
Sources with less redundancy have more entropy and hence
algorithms where interactive encoding and decoding is the
are more difficult to achieve compression.
requirement (e.g., interactive video teleconferencing, on-line
Higher compression rates will produce lower quality
image browsing, real-time voice communication, etc.). The
images and smaller file sizes. Lower compression will
complexity the compression algorithm increases coding delay.
preserve image quality and has a larger file size.
Compression system designer often use a less sophisticated
When an image has been compressed too many times, or
algorithm for the compression system.
with a high compression ratio, the image may become
pixelated. That's because the pixel data is trashed and when Coding complexity, a performance measure considered where
the image is reopened, the computer fills in the missing data the computational requirement to implement the codec is an
by borrowing from neighboring pixels. important criteria. MOPS (millions of operations per second),
It's usually best to choose a compression ratio that is MIPS (millions of instructions per second) are often used to
somewhere in the middle. Make sure to save the image as a measure the compression performance in a specific computing
copy rather than writing over the original, that way if you engine's architecture.
don't like the results, you can go back to the original file and
try different compression settings.
2.2.1. Subjective Quality Metric
MOS: mean observers score or mean opinion score is a
common measure
3. Image Compression Models 3.1. Image compression approaches
Compression can be done using one of two formats, either
lossless, or lossy. Lossless files, like TIFF, BMP and PNG
formats retain their data, while lossy files , like JPG, lose
data.

a) Lossless methods :
• Are Information preserving
• Have Low compression ratios

b) Lossy methods:
• Does not preserve information
• Have High compression ratios

3.1.1Classification of Lossless Methods

Fig 4 Overall compression model

Fig 5. Encoder model

• Mapper: transforms the input data into a format that


facilitates reduction of inter-pixel redundancies.
• Quantizer: reduces the accuracy of the mapper’s output in Fig 7. Classification of Lossless methods

accordance with some pre-established fidelity criteria.


• Symbol encoder: assigns the shortest code to the most
frequently occurring output values.

Fig 8. A Lossless compression method

Lossless algorithms remove only redundancy present in the


data. The reconstructed image is identical to the original, i.e.,
all of the information present in the input image has been
Fig 6 Decoder model preserved by compression.
The inverse operations are performed, Quantization is
irreversible in general.
4. Huffman Coding
It is a variable-length encoding algorithm that is based on
the source symbol patterns. It is Optimum for codes that
3.1.2 Classification of Lossy Methods prefix free. It is an optimal code because it minimizes the
number of code symbols per source symbol. It uses the
backward pass algorithm because it assigns code symbols
going backwards

Fig 12. Huffman coding

4.1. What is L-avg using Huffman coding?

Fig 9 Classification of lossy methods

Higher compression is possible using lossy algorithms


which create redundancy (by discarding some information)
and then remove it. Transform the image into a domain where 4.2. Algorithm
compression can be performed more efficiently. Note that the 1. Pair up the two symbols with the lowest probability.
transformation itself does not compress the image! 2. These two symbols represent a new symbol.
3. Repeating pairing with the new symbol in place of the
pair.
4. Each pairing represents a pair of branches from a node in
a tree.
5. Assign a 0 or 1 to each branch in the tree.
6. Concatenate the each branch symbol to get the coded
symbol.
4.3. A Simple Example
• Alphabet = {1, 2, 3, 4, 5}
• Probabilities = {.35, .3, .2, .1, .05}
Fig 10. Lossy Compressor
• Uncoded = 3 bits per symbol
• Entropy = 2.06 bits per symbol
• Huffman average code length = 2.15 bits

Fig 11 Lossy De-compressor


5.1. Algorithm
1. Check whether the number of samples A is divisible by
pairing up number or not. If yes continue, otherwise
remove the least probabilities to make it divisible.
Fig 13. A simple example 2. Pair up the three or four symbols depending on your
choice with the lowest probability
4.4. Comments 3. These paired up symbols represent a new symbol
– After the code has been created, coding/decoding can be 4. Repeating pairing with the new symbol in place of the
implemented using a look-up table. pair
– Decoding can be done in an unambiguous way!! 5. Each pairing represents a pair of branches from a node in
a tree
6. Assign a 0 or 1 or 00 to each branch in the tree
4.5. Run-length coding
Code each contiguous group of 0’s and 1’s, encountered in a
left to right scan of a row, by its length.
7. Conclusion
We have presented an improvised technique for Dynamic
Huffman in which we can send data in even lesser bits. All the
success of this technique lies at the decoding part where a new
way of decoding, even for more than 2 bits left made us get
through this idea. The reduction in average number of bits
varies with number of samples taken. For example, in the test
e.g., (0,1)(1,1)(0,1)(1,0)(0,2)(1,4)(0,2) samples as we’ve taken 6 bits sample, the no of bits reduced is
Additional compression can be achieved by encoding the 11.8 whereas for 16 bits sample it is approximately 27.2.So as
lengths of the runs using variable-length coding. the samples size increases it is showing to be more effective.

5. Proposed Algorithm 8. Future Scope


This Algorithm we describe her depends on ‘A’ in H(A).
In the dynamic Huffman algorithm we Combine only the In Huffman, as well as in our improvised technique there
least two probabilities and while decoding we assign 0 or 1 to may exist some redundancy still and it is inevitable in such
each branch in the tree. methods. It can be checked through CRC or any other
In our new algorithm, the number of samples we are redundancy removal techniques. But this extra headache
taking i.e A must be divisible by pairing up number .That is, if consumes some more time or extra effort. So the first most
we are pairing up 3 least probabilities and A=16 then we must important future scope is eliminating redundancy in the
remove or ignore the least probability (as removing least method itself. And we were already in half the way of
probability doesn’t make a significant difference to our developing a new technique without any redundancy at all.
entropy) and make it 15 such that it is divisible by 3.While
decoding we assign 0,1,00 to each branch in the tree. If
pairing is done as a combination of 4 least probabilities then
assign 0, 1, 00, 01 to each.
9. Bibliography
[1] Miano, John. Compression Image File Formats. New
York: New York, 1999
[2] Lecture Notes from John Villasenor prepared for EE211A
taught at UCLA Department of Electrical Engineering in
Here Lavg is given by, Henry Samueli School of Engineering.
[3] Chapter 1 of Digital Compression for Multimedia:
Principles & Standards by Jerry D.Gibson.
[4] Dr.Muhammad Younis Javed and Mr.Abid
Nadeem,”Data Compression Through Huffman
Coding”,IEEE 2000, Vol 2, pp.187-190.
[5] Huffman D.A “A method for construction of minimum
redundancy codes[j]”,Proc IRE,1952,40(9).
[6] Ben Chaen’s “Huffman Coding method based on Number
Character”,6th National Conference ,Hong Kong,19-22
August 2007.

You might also like