Professional Documents
Culture Documents
DIP Image Compression 1.11.2015
DIP Image Compression 1.11.2015
Digital images are very large in size and hence occupy larger
storage space. Due to their larger size, they take larger
bandwidth and more time for upload or download through the
Internet.
This makes it inconvenient for storage as well as file sharing.
To combat with this problem, the images are compressed in
size with special techniques.
This compression not only helps in saving storage space but
also enables easy sharing of files. Image compression
applications reduce the size of an image file without causing
major degradation to the quality of the image.
Image Compression
Digital
space.
The
rates.
Data Information
Image Compression
Aims
storage space
Increase
Applications
Medical imaging
Digital radiography
Legal aspects
Video conferencing (as person is talking, we want to send full image: rate at
which information is send must be quite fast
Entertainment
Compression Ratio
Image Quality
Compression Speed
Compression Ratio
C.R.
Image Quality
number of bitsincompressed image
bpp
no. of pixels
Compression Speed
Amount of the time required to compress and decompress image.
PSNR
PSNR 10 log
Where
MAX 2
1
MXN
2
(
X
(
m
,
n
)
Y
(
m
,
n
))
m 1 n 1
Data Redundancy
CR
n1
n2
Coding
Interpixel (spatial and temporal or video) redundancy
Psychovisual
Coding Redundancy
Example
l(rk) = constant length
Example
l(rk) = variable length
Consider the probability of the gray levels:
Interpixel redundancy
f ( x) o g ( x)
f ( x) g ( x a )da
Interpixel redundancy
Inter pixel red.: There are pixel gray level ( 1 byte to store)
123 120 121 124
126
128 127
123 -3 1
3
2
2
-1 difference of 2 adj. Pixel
Psycho-visual Redundancy
Compression Model
ENCODER
DECODER
Compression Techniques
Lossless Compression
Lossy Compression
Visually lossless.
Lossless (Error-Free)Compression
Ex: Huffman codes, LZW, Arithmetic coding, Run-length coding, Lossless Predictive Codingand Bit-Plane Coding.
Huffman Coding
Huffman Coding yields the smallest number of code symbols per source
symbol
The resulting code is optimal symbol per source symbol also known as
block coding.
The basic aim is to reduce the entropy of each bit in source coding.
Example
l(rk) = variable length
Consider the probability of the gray levels:
Huffman Coding
Symbol
S0
S1
S2
S3
S4
L 1
Lavg l (rk ) pr (rk ) 0.4 2 0.2 2 0.2 2 0.1 3 0.1 3 2.2 bits
k 0
L 1
H ( s ) pk log 2 ( pk )
k 0
Efficiency
H ( s)
EXAMPLE
CODING REDUNDANCYrk
r87
r128
r186
r255
pr ( rk )
CODE-1
L1 ( rk )
CODE-2
L2 ( rk )
0.25
01010111 8
01
0.47
10000000 8
0.25
11000100 8
000
0.03
11111111
001
EXAPMPLE
rk -
Lavg
pr (rk )
L 1
l (r ) p
k 0
( rk )
Example
Arithmetic Coding
Arithmetic Coding
Sources symbol Probability
a1
a2
a3
a4
0.2
0.2
0.4
0.2
Initial sub-range
[0.0,0.2)
[0.2, 0.4)
[0.4, 0.8)
[0.8, 1.0)
Arithmetic decoding
If first symbol is a1 the tag will lie in 0.02 and rest of unit interval
is discarded, then this subinterval is divided into same
proportion as the original one. Suppose second symbol in seq
is a2, the tag value is restricted to lie in the interval between .
02to .04 (tag seq is alwaysa disjoint from others), we now
partition this interval into as same proportion as original one.
Arithmetic decoding
1) 0.068 [0.0; 0.2) => a1;
(0.068-0.0)/(0.2-0.0)=0.34
(0.34-0.2)/(0.4-0.2)=0.7
Arithmetic decoding
The decoded sequence: a1 a2 a3 a3 a4
So final code for string a1 a2 a3 a3 a4 is between .0624 to .0688
Drawbacks of the arithmetic coding:
- precision is big issue
- an end-of-message flag is needed
Alternative solutions: re-normalization and rounding
000101110010100101
Numerical positions
: 1 2 3
4
Subsequences
: 0 1 00 01
Numerical representation :
11 12
Binary coded block
:
0010 0010
5
6
7
8
011 10 010 100
42 21 41 61
9
101
62
Predictive coding
Transform Coging
Predictive Coding
f (n) round
Fig.: Predictor
i 1
f (n i )
PREDICTIVE CODING
DPCM coding principles: Maximize image compression efficiency by
exploiting the spatial redundancy present in an image!
Many close to zero data => spatial redundancy, the brightness
is almost repeating from a point to the next one! => no need to
encode all brightness info, only the new one!
Line-by-line
difference of
the luminance
see images: one can estimate ( predict) the brightness of the subsequent spatial point
based on the brightness of the previous (one or more) spatial points = PREDICTIVE CODING
JPEG Compression
Forward Transform
N 1 N 1
T (u , v) f ( x, y )g ( x, y , u , v)
x 0 y 0
f ( x, y ) T (u , v) h( x, y, u , v)
u 0 v 0
Image Transformation
Image Transformations
Unitary Transformations
Image
NXN
Transform
Another Image
NXN
Inverse Transform
Coefficient Matrix
Preprocessing
Filtering
Enhancement etc.
Data Compression
Feature Extraction
Edge Detection
Corner Detection etc.
x (t ) Cn an (t )
n 0
Unitary Matrix
Basis Images
Orthogonal/Orthonormal
Function
A set a (t ) a (t ), a (t )...... of real valued continuous functions
(t ).an (t )dt k ; m n
0; m n
if k=1 then we say above set is orthonormal.
Now to calculate the value of Cn, multiply both side by am(t) and integrate it
And expand it
Compression Techniques
DFT
N 1 N 1
f ( x , y )e
2
vx v y
N
(1)
x 0 y 0
N 1 N 1
F (u, v)e
u 0 v 0
2
u x u y
N
(2)
Properties of DFT
Fast transform
Good energy compaction; however requires
complex computations
very useful in digital signal processing,
convolution, filtering, image analysis
CR = 75%
CR = 85%
CR = 90%
DWT
31.24
30.29
29.06
KLT
30.92
29.23
28.47
DCT
29.26
26.32
24.49
CR = 75%
CR = 85%
CR = 90%
KLT
3.68
3.79
3.95
DWT
1.31
1.33
1.34
DCT
1.1
1.15
1.21