0% found this document useful (0 votes)
16 views87 pages

Unit-4 Image Compression

This document discusses image compression. It begins with an introduction noting the increasing need for image compression in applications like the internet, businesses, multimedia, and medical imaging. It then discusses how compression algorithms are initially developed for 2D images before being extended to video. The document outlines different types of redundancy inherent in images, including coding, interpixel, interband, and psychovisual redundancy, that compression algorithms exploit to reduce file sizes. It distinguishes between lossless and lossy compression methods and their ability to compress files while retaining necessary information for different applications.

Uploaded by

Yatish Chutani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views87 pages

Unit-4 Image Compression

This document discusses image compression. It begins with an introduction noting the increasing need for image compression in applications like the internet, businesses, multimedia, and medical imaging. It then discusses how compression algorithms are initially developed for 2D images before being extended to video. The document outlines different types of redundancy inherent in images, including coding, interpixel, interband, and psychovisual redundancy, that compression algorithms exploit to reduce file sizes. It distinguishes between lossless and lossy compression methods and their ability to compress files while retaining necessary information for different applications.

Uploaded by

Yatish Chutani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 87

UNIT 4

Image Compression

(c) Scott E Umbaugh, SIUE 2005 1


Introduction and Overview

 The field of image compression continues


to grow at a rapid pace

 As we look to the future, the need to store


and transmit images will only continue to
increase faster than the available
capability to process all the data

(c) Scott E Umbaugh, SIUE 2005 2


 Applications that require image
compression are many and varied such
as:

1. Internet,
2. Businesses,
3. Multimedia,
4. Satellite imaging,
5. Medical imaging

(c) Scott E Umbaugh, SIUE 2005 3


 Compression algorithm development
starts with applications to two-dimensional
(2-D) still images

 After the 2-D methods are developed, they


are often extended to video (motion
imaging)

 However, we will focus on image


compression of single frames of image
data

(c) Scott E Umbaugh, SIUE 2005 4


 Image compression involves reducing the
size of image data files, while retaining
necessary information

 Retaining necessary information depends


upon the application

 Image segmentation methods, which are


primarily a data reduction process, can be
used for compression

(c) Scott E Umbaugh, SIUE 2005 5


 The reduced file created by the
compression process is called the
compressed file and is used to reconstruct
the image, resulting in the decompressed
image
 The original image, before any
compression is performed, is called the
uncompressed image file
 The ratio of the original, uncompressed
image file and the compressed file is
referred to as the compression ratio
(c) Scott E Umbaugh, SIUE 2005 6
 The compression ratio is denoted by:

(c) Scott E Umbaugh, SIUE 2005 7


 The reduction in file size is necessary to
meet the bandwidth requirements for
many transmission systems, and for the
storage requirements in computer
databases

 Also, the amount of data required for


digital images is enormous

(c) Scott E Umbaugh, SIUE 2005 8


 This number is based on the actual
transmission rate being the maximum,
which is typically not the case due to
Internet traffic, overhead bits and
transmission errors

(c) Scott E Umbaugh, SIUE 2005 9


 Additionally, considering that a web page
might contain more than one of these
images, the time it takes is simply too long

 For high quality images the required


resolution can be much higher than the
previous example

(c) Scott E Umbaugh, SIUE 2005 10


Example 10.1.5 applies maximum data rate to Example 10.1.4

(c) Scott E Umbaugh, SIUE 2005 11


 Now, consider the transmission of video
images, where we need multiple frames
per second
 If we consider just one second of video
data that has been digitized at 640x480
pixels per frame, and requiring 15 frames
per second for interlaced video, then:

(c) Scott E Umbaugh, SIUE 2005 12


 Waiting 35 seconds for one second’s
worth of video is not exactly real time!

 Even attempting to transmit


uncompressed video over the highest
speed Internet connection is impractical

 For example: The Japanese Advanced


Earth Observing Satellite (ADEOS)
transmits image data at the rate of 120
Mbps

