0% found this document useful (0 votes)
8 views

Ch06_Image Compression (1)

Chapter Six discusses image compression, defining it as the process of reducing the data required to represent an image by eliminating redundancies. It covers types of data redundancies, including coding, spatial, and temporal redundancies, and introduces key concepts like compression ratio and fidelity criteria. The chapter also outlines the general mechanism of data compression, detailing the encoding and decoding processes, and presents various coding techniques such as Huffman and arithmetic coding.

Uploaded by

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

Ch06_Image Compression (1)

Chapter Six discusses image compression, defining it as the process of reducing the data required to represent an image by eliminating redundancies. It covers types of data redundancies, including coding, spatial, and temporal redundancies, and introduces key concepts like compression ratio and fidelity criteria. The chapter also outlines the general mechanism of data compression, detailing the encoding and decoding processes, and presents various coding techniques such as Huffman and arithmetic coding.

Uploaded by

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

Chapter Six

Image Compression

1
6.1 Basic Definition of Image
Compression
 Data compression refers to the process of
reducing the amount of data required to
represent a given quantity of information.
 Data are the means by which information is
conveyed.
 Various amounts of data can be used to
represent the same amount of information
 Representations that contain irrelevant or
repeated information are said to contain
redundant data.
2
…cont’d

 Image compression, the art and science of


reducing the amount of data required to
represent an image
 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

3
…cont’d

where C, commonly called the compression


ratio, is defined as

 For instance, if C = 10 (sometimes written


10:1), the larger representation has 10 bits
of data for every 1 bit of data in the smaller
representation. The corresponding relative
data redundancy of the larger
representation is 0.9 (R = 0.9), indicating
that 90% of its data is redundant.
4
6.2 Data Redundancy

 Three forms of data redundancies exist in digital


images
 Coding Redundancy
 Spatial and Temporal Redundancy
 Irrelevant Information.

5
Coding Redundancy

 A code is a system of symbols (like, letters,


numbers, bits) used to represent a body of
information.
 Each piece of information is assigned a
sequence of code symbols, called a code
word.
 The number of symbols in each code word is
its 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
6
intensities.
…cont’d

 Let rk in the interval [0,L – 1] is used to


represent the intensities of an M*N image,
and that each rk occurs with probability pr (rk).

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 lr(k), then the average number of
bits required to represent each pixel is
7
…cont’d

 The total number of bits required to represent


an M*N image is M*N*Lavg.
 If the intensities are represented using a
natural m-bit fixed-length code, then the total
number of bits required to represent an M*N
image is M*N*m .

8
…cont’d

 Example

 Lavg for code 1 is 8 bits.


 The average length of encoded pixels for code 2
Lavg = 0.25*2 + 0.47*1 + 0.25*3 + 0.03*3 = 1.81bits
C = 256*256*8/256*256*1.81 = 4.42
R = 1 – 1/C = 1-1/4.42 = 0.774  Thus, 77.4% of the
data in the original 8-bit 2-D intensity array is
redundant. 9
Spatial and Temporal Redundancy

 Because the pixels of most 2-D intensity


arrays are correlated spatially (i.e., each pixel
is similar to or dependent upon neighboring
pixels), information is unnecessarily
replicated in the representations of the
correlated pixels.
 In a video sequence, temporally correlated
pixels (i.e., those similar to or dependent
upon pixels in nearby frames) also duplicate
information.
10
…cont’d

 To reduce the redundancy associated with


spatially and temporally correlated pixels, a 2-
D intensity array must be transformed into a
more efficient representation.
 For example, run-lengths (128:1) or the
differences between adjacent pixels can be
used.
 In run-length representation, each run-length
pair specifies the start of a new intensity and
the number of consecutive pixels that have
that intensity. 11
Irrelevant Information

 Most 2-D intensity arrays contain information


that is ignored by the human visual system
and/or extraneous to the intended use of the
image.
 It is redundant in the sense that it is not used.

12
…cont’d

(a) coding redundancy, (b) spatial redundancy, (c) irrelevant information

13
6.3 Elements of Information
Theory
 A key question in image compression is: “
what is a minimum amount of data that is
sufficient to describe an image without losing
information?”
 How do we measure the information content
of an image?
 Average information content of an image (the
intensity source’s entropy) is given by:

units/pixel
14
Example

 It is not possible to code the intensity values


of the imaginary source (and thus the sample
image) with fewer than H̃ bits/pixel.
15
Fidelity Criteria

 Since information may be lost during


compression a means of quantifying the
information loss is desirable.
 Two types of criteria:
 Objective fidelity criteria
 Subjective fidelity criteria
 Objective fidelity criteria: the information loss
is expressed as a function of input image
(original image) and output image
(compressed and decompressed)
16
….cont’d

 The Root-mean-squared (rms) error between


f(x,y) and fˆ(x,y) is

 The Means-Quared Signal-to-Noise ratio of


the output image, denoted SNRms, can be
defined as

17
…cont’d

 Subjective fidelity criteria: measuring image


quality by the subjective evaluation of a group
of viewers and averaging their evaluations.

18
6.4 General Mechanism of Data
Compression
 An image compression system is composed
of two distinct functional components: an
encoder and a decoder.
 The encoder performs compression, and the
decoder performs the complementary
operation of decompression.
 A codec is a device or program that is
capable of both encoding and decoding.

19
…cont’d

Functional block diagram of a general image


compression system.

20
The Encoding or Compression
Process
 The encoder is designed to remove the data
