Image Compression using
Vector Quantization
Nopparat Pantsaena
Manas Sangworasil
Chinnapat Nantajiwakornchai
Tanasak Phanprasit
Research Center for Communication and Information
Technology (ReCCIT)
King Mongkut’s Institute of Technology Ladkrabang (KMITL)
Bangkok, Thailand
Objective
This research presents the Splitting
solution to implement the Codebook,
which improves the image quality by
average Training Vectors and then splits
the average result to Codebook that has
minimum distortion.
2
Outline
Introduction
Codebook Design
Steps of LBG
Splitting Codebook design
Experimental and Result
Conclusion
3
Introduction
Source Image
1
2
3
Training Vector
..
..
Index (j)
1
2
3
16,384
Training Vector (xj(k))
x1(1)… x1(16)
x2(1)… x2(16)
x3(1)… x3(16)
x16384(1)… x16384(16)
4
Introduction
Training Vector
Index (j)
1
2
3
16,384
Training Vector (xj(k))
x1(1)… x1(16)
x2(1)… x2(16)
x3(1)… x3(16)
x16384(1)… x16384(16)
Codebook Design
Index (i)
Codebook ( x̂ i (k))
1
x̂1 (1)… x̂1 (16)
2
x̂ 2 (1)… x̂ 2 (16)
3
x̂3 (1)… x̂3 (16)
256
x̂ 256 (1)… x̂ 256 (16)
Codebook Table
5
Introduction
New Image (Index Table)
Codebook Table
i1
i5
i39
i10
i45
i45
i200
i54
i256
i96
i256
i54
i5
Index (i)
Codebook ( x̂ i (k))
i12
1
x̂1 (1)… x̂1 (16)
2
i78
x̂ 2 (1)… x̂ 2 (16)
3
x̂3 (1)… x̂3 (16)
i9
256
x̂ 256 (1)… x̂ 256 (16)
6
Introduction
Q: R Y
k
….(1)
Block diagram of Vector Quantization
Intro
7
Codebook Design
There are two kinds of Codebook
Random Codebook
Splitting Codebook
8
Comparison between Random
and Splitting Codebook Design
Splitting has certain loops to find new
codebook.
Splitting faster than Random algorithm.
Codebook’s size define by 2R.
Random technique will not work if R is
not an integer. But we can use the
Spitting algorithm.
9
Codebook Design
Linde-Buzo-Gray’s Algorithm (LBG)
xj(k)=[ xj(1) xj(2) xj(3)…xj(k) ]
j = 1,2,3,…,n; n = number of the image parts
k = vector dimension; (k=1,2,3,…,16)
10
Steps of LBG
Initial the value for Codebook
Codebook
Index (i)
1
2
Codebook ( x̂ i (k))
x̂1 (1)… x̂1 (16)
x̂ 2 (1)… x̂ 2 (16)
3
x̂3 (1)… x̂3 (16)
256
x̂256 (1)… x̂ 256 (16)
Xi(k)=[(1)(2)(3)…(k)]; i=1,2,3,…,Nc
Nc is number of vector in Codebook
Back
11
Steps of LBG
Grouping the Training Vectors
Vector group
Index (i)
1
2
Group 1 (Xj=1(k))
X1,1 (1)… X1,1 (16)
X1,2 (1)… X1,2 (16)
Index (i)
1
2
l 1 X j1
Group 256 (X256(k))
X256,1 (1)…X256,1 (16)
X256,2 (1)…X256,2 (16)
l256 X j 256
12
Steps of LBG
P((k) ) = (Si; i=1,2,3,…,Nc);
Si is the set of minimum distortion vectors
xj Si if
d ( x j , xˆi ) d ( x j , xˆl )
Minimum Distortion Values
1
d ( x j , xˆ i )
k
k
[ x j ( m ) xˆ i ( m )]
m 1
2
….(2)
13
Steps of LBG
Average distortion
The average distortion can be
calculated from each group, is given by
1 n
Dm 1 D[(Ym, P(Ym))] min d ( x j , xˆi )
n j 1 xˆYm
….(3)
14
Steps of LBG
Stop update the codebook if
Dm Dm 1
Dm 1
And we can obtain the New Codebook
Index (i)
1
2
3
New Codebook ( x̂ i (k)’)
x̂1 (1)’… x̂1 (16)’
x̂ 2 (1)’… x̂ 2 (16)’
x̂3 (1)’… x̂ 3 (16)’
256
x̂ 256 (1)’… x̂ 256 (16)’
15
Steps of LBG
Otherwise, the process will continue
update in the Codebook by average the
group in 2nd step vectors as:
xˆ ( P(Ym)) ( xˆ (S i ) ; i 1,2,3,..., Nc)
for P( x̂ i (k))
ˆ(S i )
x
1
Si
m
xj
….(4)
j:x j Si
16
Splitting Codebook design
Split the Codebook to 2 vectors:
x i j and x i j
START
Divide the image into small blocks
Arranging vector Ym={x1,x2,..xn}
Set M=1
then Ym={x1 ,x2 ,..x16}
Find centroid of vector by
xˆ1 (k )
n
1
x j (k )
n j 1
ni
Update Ym
M=2M
j
2
ˆ
(
x
)
i j
i 1
ni
LGB Algorithm
M=Nc
No
Yes
Keep Ym
END
17
Splitting Codebook design
From Training Vector, find the average
of Training Vectors for setting the
Codebook as follows
1 n
xˆ1 (k ) x j (k )
n j 1
….(5)
k=1,2,3,…,16
n =1,2,3,…,16384
Back
18
Splitting Codebook design
Split the Codebook to 2 vectors:
x̂1 (1) + 1 and x̂1 (1) - 1 , when 1 is the average value
ni
j
( xˆi j )
2
i 1
ni
ni =1,2,3,…,16
….(6)
1
j
ni
ni
xˆ
i 1
ij
….(7)
j =1,2,3,…,Nc
Back
19
Splitting Codebook design
Split the Codebook to 2 vectors:
x̂1 (1)
x̂1 (2)
Ym
x̂1 (3)
x̂1 (1)+ 1
x̂1 (2)+ 1
=
Y2m
x̂1 (3)+ 1
x̂1 (1) - 1
x̂1 (2)- 1
x̂1 (3)- 1
x̂1 (16)
x̂1 (16)+ 1
x̂1 (16)- 1
Back
20
Experimental and Result
The value of PSNR is calculated from
A
PSNR 20 log 10 (
)
RMSE
….(8)
RMSE
RMSE
1
N
2
[
f
(
i
,
j
)
f
(
i
,
j
)'
]
k 1
m
….(9)
when
f(i,j) is the gray level of pixel i in the original image
f(i,j)’ is the gray level of pixel i in the decompressed image.
N is the total number of pixels in the image.
21
Experimental and Result
PSNR [dB]
28
24
20
16
12
0.016
0.047
0.125
0.250
0.750
Bit Rate [bpp]
v qr
Figure1. Lena
v qs
22
Experimental and Result
PSNR [dB]
30
26
22
18
14
10
0.016
0.047
0.125
0.250
0.750
Bit Rate [bpp]
v qr
Figure 2. Milk drop
v qs
23
Experimental and Result
PSNR [dB]
24
20
16
12
8
0.016
0.047
0.125
0.250
0.750
Bit Rate [bpp]
vqr
Figure 3. Mandrill
vqs
24
Experimental and Result
PSNR [dB]
28
24
20
16
12
8
0.016
0.047
0.125
0.250
0.750
Bit Rate [bpp]
v qr
Figure 4. Girl
v qs
25
Conclusion
This paper proposed the
implementation of Codebook to Vector
Quantization image compression. From
the experiment, the Split Codebook can
achieve higher image quality than
Random Codebook at the same bits
rate. In another words, the proposed
algorithm achieves lower bits rate at the
same image quality
26
Thank you for your attention.
27
© Copyright 2026 Paperzz