(c) Scott E Umbaugh, SIUE 2005 13


 Applications requiring high speed
connections such as high definition
television, real-time teleconferencing, and
transmission of multiband high resolution
satellite images, leads us to the conclusion
that image compression is not only
desirable but necessessary

 Key to a successful compression scheme is


retaining necessary information

(c) Scott E Umbaugh, SIUE 2005 14


 To understand “retaining necessary
information”, we must differentiate
between data and information

1. Data:
• For digital images, data refers to the
pixel gray level values that correspond to
the brightness of a pixel at a point in
space
• Data are used to convey information,
much like the way the alphabet is used to
convey information via words

(c) Scott E Umbaugh, SIUE 2005 15


2. Information:

• Information is an interpretation of the


data in a meaningful way

• Information is an elusive concept; it can


be application specific

(c) Scott E Umbaugh, SIUE 2005 16


 There are two primary types of image
compression methods:

1. Lossless compression methods:


• Allows for the exact recreation of the original
image data, and can compress complex
images to a maximum 1/2 to 1/3 the original
size – 2:1 to 3:1 compression ratios
• Preserves the data exactly

(c) Scott E Umbaugh, SIUE 2005 17


2. Lossy compression methods:

• Data loss, original image cannot be re-


created exactly
• Can compress complex images 10:1 to
50:1 and retain high quality, and 100 to
200 times for lower quality, but
acceptable images
• (More description about Lossy and
Lossless compression is given in later
slides)

(c) Scott E Umbaugh, SIUE 2005 18


Redundancy
• R=1-1/C
• R= irrelevent or redundant data
• C= Compression Ratio i.e. original/compressed image
• Image representation that have irrelevant or
repeated information is said to contain redundant
data.

(c) Scott E Umbaugh, SIUE 2005 19


 Compression algorithms are developed
by taking advantage of the redundancy
that is inherent in image data

 Four primary types of redundancy that


can be found in images are:
1. Coding
2. Interpixel
3. Interband
4. Psychovisual redundancy
(c) Scott E Umbaugh, SIUE 2005 20
1. Coding redundancy
• Occurs when the data used to represent the
image is not utilized in an optimal manner.
• Coding redundancy is associated with the
representation of information.
• The information is represented in the form of
codes.
• If the gray levels of an image are coded in a way
that uses more code symbols than absolutely
necessary to represent each gray level then the
resulting image is said to contain coding
redundancy.

(c) Scott E Umbaugh, SIUE 2005 21


(c) Scott E Umbaugh, SIUE 2005 22
SOLVE THE ABOVE NUMERICAL

(c) Scott E Umbaugh, SIUE 2005 23


2. Interpixel Redundancy
• Consider the images shown in Figs. (a) and (b). As Figs. 1.1(c) and
(d) show, these images have virtually identical histograms. Note
also that both histograms are trimodal, indicating the presence of
three dominant ranges of gray-level values.
• Because the gray levels in these images are not equally probable,
variable-length coding can be used to reduce the coding
redundancy that would result from a straight or natural binary
encoding of their pixels.
• The coding process, however, would not alter the level of
correlation between the pixels within the images. In other words,
the codes used to represent the gray levels of each image have
nothing to do with the correlation between pixels. These
correlations result from the structural or geometric relationships
between the objects in the image.

(c) Scott E Umbaugh, SIUE 2005 24


Interpixel redundancy

 Occurs because adjacent pixels tend to be highly correlated,


in most images the brightness levels do not change rapidly,
but change gradually

• Interpixel redundancy is due to the correlation between the


neighboring pixels in an image.
• That means neighboring pixels are not statistically independent.
The gray levels are not equally probable.
• The value of any given pixel can be predicated from the value of
its neighbors that is they are highly correlated.
• The information carried by individual pixel is relatively small. To
reduce the interpixel redundancy the difference between
adjacent pixels can be used to represent an image.

(c) Scott E Umbaugh, SIUE 2005 25


3. Interband redundancy
 Occurs in color images due to the correlation
