Informatica 29 (2005) 261–269 261
A Color Image Quantization Algorithm Based on Particle Swarm
Optimization
Mahamed G. Omran and Andries P. Engelbrecht
Department of Computer Science
University of Pretoria
Pretoria 0002, SOUTH AFRICA
E-mail: mjomran@engineer.com, [email protected]
Ayed Salman
Department of Computer Engineering
Kuwait University
KUWAIT
Phone: +965-4811188-5833 Fax: +965-4817451
E-mail: [email protected]
Keywords: Color image quantization, K-means clustering algorithm, particle swarm optimization, post-clustering
quantization approaches, pre-clustering quantization approaches
Received: February 6, 2005
A color image quantization algorithm based on Particle Swarm Optimization (PSO) is developed in this
paper. PSO is a population-based optimization algorithm modeled after the simulation of social
behavior of bird flocks and follows similar steps as evolutionary algorithms to find near-optimal
solutions. The proposed algorithm randomly initializes each particle in the swarm to contain K
centroids (i.e. color triplets). The K-means clustering algorithm is then applied to each particle at a
user-specified probability to refine the chosen centroids. Each pixel is then assigned to the cluster with
the closest centroid. The PSO is then applied to refine the centroids obtained from the K-means
algorithm. The proposed algorithm is then applied to commonly used images. It is shown from the
conducted experiments that the proposed algorithm generally results in a significant improvement of
image quality compared to other well-known approaches. The influence of different values of the
algorithm control parameters is studied. Furthermore, the performance of different versions of PSO is
also investigated.
Povzetek: Evolucijski algoritem na osnovi jate ptičev je uporabljen za barvno obdelavo slik.
1 Introduction
Color image quantization is the process of reducing the
number of colors presented in a digital color image [2].
Color image quantization can be formally defined as
follows [27]:
Given a set of
S
′
N colors where
d
N
ℜ⊂
′
S and N
d
is
the dimension of the data space. The color quantization is
a map
S S
′′
→
′
:
q
f
where S
′′
is a set of
S
′′
N colors
such that
SS
′
⊂
′′
and
SS
′′′
< NN . The objective is to
minimize the quantization error resulting from replacing
a color
Sc
′
∈ with its quantized value Sc
′
′
∈
)(
q
f .
Color image quantization is an important problem in the
fields of image processing and computer graphics [27]:
• It can be used in lossy compression
techniques [27];
• It is suitable for mobile and hand-held
devices where memory is usually small [18];
• It is suitable for low-cost color display and
printing devices where only a small number
of colors can be displayed or printed
simultaneously [20].
• Most graphics hardware use color lookup
tables with a limited number of colors [8].
Color image quantization consists of two major steps:
• Creating a colormap (or palette) where a
small set of colors (typically 8-256 [20]) is
chosen from the (2
24
) possible combinations
of red, green and blue (RGB).
• Mapping each color pixel in the color image
to one of the colors in the colormap.
Therefore, the main objective of color image
quantization is to map the set of colors in the original
color image to a much smaller set of colors in the
quantized image [32]. Furthermore, this mapping, as
already mentioned, should minimize the
differencebetween the original and the quantized images
[8]. The color quantization problem is known to be NP-
complete [30]. This means that it is not feasible to find