Module 5-Img
Module 5-Img
Module 5
IMAGE COMPRESSION
Image compression is the art and science of reducing amount of data required to represent
an image. Image compression is used in many applications like televideo conferencing, remote
sensing, document and medical imaging, and facsimile transmission (FAX).
Fundamentals:
The data compression refers to the process of reducing the amount of data required to
represent a given quantity of information. Here data and information are not the same, data are
the mean by which information is conveyed and various amounts of data can be used to represent
the same amount of information. The data can have irrelevant or repeated information are called
redundant data.
If we let b and 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
C = b/b’
| |
2 IMAGE COMPRESSION Module 5
length. The 8-bit codes that are used to represent the intensities in most 2-D intensity
arrays contain more bits than are needed to represent the intensities.
2. Spatial and temporal redundancy: Because the pixels of most 2-D intensity arrays are
correlated specially,(i.e. each pixel is similar to or dependent on neighboring pixels
Information is unnecessarily replicated in the representations of the correlated pixels. In a
video sequence, temporally correlated pixels also duplicate information
3. Irrelevant information: Most 2-D intensity arrays contain information that is ignored by
human visual system and/or extraneous to the intended use of the image. It is redundant
in the sense that it is not used.
Coding Redundancy
Let us assume, that a discrete random variable rk in the interval [0,L-1] represent the gray
level of an M x N image and that each rk occurs with probabilities pr(rk):
Pr (rk) = nk / MN k=0,1,2,3…L-1.
Where L is the number of intensity values, and nk is the number of times that the kth intensity
appears in the image. If the number of bits used to represent each value of rk is l(rk), then the
average number of bits required to represent each pixel:
| |
3 IMAGE COMPRESSION Module 5
Interpixel redundancy
Interpixel redundancy is defined as failure to identify and utilize data relationships
If a pixel value can be reasonably predicted from its neighboring (or preceeding / following)
pixels the image is said to contain interpixel redundancy. Interpixel redundancy depends on the
resolution of the image The higher the (spatial) resolution of an image, the more probable it is
that two neighboring pixels will depict the same object. The higher the frame rate in a video
stream, the more probable it is that the corresponding pixel in the following frame will depict the
same object these types of predictions are made more difficult by the presence of noise
| |
4 IMAGE COMPRESSION Module 5
| |
5 IMAGE COMPRESSION Module 5
2. Code assignment: When only two symbols remain, retrace the steps in 1) and assign a
code bit to the symbols in each step. Encoding and decoding is done using these
codes in a lookup table manner
The average length of this code is: Lavg = (0.4)(1) + (0.3)(3) + (0.1)(4) + (0.06)(5) + (0.04)(5)
=2.2bits/pixels
Arithmetic coding
Provides a data representation where the entire symbol sequence is encoded as a single
arithmetic code word (which is represented as an interval of real numbers between 0 and 1)
Arithmetic code construction is done in 3 steps
1. Subdivide the half-open interval [0,1) based on the probabilities of the source symbols
| |
6 IMAGE COMPRESSION Module 5
2. For each source symbol recursively. Narrow the interval to the sub-interval designated by
the encoded symbol. Subdivide the new interval among the source symbols based on
probability
3. Append an end-of-message indicator. Encoding is done by choosing any number in the
interval to represent the data. Decoding is done by retracing the steps in the code
construction
| |
7 IMAGE COMPRESSION Module 5
size of the dictionary affects compression performance. Small dictionaries are less likely to
contain an encountered source symbol. Large dictionaries results in larger code words (lower
compression ratios)
Run-length coding
Provides a data representation where sequences of symbol values of the same value are
coded as “run-lengths”
• 1D – the image is treated as a row-by-row array of pixels
• 2D – blocks of pixels are viewed as source symbols
Input data 222222222226666666666666699999999999999999
| |
8 IMAGE COMPRESSION Module 5
Figure : BMP absolute coding mode options. In this mode, the first byte of the BMP pair is 0
Transform Coding
In transform coding a linear transform is used to map the image data into a set of
transform coefficients (which are then quantized and coded). For reasons of computational
complexity the image is subdivided into smaller subimages before the transformation
computation. The goal of the transformation process is to decorrelate (minimize the variance)
the pixels of the subimages as much as possible. This will result in a localization of the image
information in a minimal number of transform coefficients - the transformation coefficients with
little data can then be more coarsely quantized or eliminated. The better information compaction,
the better reconstruction approximations.
The following figure shows a typical block transform coding system. The decoder
implements the inverse sequence of steps of the encoder, which performs four relatively
straightforward operations: subimage decomposition, transformation, quantization, and coding.
M x N input image is subdivided first into subimages of size n X n, which are then transformed
to generate MN/n2 subimage transform arrays, each of size n X n. The quatization stage then
| |
9 IMAGE COMPRESSION Module 5
selectively eliminates or more coarsely quantizes the coefficients that carry the least amount of
information in a predefined sense. The encoding process terminates by coding the quantized
coefficients. Transformation coding can be
• Adaptive – each subimage is treated in an individual manner
• Non-adaptive – all subimages are treated in the same way
Bit allocation
The process of truncating, quantizing and coding the coefficients of the transformed
subimage is referred to as bit allocation. The reconstruction error in a decompressed image is a
function of
• The number of coefficients discarded
• The precision used to store the remaining coefficients
• The relative importance of these coefficients
| |
10 IMAGE COMPRESSION Module 5
| |
11 IMAGE COMPRESSION Module 5
Predictive coding
Provides a data representation where code words express source symbol deviations from
predicted values (usually values of neighboring pixels). Predictive coding efficiently reduces
interpixel redundancies
• 1D & 2D – pixels are predicted from neighboring pixels
• 3D – pixels are predicted between frames as well
Works well for all images with a high degree of interpixel redundancies. Works in the presence
of noise (just not as efficiently)
Input data 222222222226666666666666699999999999999999
Code 200000000004000000000000030000000000000000
Predictive coding can be used in both lossless and lossy compression schemes
| |
12 IMAGE COMPRESSION Module 5
The decoder shown in second part of the figure reconstruct e(n) from the received
variable-length code words and performs the inverse operation to decompress or recreate the
original input sequence.
| |
13 IMAGE COMPRESSION Module 5
Wavelet coding
Like transform coding, wavelet coding is based on the premise that using a linear
transform (here a wavelet transform) will result in transform coefficients that can be stored more
efficiently than the pixels themselves. Due to the facts that wavelets are computationally efficient
and that the wavelet basis functions are limited in duration, subdivision of the original image is
Unnecessary. Wavelet coding typically produces a more efficient compression than DCTbased
systems
• Objectively – the mean square error of wavelet-based reconstructions are typically
lower
• Subjectively - the blocking artifacts (characteristic of DCT-based systems at high
compression ratios) are not present in wavelet reconstructions
The choice of wavelet to use greatly affects the compression efficiency
| |
14 IMAGE COMPRESSION Module 5
| |