between bands within an image – if we extract
the red, green and blue bands they look similar

4. Psychovisual redundancy
 Some information is more important to the
human visual system than other types of
information.
• The Psychovisual redundancies exist because human
perception does not involve quantitative analysis of
every pixel or luminance value in the image.
• It’s elimination is real visual information is possible
only because the information itself is not essential
for normal visual processing.

(c) Scott E Umbaugh, SIUE 2005 26


• Certain information simply has less relative importance
than other information in normal visual processing.
This information is said to be psychovisually
redundant. It can be eliminated without significantly
impairing the quality of image perception.
• Its elimination is possible only because the information
itself is not essential for normal visual processing.
Since the elimination of psychovisually redundant data
results in a loss of quantitative information, it is
commonly referred to as quantization. This
terminology is consistent with normal usage of the
word, which generally means the mapping of a broad
range of input values to a limited number of output
values. As it is an irreversible operation (visual
information is lost), quantization results in lossy data
compression.

(c) Scott E Umbaugh, SIUE 2005 27


Fidelity criterion
• The removal of psychovisually redundant data
results in a loss of real or quantitative visual
information. Because information of interest
may be lost, a repeatable or reproducible
means of quantifying the nature and extent of
information loss is highly desirable. Two
general classes of criteria are used as the basis
for such an assessment: A) Objective fidelity
criteria and B) Subjective fidelity criteria.
(c) Scott E Umbaugh, SIUE 2005 28
• When the level of information loss can be expressed as
a function of the original or input image and the
compressed and subsequently decompressed output
image, it is said to be based on an objective fidelity
criterion. A good example is the root-mean-square
(rms) error between an input and output image. Let
f(x, y) represent an input image and let f(x, y) denote
an estimate or approximation of f(x, y) that results
from compressing and subsequently decompressing
the input. For any value of x and y, the error e(x, y)
between f (x, y) and f^ (x, y) can be defined as

(c) Scott E Umbaugh, SIUE 2005 29


(c) Scott E Umbaugh, SIUE 2005 30
 The key in image compression algorithm
development is to determine the minimal
data required to retain the necessary
information
 The compression is achieved by taking
advantage of the redundancy that exists in
images
 If the redundancies are removed prior to
compression, for example with a
decorrelation process, a more effective
compression can be achieved

(c) Scott E Umbaugh, SIUE 2005 31


 To help determine which information can
be removed and which information is
important, the image fidelity criteria are
used

 These measures provide metrics for


determining image quality

 It should be noted that the information


required is application specific, and that,
with lossless schemes, there is no need for
a fidelity criteria
(c) Scott E Umbaugh, SIUE 2005 32
Compression System Model

• The compression system model consists


of two parts:

1. The compressor
2. The decompressor

• The compressor consists of a


preprocessing stage and encoding stage,
whereas the decompressor consists of a
decoding stage followed by a
postprocessing stage
(c) Scott E Umbaugh, SIUE 2005 33
Decompressed image

(c) Scott E Umbaugh, SIUE 2005 34


• Before encoding, preprocessing is
performed to prepare the image for the
encoding process, and consists of any
number of operations that are application
specific

• After the compressed file has been


decoded, postprocessing can be
performed to eliminate some of the
potentially undesirable artifacts brought
about by the compression process
(c) Scott E Umbaugh, SIUE 2005 35
(c) Scott E Umbaugh, SIUE 2005 36
• In the first stage of the source encoding
process, the mapper transforms the input
data into a (usually nonvisual) format
designed to reduce interpixel redundancies in
the input image. This operation generally is
reversible and may or may not reduce directly
the amount of data required to represent the
image.

(c) Scott E Umbaugh, SIUE 2005 37


• Run-length coding is an example of a mapping that
directly results in data compression in this initial stage
of the overall source encoding process. The
representation of an image by a set of transform
coefficients is an example of the opposite case. Here,
the mapper transforms the image into an array of
coefficients, making its interpixel redundancies more
accessible for compression in later stages of the
encoding process.
• The second stage, or quantizer block reduces the
accuracy of the mapper's output in accordance with
some pre established fidelity criterion. This stage
reduces the psychovisual redundancies of the input
image. This operation is irreversible. Thus it must be
omitted when error-free compression is desired.

