





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















Image Compression-II 1
Week IX
Data redundancy
Self-information and Entropy
Error-free and lossy compression
Huffman coding
Predictive coding
Transform coding
Image Compression-II 3
have similar values.
simultaneously distinguish all colors.
L l r p r A avg k k
L
r k
=
"
0
1
Consider equation (A): It makes sense to assign fewer bits to those r k for which p r (r k ) are large in order to reduce the sum.
this achieves data compression and results in a variable length code.
More probable gray levels will have fewer # of bits.
Image Compression-II 7
symbol
decoder
Σ
Compressed
image e n
f n Predictor
f n
original
image
Prediction error:
e n = f n
e n
is coded using a variable length code (symbol encoder)
f n = e n
Example 1: ˆ f n
=Int! i
f n " i i = 1
m
$
%
&
'
(
)
Example 2: ˆ f n
(x,y)=Int! i
f ( x , y " i )
i = 1
m
$
%
&
'
(
)
x
y
f(x,y)
In 2- D
xy
Past information
Current pixel f (x,y)
= Σ α (x’, y’) f (x’, y)
(x’, y’) ε W xy
Image Compression-II 9
!
!
Prediction error image
Histograms of original and error images.
ˆ (,)[(,1) fxyIntfxy =!
Image Compression-II 13
f(x,y)
symbol
encoder
e n e n
f n
.
f n
This feedback loop prevents
error building
**f n = e n
.
. (^) ^
.
Compressed
image
Compressed
image
Symbol
decoder
f n e n
f n
**f n = e n
.
. (^) ^
. . uncompressed
image
f e f
e f
n n n
n n
!
1
f f
e
e
e
n n
n
n
n
!
1
and
Example:
0 < α < 1
prediction coefficient
Image Compression-II 15
with feedback
f n
e n
e n
.
f n
.
f n
f(x,y)
e n e n
f n
.
f n
Note: The quantizer used here is-- floor (e n
/2)*2. This is
different from the one used in the earlier example. Note
that this would result in a worse response if used without
Feedback (output will be flat at “ 0 ”).
.
{14, 15, 14, 15, 13, 15, 15, 14, 20, 26, 27, 28, 27, 27, 29, 37, 37, 62, 75, 77, 78, 79, 80, 81, 81, 82, 82}
Image Compression-II 19
Section 8.2.
Image Compression-II 21
Construct
n X n
subimages
Forward
transform
Quantizer
Symbol
encoder N X N
images
Compressed
image
Compressed
image Symbol
decoder
Inverse
transform
Merge
n X n
subimages
Uncompressed
image
Blocking artifact: boundaries between subimages become
visible
DFT
Discrete Cosine Transform (DCT)
Wavelet transform
Karhunen-Loeve Transform (KLT)
….
y = 0
n! 1
x = 0
n! 1
v = 0
N! 1
u = 0
N! 1
Image Compression-II 25
Ahmed, Natarajan, and Rao, IEEE T-Computers, pp. 90-93,
Consider 1 - D first; Let x(n) be a N point sequence 0 n N - 1.
x(n)
2 - N point
y(n)
point
Y(u)
point
C(u)
!!
"
"
= + # # =
!! #
$
% &
DFT (^) N N
y n x n x N n
x n n N
x N n N n N
2
2 1
0 1
2 1 2 1
( ) ( ) ( )
( ),
( ),
x(n)
y(n)
Image Compression-II 27
Y ( u ) = y ( n )exp! j
2 "
2 N
un
$
%
&
'
( n = 0
2 N! 1
= x ( n )exp! j
2 "
2 N
un
$
%
&
'
( n = 0
N! 1
2 "
2 N
un
$
%
&
'
( n = N
2 N! 1
= x ( n )exp! j
2 "
2 N
un
$
%
&
'
( n = 0
N! 1
2 "
2 N
u ( 2 N! 1! m )
$
%
&
'
( m = 0
N! 1
= exp j
"
2 N
u
$
%
&
'
(
x ( n )exp! j
"
2 N
u! j
2 "
2 N
un
$
%
&
'
( n = 0
N! 1
"
2 N
u
$
%
&
'
(
x ( n )exp j
"
2 N
u + j
2 "
2 N
un
$
%
&
'
( n = 0
N! 1
= exp j
"
2 N
u
$
%
&
'
(
2 x ( n )cos
"
2 N
u ( 2 n + 1 )
$
%
&
'
( n = 0
N! 1
The N-point DCTof x(n), C(u), is given by
C ( u ) =
exp! j
"
2 N
u
$
%
&
'
( Y^ ( u ),^0 )^ u^ )^ N-^1
0 otherwise.
,
,
The unitary DCT transformations are:
F ( u ) = .( u ) f ( n )cos
"
2 N
( 2 n + 1 ) u
$
%
&
'
( ,
n = 0
N! 1
.( 0 ) =
1
N
, .( u ) =
2
N
for 1 ) k ) N! 1.
The inverse transformation is
f ( n ) = .( u ) F ( u )cos
"
2 N
( 2 n + 1 ) u
$
%
&
'
( ,
n = 0
N! 1
Image Compression-II 31
Image Compression-II 33
Blocking artifacts less pronounced in DCT than in DFT.
Good approximation to the Karhunen-Loeve Transform (KLT) but
with basis vectors fixed.
DCT is used in JPEG image compression standard.
Image Compression-II 37
Zonal coding:
i th coefficient
in each sub
image
(1) Compute the variance of each
of the transform coeff; use the
subimages to compute this.
(2) Keep X% of their coeff. which
have maximum variance.
(3) Variable length coding
(proportional to variance)
Bit allocation: In general, let the number of bits allocated be made
proportional to the variance of the coefficients. Suppose the total
number of bits per block is B. Let the number of retained coefficients
be M. Let v(i) be variance of the i-th coefficient. Then
b ( i ) =
B M
1 2
log 2
v ( i )!
1 2 M
log 2
v ( i )
i = 1
M
Zonal Mask & bit allocation: an example
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 1 1 0 0 0 0 0
1 1 1 1 0 0 0 0
1 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0
4 4 0 0 0 0 0 0
6 5 4 0 0 0 0 0
7 6 5 4 0 0 0 0
8 7 6 4 3 0 0 0
Image Compression-II 39