Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
IMAGE COMPRESSION
by
Paresh Kamble
Introduction
Image Compression: It is the Art & Science of
reducing the amount of data required to
represent an image.
It is the most useful and commercially successful
technologies in the field of Digital Image
Processing.
The number of images compressed and
decompressed daily is innumerable.
Introduction
To understand the need for compact image
representation, consider the amount of data
required to represent a 2 hour Standard Definition
(SD) using 720 x 480 x 24 bit pixel arrays.
A video is a sequence of video frames where each
frame is a full color still image.
Because video player must display the frames
sequentially at rates near 30fps, SD video data
must be accessed at
30fps x (720x480)ppf x 3bpp = 31,104,000 bps
fps frames per second,
ppf pixels per frame,
Introduction
Thus a 2 hour movie consists of
31,104,000 bps x (602) sph x 2 hrs
2.24 x 1011
bytes.
OR
224GB of data
sph = second per hour
Twenty seven 8.5GB dual layer DVDs are needed
to store it.
To put a 2hr movie on a single DVD, each frame
must be compressed by a factor of around 26.3.
The compression must be even higher for HD,
where image resolution reach 1920 x 1080 x 24
Introduction
Web page images & High-resolution digital
camera photos also are also compressed to save
storage space & reduce transmission time.
Residential Internet connection delivers data at
speeds ranging from 56kbps (conventional phone
line) to more than 12mbps (broadband).
Time required to transmit a small 128 x 128 x 24
bit full color image over this range of speed is
from 7.0 to 0.03 sec.
Compression can reduce the transmission time by
a factor of around 2 to 10 or more.
Similarly, number of uncompressed full color
images that an 8 Megapixel digital camera can
store on a 1GB Memory card can be increased.
Introduction
Along with these applications , image
compression plays an important role in many
other areas including:
Fundamentals
Data Compression: It refers to the process of
reducing the amount of data required to
represent a given quantity of information.
Data
Vs
Information
Data and Information are not the same thing;
data are the means by which information is
conveyed.
Because various amount of data can be used to
Fundamentals
Fundamentals
Let b & b denote the number of bits in two
representations of the same information, the
relative data redundancy R of the representation
with b bits is
R = 1 (1/C);
where, C commonly called the compression
ratio, is defined as
C = b / b
If C = 10 (or 10:1), for larger representation has
10 bits of data for every 1 bit of data in smaller
representation.
So, R = 0.9, indicating that 90% of its data is
redundant.
Fundamentals
2D intensity arrays suffers from 3 principal types
of data redundancies:
1) Coding redundancy: A code is a system of
symbols used to represent a body of information
or sets of events.
Each piece of event is assigned a code word
(code symbol). The number of symbols in each
code word is its length.
The 8-bit codes that are used to represent the
intensities in most 2D intensity arrays contain
more bits than are needed to represent the
intensities.
Fundamentals
2) Spatial & Temporal redundancy:
Because the pixels of most 2D intensity arrays are
correlated spatially, information is replicated
unnecessarily.
In video sequence, temporally correlated pixels
also duplicate information.
3) Irrelevant Information:
Most 2D intensity arrays contain information that
is ignored by the human visual system. It is
redundant in the sense that it is not used.
Fundamentals
1) Coding Redundancy:
) Assume a discrete random variable rk in interval
[0 L-1] is used to represent the intensities of an
M x N image.
) Also the each rk occurs with probability pr (rk).
) pr(rk) = nk / MN
k = 0, 1, 2, .L-1
----(a)
) Where, L is no. of intensity values &
nk is no. of times kth intensity appears in the
image.
If no. of bits used to represent each value of rk is
l(rk), then avg no of bits required to represent
each pixel is
L-1
Fundamentals
rk
l2(rk)
r87 = 87
2
r128 = 128
1
r186 = 186
pr(rk)
code 1
l1(rk)
0.25
01010111
01
0.47
10000000
0.25
11000100
code 2
000
Fundamentals
With respect to the above table, If a natural 8-bit
binary code is used to represent its 4 possible
intensities, Lavg = 8, coz l1(rk) = 8 bits for all rk.
On the other hand, If code 2 scheme is used, the avg
length of encoded pixels is,
Lavg = 0.25(2) + 0.47(1) + 0.25(3) + 0.03(3) = 1.81
bits.
Total no. of bits rqd to represent entire image = MNL avg
= 256 x 256 x 1.81 = 118,621
Resulting compression
C = 256 x 256 x 8 / 118,621 = 8 / 1.81 4.42
Relative redundancy
R = 1 1/4.42 = 0.774
Thus, 77.4% of data in original 8-bit 2D intensity array
is redundant.
Fidelity Criteria
Fidelity Criteria:
Removal of irrelevant visual information involves a
loss of real or quantitative image information.
N-1
Fidelity Criteria
RMS error is given by
M-1
N-1
f(x, y)2
SNRrms =
x=0 y = 0
M-1 N-1
Fidelity Criteria
Subjective fidelity criteria:
A Decompressed image is presented to a cross
section of viewers and averaging their evaluations.
Mapper
Quantize
r
Symbol
coder
Symbol
Decode
r
Inverse
Mapper
It is reversible.
Original Source
Symbol Probability
a2
a6
a1
a4
a3
a5
0.4
0.3
0.1
0.1
0.06
0.04
Source reduction
1
2
0.4
0.3
0.1
0.1
0.1
0.4
0.3
0.2
0.1
3
0.4
0.3
0.3
4
0.6
0.4
Source reduction
2
3
0.4
0.4 1
0.4 1
0.3
00
0.3 00
0.3 00 0.3 00
0.1
0.1
0.06
0.04
0.4 1
011
0.1 011 0.2 010 0.3 01
0100
0.1 0100 0.1 011
01010 0.1 0101
01011
It is uniquely decodable.
Coz any string of code symbols can be decoded
by examining individual symbols of string from
left to right.
Ex. 010100111100
It is uniquely decodable.
Coz any string of code symbols can be decoded by
examining individual symbols of string from left to
right.
Source
Symbol
Probability
Initial
Subinterval
a1
0.2
[0.0, 0.2)
a2
0.2
[0.2, 0.4)
a3
0.4
[0.4, 0.8)
a4
0.2
[0.8, 1.0)
0.2
a3
a3
0.08
a4
0.072
0.0688
a4
a4
a4
a4
a3
a3
a3
a3
a2
a2
a2
a2
a1
a1
a1
a1
a4
a3
a2
a1
0
0.04
0.056
0.0624
0.2
a3
a3
0.08
a4
0.072
0.0688
a4
a4
a4
a4
a3
a3
a3
a3
a2
a2
a2
a2
a1
a1
a1
a1
a4
a3
a2
a1
0
0.04
0.056
0.0624
0.2
a3
a3
0.08
a4
0.072
0.0688
a4
a4
a4
a4
a3
a3
a3
a3
a2
a2
a2
a2
a1
a1
a1
a1
a4
a3
a2
a1
0
0.04
0.056
0.0624
0.2
a3
a3
0.08
a4
0.072
0.0688
a4
a4
a4
a4
a3
a3
a3
a3
a2
a2
a2
a2
a1
a1
a1
a1
a4
a3
a2
a1
0
0.04
0.056
0.0624
0.2
a3
a3
0.08
a4
0.072
0.0688
a4
a4
a4
a4
a3
a3
a3
a3
a2
a2
a2
a2
a1
a1
a1
a1
a4
a3
a2
a1
0
0.04
0.056
0.0624
0.2
0.08
a3
a4
0.072
0.0688
a4
a4
a4
a4
a3
a3
a3
a3
a2
a2
a2
a2
a1
a1
a1
a1
a4
a3
a2
a1
0
0.04
0.056
0.0624
255
256
.
511
.
.
255
.
-
Pixel Being
Processed
39
39
126
126
39
39
126
126
39
39
126
126
39
39
126
126
Encoded
Output
Dictionary
Location
Dictionary
Entry
39
39
126
126
256
257
258
259
39-39
39-126
126-126
126-39
256
260
39-39-126
258
260
259
257
126
261
262
263
264
126-126-39
39-39-126126-39-39
39-126-126
Disadvantage:
i=1