(c) Scott E Umbaugh, SIUE 2005 38


• In the third and final stage of the source encoding
process, the symbol coder creates a fixed- or variable-
length code to represent the quantizer output and
maps the output in accordance with the code. The
term symbol coder distinguishes this coding operation
from the overall source encoding process. In most
cases, a variable-length code is used to represent the
mapped and quantized data set. It assigns the shortest
code words to the most frequently occurring output
values and thus reduces coding redundancy. The
operation, of course, is reversible. Upon completion of
the symbol coding step, the input image has been
processed to remove each of the three redundancies.

(c) Scott E Umbaugh, SIUE 2005 39


• Summary of the above methodology
The compressor can be broken into
following stages:
1. Data reduction: Image data can be
reduced by gray level and/or spatial
quantization, or can undergo any desired
image improvement (for example, noise
removal) process
2. Mapping: Involves mapping the original
image data into another mathematical
space where it is easier to compress the
data
(c) Scott E Umbaugh, SIUE 2005 40
3. Quantization: Involves taking potentially
continuous data from the mapping stage
and putting it in discrete form

4. Coding: Involves mapping the discrete


data from the quantizer onto a code in an
optimal manner

• A compression algorithm may consist of


all the stages, or it may consist of only
one or two of the stages

(c) Scott E Umbaugh, SIUE 2005 41


(c) Scott E Umbaugh, SIUE 2005 42
• The decompressor can be broken down
into following stages:

1. Decoding: Takes the compressed file


and reverses the original coding by
mapping the codes to the original,
quantized values

2. Inverse mapping: Involves reversing the


original mapping process

(c) Scott E Umbaugh, SIUE 2005 43


3. Postprocessing: Involves enhancing the
look of the final image

• This may be done to reverse any


preprocessing, for example, enlarging an
image that was shrunk in the data
reduction process
• In other cases the postprocessing may
be used to simply enhance the image to
ameliorate any artifacts from the
compression process itself

(c) Scott E Umbaugh, SIUE 2005 44


Decompressed image

(c) Scott E Umbaugh, SIUE 2005 45


• The development of a compression
algorithm is highly application specific

• Preprocessing stage of compression


consists of processes such as
enhancement, noise removal, or
quantization are applied

• The goal of preprocessing is to prepare


the image for the encoding process by
eliminating any irrelevant information,
where irrelevant is defined by the
application
(c) Scott E Umbaugh, SIUE 2005 46
• For example, many images that are for
viewing purposes only can be
preprocessed by eliminating the lower bit
planes, without losing any useful
information

(c) Scott E Umbaugh, SIUE 2005 47


Figure 10.1.4 Bit plane images

a) Original image c) Bit plane 6

b) Bit plane 7, the most significant bit

(c) Scott E Umbaugh, SIUE 2005 48


Figure 10.1.4 Bit plane images (Contd)

d) Bit plane 5 f) Bit plane 3

e) Bit plane 4

(c) Scott E Umbaugh, SIUE 2005 49


Figure 10.1.4 Bit plane images (Contd)

g) Bit plane 2 i) Bit plane 0,


the least significant bit

h) Bit plane 1

(c) Scott E Umbaugh, SIUE 2005 50


• The mapping process is important
because image data tends to be highly
correlated

• Specifically, if the value of one pixel is


known, it is highly likely that the adjacent
pixel value is similar

• By finding a mapping equation that


decorrelates the data this type of data
redundancy can be removed

(c) Scott E Umbaugh, SIUE 2005 51


• Differential coding: Method of reducing
data redundancy, by finding the difference
between adjacent pixels and encoding
those values

• The principal components transform can


also be used, which provides a
theoretically optimal decorrelation

• Color transforms are used to decorrelate


data between image bands