redundancies through a series of three
independent operations.
 In the first stage of the encoding process, a
mapper transforms f(x,y) into a format
designed to reduce spatial and temporal
redundancy. This operation generally is
reversible, and may or may not directly
reduce the amount of data required to
represent the image.
 Example, Run-Length Coding 21
…cont’d

 The quantizer reduces the accuracy of the


mapper’s output in accordance with a pre-
established fidelity criterion. The goal is to
remove irrelevant information from the
compressed representation. This operation is
irreversible.
 In the third and final stage of the encoding
process, the symbol coder generates a fixed-
length or variable-length code to represent
the quantizer output, and maps the output in
accordance with the code. 22
…cont’d

 The shortest code words are assigned to the


most frequently occurring quantizer output
values, thus minimizing coding redundancy.
This operation is reversible.

23
The Decoding or Decompression
Process
 The decoder contains only two components:
a symbol decoder and an inverse mapper.
 They perform, in reverse order, the inverse
operations of the encoder’s symbol encoder
and mapper.
 Because quantization results in irreversible
information loss, an inverse quantizer block is
not included in the general decoder model.

24
6.5 Types of Data Compression

25
Huffman Coding

 When coding the symbols of an information


source individually, Huffman coding yields the
smallest possible number of code symbols
per source symbol.
 The first step in Huffman’s approach is to
create a series of source reductions by
ordering the probabilities of the symbols
under consideration, then combining the
lowest probability symbols into a single
symbol that replaces them in the next source
reduction. 26
…cont’d

 This process is then repeated until a reduced


source with two symbols is reached.

Huffman source reductions.

27
…cont’d

 The second step in Huffman’s procedure is to


code each reduced source, starting with the
smallest source and working back to the
original source. The minimal length binary
code for a two-symbol source are the
symbols 0 and 1
 This operation is then repeated for each
reduced source until the original source is
reached.

28
…cont’d

Huffman code assignment procedure.

 The average length of this code is

and the entropy of the source 2.14 bits/symbol


29
Arithmetic Coding

 In arithmetic coding, a one-to-one


correspondence between source symbols
and code words does not exist.
 Instead, an entire sequence of source
symbols (or message) is assigned a single
arithmetic code word.
 The code word itself defines an interval of
real numbers between 0 and 1

30
…cont’d

 As the number of symbols in the message


increases, the interval used to represent it
becomes smaller, and the number of
information units (say, bits) required to
represent the interval becomes larger.
 Each symbol of the message reduces the
size of the interval in accordance with its
probability of occurrence.
 The output of arithmetic coding is a stream of
bits.
31
…cont’d

 In order to explain the algorithm number will


be shown as decimal, but obviously they are
always binary.

32
Arithmetic coding example

 A five-symbol sequence or message,


a1a2a3a3a4, from a four-symbol source is
coded.
 At the start of the coding process, the
message is assumed to occupy the entire
half-open interval [0, 1).
 This interval is subdivided initially into four
regions based on the probabilities of each
source symbol.

33
…cont’d

Symbol a1, for example, is associated with subinterval


[0, 0.2). Because it is the first symbol of the message
being coded, the message interval is initially narrowed
to [0, 0.2). Thus, [0, 0.2) is expanded to the full height of
the figure, and its end points labeled by the values of
the narrowed range. The narrowed range is then
subdivided in accordance with the original source
symbol probabilities, and the process continues until all
34
the symbols are coded.
Arithmetic coding procedure.

[0.06752, 0.688)  0.068 (a1a2a3a3a4 )


35
Bit Plane Coding

 Bit-plane coding, is based on the concept of


decomposing a multilevel (monochrome or
color) image into a series of binary images
and compressing each binary image
 The intensities of an m-bit monochrome
image can be represented in the form of the
base-2 polynomial

36
…cont’d

 Based on this property, a simple method of


decomposing the image into a collection of
binary images is to separate the m
coefficients of the polynomial into m 1-bit bit
planes.
 The lowest-order bit plane (the plane
corresponding to the least significant bit) is
generated by collecting the a0 bits of each
pixel, while the highest-order bit plane
contains the am-1 bits or coefficients.
37
…cont’d
 In general, each bit plane is constructed by setting its
pixels equal to the values of the appropriate bits or
polynomial coefficients from each pixel in the original
image.
 Disadvantages of this approach is that small changes
in intensity can have a significant impact on the
complexity of the bit planes.
 E.g., because the most significant bits of the binary
codes for 127(01111111) and 128(10000000) are
different, the highest bit plane will contain a zero-
valued pixel next to a pixel of value 1, creating a 0 to
1 (or 1 to 0) transition at that point. 38

 An alternative decomposition approach


(which reduces the effect of small intensity
variations) is to first represent the image by
an m-bit Gray code.
 The m-bit Gray code gm-1… g2 g1 g0 that
corresponds to the base-2 polynomial can be
computed from

39
…cont’d

 This code has the unique property that


successive code words differ in only one bit
position.
 Thus, small changes in intensity are less
likely to affect all m bit planes.
 For instance, when intensity levels 127 and
128 are adjacent, only the highest-order bit
plane will contain a 0 to 1 transition, because
the Gray codes that correspond to 127 and
128 are 01000000 and 11000000,
respectively. 40
…cont’d

The four most significant binary and Gray-coded bit planes of the image

41
…cont’d

The four least significant binary and Gray-coded bit planes of the image

42

You might also like