Image Compression
Relative Data Redundancy
224 GB
► Let b and b’ denote the number of bits in two representations of
the same information, the relative data redundancy R is
R = 1-1/C
C is called the compression ratio, defined as
C = b/b’
e.g., C = 10, the corresponding relative data redundancy of the larger
representation is 0.9, indicating that 90% of its data is redundant
Why do we need compression?
► Data storage
► Data transmission
How can we implement compression?
► Coding redundancy
Most 2-D intensity arrays contain more bits than are
needed to represent the intensities
► Spatial and temporal redundancy
Pixels of most 2-D intensity arrays are correlated
spatially and video sequences are temporally correlated
► Irrelevant information
Most 2-D intensity arrays contain information that is
ignored by the human visual system
Examples of Redundancy
Coding Redundancy
The average number of bits required to represent each pixel is
L 1
Lavg l (rk ) pr (rk ) 0.25(2) 0.47(1) 0.24(3) 0.03(3) 1.81bits
k 0
8
C 4.42
1.81
R 1 1/ 4.42 0.774
Spatial and Temporal Redundancy
1. All 256 intensities are equally probable.
2. The pixels along each line are identical.
3. The intensity of each line was selected randomly.
Spatial and Temporal Redundancy
1. All 256 intensities are equally probable.
2. The pixels along each line are identical.
3. The intensity of each line was selected randomly.
Run-length pair specifies the start of a new intensity and the
number of consecutive pixels that have that intensity.
Each 256-pixel line of the original representation is replaced
by a single 8-bit intensity value and length 256 in the run-length
representation.
The compression ratio is
256 256 8
128 :1
(256 256) 8
Irrelevant Information
256 256 8 / 8
65536 :1
Fidelity Criteria
Let f ( x, y ) be an input image and f ( x, y ) be an approximation
of f ( x, y ). The images are of size M N .
The root - mean - square error is
2 1/2
1 M 1 N 1
erms
x 0 y 0
f ( x, y ) f ( x, y )
MN
Fidelity Criteria
The mean - square signal - to - noise ratio of the output image,
denoted SNR ms
M 1 N 1 2
x 0 y 0
f ( x , y )
SNR ms M 1 N 1 2
x 0 y 0
f ( x , y ) f ( x , y )
RMSE = 5.17 RMSE = 15.67 RMSE = 14.17
Image Compression Models
Image Compression Standards
Some Basic Compression Methods:
Huffman Coding
Some Basic Compression Methods:
Huffman Coding
The average length of this code is
Lavg 0.4*1 0.3*2 0.1*3 0.1*4 0.06*5 0.04*5
= 2.2 bits/pixel
Home task
► Golomb coding
► Run-length coding
Fact about JPEG Compression
► JPEG stands for Joint Photographic Experts Group
► Used on 24-bit color files.
► Works well on photographic images.
► Although it is a lossy compression technique, it yields an
excellent quality image with high compression rates.
Fact about JPEG Compression
► It defines three different coding systems:
1. a lossy baseline coding system, adequate for most
compression applications
2. an extended coding system for greater compression,
higher precision, or progressive reconstruction applications
3. A lossless independent coding system for reversible
compression