(c) Scott E Umbaugh, SIUE 2005 52


Figure -5.6.1 Principal Components Transform (PCT)

a) Red band of a color image b) Green band c) Blue band

d) Principal component band 1 e) Principal component band 2 f) Principal component band 3


(c) Scott E Umbaugh, SIUE 2005 53
• As the spectral domain can also be used
for image compression, so the first stage
may include mapping into the frequency or
sequency domain where the energy in the
image is compacted into primarily the
lower frequency/sequency components

• These methods are all reversible, that is


information preserving, although all
mapping methods are not reversible

(c) Scott E Umbaugh, SIUE 2005 54


• Quantization may be necessary to convert
the data into digital form (BYTE data type),
depending on the mapping equation used

• This is because many of these mapping


methods will result in floating point data
which requires multiple bytes for
representation which is not very efficient, if
the goal is data reduction

(c) Scott E Umbaugh, SIUE 2005 55


• Quantization can be performed in the
following ways:

1. Uniform quantization: In it, all the quanta,


or subdivisions into which the range is
divided, are of equal width

2. Nonuniform quantization: In it the


quantization bins are not all of equal
width

(c) Scott E Umbaugh, SIUE 2005 56


(c) Scott E Umbaugh, SIUE 2005 57
• Often, nonuniform quantization bins are
designed to take advantage of the
response of the human visual system

• In the spectral domain, the higher


frequencies may also be quantized with
wider bins because we are more sensitive
to lower and midrange spatial frequencies
and most images have little energy at high
frequencies

(c) Scott E Umbaugh, SIUE 2005 58


• The concept of nonuniform quantization
bin sizes is also described as a variable bit
rate, since the wider quantization bins
imply fewer bits to encode, while the
smaller bins need more bits

• It is important to note that the quantization


process is not reversible, so it is not in the
decompression model and also some
information may be lost during
quantization
(c) Scott E Umbaugh, SIUE 2005 59
• The coder in the coding stage provides a
one-to-one mapping, each input is
mapped to a unique output by the coder,
so it is a reversible process

• The code can be an equal length code,


where all the code words are the same
size, or an unequal length code with
variable length code words

(c) Scott E Umbaugh, SIUE 2005 60


• In most cases, an unequal length code is
the most efficient for data compression,
but requires more overhead in the coding
and decoding stages

(c) Scott E Umbaugh, SIUE 2005 61


LOSSLESS COMPRESSION
METHODS

 No loss of data, decompressed image


exactly same as uncompressed image
 Medical images or any images used in
courts
 Lossless compression methods typically
provide about a 10% reduction in file size
for complex images

(c) Scott E Umbaugh, SIUE 2005 62


 Lossless compression methods can
provide substantial compression for simple
images

 However, lossless compression


techniques may be used for both
preprocessing and postprocessing in
image compression algorithms to obtain
the extra 10% compression

(c) Scott E Umbaugh, SIUE 2005 63


 The underlying theory for lossless
compression (also called data compaction)
comes from the area of communications
and information theory, with a
mathematical basis in probability theory

 One of the most important concepts used


is the idea of information content and
randomness in data

(c) Scott E Umbaugh, SIUE 2005 64


 Information theory
 defines information based on the
probability of an event, knowledge of an
unlikely event has more information than
knowledge of a likely event
 For example:
• The earth will continue to revolve around the
sun; little information, 100% probability
• An earthquake will occur tomorrow; more info.
Less than 100% probability
• A matter transporter will be invented in the next
10 years; highly unlikely – low probability, high
information content

(c) Scott E Umbaugh, SIUE 2005 65


 This perspective on information is the
information theoretic definition and should
not be confused with our working definition
that requires information in images to be
useful, not simply novel

 Entropy is the measurement of the


average information in an image

(c) Scott E Umbaugh, SIUE 2005 66


 The entropy for an N x N image can be
calculated by this equation:

(c) Scott E Umbaugh, SIUE 2005 67


 This measure provides us with a
