DIP-Session 36
Unit 5:Image CompressionBasic
Concepts
Dr. Mrs Mamata Sachin Kalas
Email id:
[email protected]Image Compression?
• The problem of reducing the amount
of data
required to represent a digital image.
• From a mathematical viewpoint:
transforming
a 2-D pixel array into a statistically
uncorrelated data set.
Why do We Need Compression?
• For data STORAGE and data
TRANSMISSION
• DVD
• Remote
Sensing
• Video
conference
• Control of remotely piloted
• FAX
vehicle
• The bit rate of uncompressed digital
cinema
data exceeds one Gbps.
Information vs Data
REDUNDANT
DATA
INFORMATION
DATA = INFORMATION + REDUNDANT DATA
Why Can We Compress?
• Spatial
redundancy
• Neighboring pixels are not
independent but
correlated
. Temporal
redundancy
Fundamentals
• Basic data
redundancies:
1. Coding redundancy
2. Inter-pixel redundancy
3. Psycho-visual
redundancy
Coding Redundancy
Let us assume, that a discrete random variable rk in the
interval [0,1]
nk of an image:
represent the gray level
pr(r k) = k = 0,1, 2,, L −1
n
If the number of bits used to represent each value
k kof r is
l(r ), then
the average number
L−1of bits required to represent
each pixel:
= l(r∑
Lavg ) p (rk ) r k
k=0
The total number bits required to code an MxN
image:
M.N.Lavg
Coding Redundancy
7
= l (r∑) p2 (rk )
Lavg n
k=0
r k
Compression C R= 1
n
= 2(0.19) + 2(0.25) + 2(0.21) +3(0.16) + 4(0.08) ratio: 2
+5(0.06) + 6(0.03) + 6(0.02) Relative 1
Rd =1−
= 2.7bits data CR
redundancy:
3 1
CR = =1.11 Rd =1− = 0.099
2.7 1.11
Inter-pixel Redundancy
Here the two pictures have
Approximately the same
Histogram.
We must exploit Pixel
Dependencies.
Spatial
Each pixel can be estimated
Redundancy
Geometric
From its neighbors
Redundancy
Inter-frame
Redundancy
Psycho-visual Redundancy
Elimination of psych-visual redundant data results in a
loss of
quantitative information ,it is commonly referred as
quantization.
Improved
Gray-
Scale
Fidelity Criteria
The general classes of
criteria :
1.
2. Objective
Subjectivefidelity
fidelitycriteria
criteria
Fidelity Criteria
Objective fidelity:
Level of information loss can be expressed as a
function
of the original and the compressed and
subsequently 1/2
decompressed image. 1 M −1N−1 ˆ
Root-mean- erms
= ∑∑ [ f (x, y) − f (x, y)]
2
square MN x=0 y=0
error M −1N−1
∑∑ fˆ (x, y) 2
Mean-square SNRms = M −1N−1
x=0 y=0
ˆ (x, y) − f (x, y)] 2
signal-to-noise
ratio ∑∑ [ f
x=0 y=0
Fidelity Criteria
erms = 6.93 erms = 6.78
SNR rm=10.25 SNR =10.39
rm
Fidelity Criteria
Subjective fidelity (Viewed by Human):
• By absolute rating
• By means of side-by-side comparison of f (x, fˆ (x, y)
y)and
Image Compression Model
Remove Increase
Redundancies
Input Noise
theImmunity
The source encoder is responsible for removing redundancy
(coding, inter-pixel, psycho-visual)
The channel encoder ensures robustness against channel noise.
Classification
. Lossless compression
. lossless compression for legal and medical
documents,
computer programs
. exploit
. Lossy only code and inter-pixel redundancy
compression
. digital image and video where some errors or loss
can be
tolerated
. exploit both code and inter-pixel redundancy and
sycho-
visual perception properties
Error-Free Compression
Applications
:• Archive of medical or business
documents
• Digital
• Satellite imaging
radiography
They provide: Compression ratio of 2
to 10.
Error-Free Compression
Variable-length Coding
Huffman
coding
The most popular technique for removing coding redundancy is due
to Huffman (1952)
Huffman Coding yields the smallest number of code symbols per
source symbol
The resulting code is optimal
Error-Free Compression
Variable-length Coding
Huffman
coding (optimal
code)
Error-Free Compression
Variable-length Coding
Huffman
coding
Lavg = (0.4)(1) + (0.3)(2) + (0.1)(3) + (0.1)(4) + (0.06)(5) + (0.04)
(5)
= 2.2bits / symbol
entropy = 2.14bits / symbol
LZWCodin
Error Free Compression
g
Technique.
Remove Inter-pixel
redundancy.
Requires no priori knowledge of probability distribution of
pixels.
Assigns fixed length code words to variable length
sequences.
LZW
Coding Technique
Coding
A codebook or a dictionary has to be
constructed
For an 8-bit monochrome image, the first 256 entries
are
assigned to the gray levels 0,1,2,..,255.
As the encoder examines image pixels, gray level
sequences
that are not in the dictionary are assigned to a new entry.
LZW Coding
Exampl
e
Consider the following 4 x 4 8 bit Dictionary Location Entry
image
39 39 126 126
0 0
39 39 126 126 1 1
39 39 126 126 . .
39 39 126 126 255 255
256 -
511 -
Initial Dictionary
LZW Coding
•Is 39 in the dictionary……..Yes
39 39 126 126
39 39 126 126
39 39 126 126
•What about 39-39………….No
39 39 126 126
•Then add 39-39 in entry 256
Dictionary Location Entry
0 0
•And output the last recognized symbol…39
1 1
. .
255 255
39-39
256 -
511 -
Error-Free Compression
Bit-plane coding abcdef
a
Bit-plane coding is based b
c
on
d
decomposing a multilevel e
image into a series of f
binary
images and compressing
each binary image .
Gray Bit-
Error-Free CompressionBinary Bit-planes planes
Bit-plane coding
Bit-plane
decomposition
m −bit gray scale: am−1 2m−1 + am−2 2m−2 ++ a0 2
0
Gray code: g gm−1g g
m−21 0
gl = a ⊕
l a l+1 0≤l≤m−2
g m−1
=a m−1
Gray Bit-
Error-Free CompressionBinary Bit-planes planes
Bit-plane coding
Bit-plane
decomposition
Error-Free Compression
Bit-plane coding
• Constant area H +H
Coding
• One-dimensional run-length H RL
=
0
1
L0 + L1
coding
Average values of
black and white run
lengths
• Two-dimensional
RLC
Relative Address Coding (RAC) is based on
tracking the
binary transitions.
Image Compression Standards
Why Do We Need International Standards?
. International standardization is conducted to
achieve
inter-operability .
. Only syntax and decoder are specified.
. Encoder is not standardized and its optimization is
left to the
manufacturer
. Standards .
provide state-of-the-art technology
that is
developed by acurrent
. Not only solve groupproblems,
of experts
butin theanticipate
also field.
the future
application requirements.
. Most of the standards are sanction by the
International
Standardization Organization (ISO) and the
Consultative Committee of the International
Telephone and Telegraph (CCITT)
Image Compression Standards
Binary Image Compression Standards
CCITT Group 3 and 4
. They are designed as FAX coding
. methods.
The Group 3 applies a non-adaptive 1-D run
length
coding
. Both and optionally
standards use the2-D manner.
same non-adaptive 2-D
coding
. approach, similar
They sometime to RAC
result technique.
in data expansion.
Therefore, the
Joint Bilevel Imaging Group (JBIG), has adopted
several
other binary compression standards, JBIG1 and
JBIG2.
Image Compression Standards
Continues Tone Still Image Comp.
What Is JPEG?
. "Joint Photographic Expert Group".
Voted as
international standard in 1992.
. Works with color and grayscale images, e.g.,
satellite,
medical, ...
. Lossy and
lossless
Image Compression Standards
Continues Tone Still Image Comp. - JPEG
. First generation JPEG uses DCT+Run length
Huffman
entropy coding.
. Second generation JPEG (JPEG2000) uses
wavelet
transform + bit plane coding + Arithmetic
entropy
coding.
Image Compression Standards
Continues Tone Still Image Comp. - JPEG
. Still-image compression
standard
. Has 3 lossless modes and 1 lossy
mode
. . encode in one
sequential
scan baseline encoding
. input & output data precision is limited to 8 bits, while
quantized
DCT values are restricted to 11 bits
. progressive
. encoding
. hierarchical
encoding
. Can achieve
lossless compression ratios of up-to 20 to 1
encoding
without
noticeable reduction in image quality
Image Compression Standards
Continues Tone Still Image Comp. - JPEG
. Work well for continuous tone images, but not
good for
. cartoons or computer
Tend to filter out high generated
frequency images.
. data.
Can specify
. with too lowaQ,
quality level
resulting (Q)may contain blocky,
images
contouring
and ringing structures.
. 5 steps of sequential baseline
encoding
. transform image to luminance/chrominance space
. (YCbCr)
. reduce the
partition colorinto
image components
8x8 pixel (optional)
blocks and perform DCT
on each
block
. quantize resulting DCT
. coefficients
variable length code the quantized
coefficients
Image Compression Standards
JPEG Encoding
Original JPEG 27:1
Image Compression Standards
Video Compression Standards
Video compression
standards:
1. Video teleconferencing
standards
. H.261
. (Px64)
H.262
. H.263 (10 to 30
. kbit/s)
H.320 (ISDN
2. Multimedia
bandwidth)
standards
. MPEG-1 (1.5
. Mbit/s)
. MPEG-2
MPEG-4 (2-10
(5 to 64 kbit/s for mobile and PSTN and
Mbit/s)
uo to 4
Mbit/s for TV and film application)
THANK
YOU