theoretical minimum for the average
number of bits per pixel that could be used
to code the image

 It can also be used as a metric for judging


the success of a coding scheme, as it is
theoretically optimal

(c) Scott E Umbaugh, SIUE 2005 68


(c) Scott E Umbaugh, SIUE 2005 69
(c) Scott E Umbaugh, SIUE 2005 70
 The two preceding examples (10.2.1 and
10.2.2) illustrate the range of the entropy:

 The examples also illustrate the


information theory perspective regarding
information and randomness
 The more randomness that exists in an
image, the more evenly distributed the
gray levels, and more bits per pixel are
required to represent the data

(c) Scott E Umbaugh, SIUE 2005 71


Figure 10.2-1 Entropy

a) Original image, c) Image after binary threshold,


entropy = 7.032 bpp
entropy = 0.976 bpp

b) Image after local histogram equalization,


block size 4, entropy = 4.348 bpp

(c) Scott E Umbaugh, SIUE 2005 72


 Figure 10.2.1 depicts that a minimum
overall file size will be achieved if a
smaller number of bits is used to code the
most frequent gray levels
 Average number of bits per pixel (Length)
in a coder can be measured by the
following equation:

(c) Scott E Umbaugh, SIUE 2005 73


 Huffman Coding

• The Huffman code, developed by D.


Huffman in 1952, is a minimum length
code
• This means that given the statistical
distribution of the gray levels (the
histogram), the Huffman algorithm will
generate a code that is as close as
possible to the minimum bound, the
entropy

(c) Scott E Umbaugh, SIUE 2005 74


• The method results in an unequal (or
variable) length code, where the size of
the code words can vary

• For complex images, Huffman coding


alone will typically reduce the file by 10%
to 50% (1.1:1 to 1.5:1), but this ratio can
be improved to 2:1 or 3:1 by
preprocessing for irrelevant information
removal

(c) Scott E Umbaugh, SIUE 2005 75


• The Huffman algorithm can be described
in five steps:

1. Find the gray level probabilities for the image


by finding the histogram
2. Order the input probabilities (histogram
magnitudes) from smallest to largest
3. Combine the smallest two by addition
4. GOTO step 2, until only two probabilities are
left
5. By working backward along the tree, generate
code by alternating assignment of 0 and 1

(c) Scott E Umbaugh, SIUE 2005 76


(c) Scott E Umbaugh, SIUE 2005 77
(c) Scott E Umbaugh, SIUE 2005 78
(c) Scott E Umbaugh, SIUE 2005 79
(c) Scott E Umbaugh, SIUE 2005 80
(c) Scott E Umbaugh, SIUE 2005 81
(c) Scott E Umbaugh, SIUE 2005 82
• In the example, we observe a 2.0 : 1.9
compression, which is about a 1.05
compression ratio, providing about 5%
compression

• From the example we can see that the


Huffman code is highly dependent on the
histogram, so any preprocessing to
simplify the histogram will help improve
the compression ratio

(c) Scott E Umbaugh, SIUE 2005 83


Lossy Compression Methods

 Lossy compression methods are required


to achieve high compression ratios with
complex images

 They provides tradeoffs between image


quality and degree of compression, which
allows the compression algorithm to be
customized to the application

(c) Scott E Umbaugh, SIUE 2005 84


(c) Scott E Umbaugh, SIUE 2005 85
 With more advanced methods, images can
be compressed 10 to 20 times with
virtually no visible information loss, and 30
to 50 times with minimal degradation
 Newer techniques, such as JPEG2000,
can achieve reasonably good image
quality with compression ratios as high as
100 to 200
 Image enhancement and restoration
techniques can be combined with lossy
compression schemes to improve the
appearance of the decompressed image
(c) Scott E Umbaugh, SIUE 2005 86
 In general, a higher compression ratio
results in a poorer image, but the results
are highly image dependent – application
specific

 Lossy compression can be performed in


both the spatial and transform domains.
Hybrid methods use both domains.

(c) Scott E Umbaugh, SIUE 2005 87

You might also like