Vous êtes sur la page 1sur 6

2008 IEEE Asia-Pacific Services Computing Conference

A Color Clustering Algorithm For Cloth Image

Xinrong Hu Naixue Xiong Shuqin Cui Wang Hui Jianchun Wang Dept. of Computer Science & Technology, Wuhan University of Science&Engineering, Wuhan, China,430074 E_mail:hxr@wuse.edu.cn Abstract
Color clustering is fluently exploited for many applications, especially in the fields of computer graphics and image processing. After studying the methods of color clustering, a new scheme based on ant colony clustering algorithm applied in cloth images is proposed in the paper. According to the pick up-drop theory, an improved ant algorithm is applied to group colors into certain clusters in the RGB space. Experimental result shows that the algorithm proposed in this paper has the advantages of an excellent robustness, a less time consumption, a simple realization and fitting for cloth image.
Keywords: ant colony algorithm, color clustering, color quantization, pick up-drop, cloth image

distribution. Color clustering is also called color quantization. When a color image is showed on some display hardware that can't show the full color of the color image, the computer needs to choose an appropriate set of representative colors and map each pixel of the image into these colors. This process is called color quantization[1]. Although a full color system using 8-bit of each component (Red, Green and Blue) is commonly used now to specify the color of each pixel on the screen, color quantization is still a powerful method for color image size reduction. The quantizer converts the 24-bit/pixel color image into the 8-bit indexed color with a set of representative colors[2](256 typically). Therefore, the size of the quantized image is 3 times reduced. This makes the color quantization process be fluently exploited for many applications especially in computer graphics and image processing.But traditional clustering analysis has not the samples with similar and consistent properties to be references before they are clustered.And only some samples are given in these approaches, and then they can be clustered according to their own properties. But how much clusters these samples can be clustered are always unknown. Over the past decade, several techniques have been proposed for color clustering [3-7]. All these approaches can be divided into two major types: hierarchical clustering algorithm and segmented clustering algorithm. The perform of hierarchical clustering algorithm is a hierarchical and classified tree, while the perform of segmented clustering algorithm is some disjoint clustering sets[8-9]. The segmented clustering algorithm also includes two types: tentative algorithm and iterative algorithm. Between these two algorithms, the first one always completes clustering

1. Introduction
Many people mainly concentrate on the studies of gray images for a long time and have obtained many good researches. But the color images are like to provide more information than the gray images. Among various low-level features, the color information has been extensively studied because of its invariance with respect to image scaling and orientation. At the same time, all the natural objects around us are color too. So studies on color image attract more and more researchers. Because of the data that color image included is very greatly, it will bring the time depletion while doing the complicated processing, such as color images recognition, color images indexing and retrieval, color images coding, color image segment, and so on. The colors of cloth image are disciplinarianly distributed. We can separate different areas of the color cloth image with the colors and its
978-0-7695-3473-2/08 $25.00 2008 IEEE DOI 10.1109/APSCC.2008.78 1500

according to a certain nearing principle. Its advantage is a simple computation, but the clustering effect cannot be predicted because of lacking error measure mechanism. The second one completes clustering after it came to an iteration circle from an initial segment to a certain superior control function. The main iterative algorithms are C-mean algorithm, ISODATA algorithm[2]. Its advantage is solving the error adjustment problem, but some parameters such as color numbers of cluster and original clustering center must be decided earlier. Another iterative algorithm is so called adaptive algorithm. It divides the color space into disjoint regions by consecutive splitting up the color space and uniting iteration, until a satisfying result is achieved. Generally, color image quantization can be separated into two steps i.e. color reduction or selection and pixel mapping [10]. The first step involves the color selection, which is a subset chosen from the true color space. In the second step, input pixels of the original image are mapped to colors from the palette. Among the steps of color image quantization, according to the above-mentioned approaches, because of needing to carry on the calculation and comparisons for color of each pixel of the image one by one in order, so time complications is very high. To avoid this disadvantage, a color quantization algorithm based on ant colony cluster algorithm is proposed in the paper. This paper was organized as follows. In Section 2, we introduced the ant colony cluster algorithm. We explained our proposed approach in Section 3. Finally, experimental results were introduced in Section 4.

to find the closest route to a food source or some other interesting landmark. How millions of ants are formed a tribe? How they complete the tasks through coordination, division and cooperation with each other? How information with complex structure like ant nest store in an ant colony? What happens when an ant colony following a shortest path between a food source and the nest gets interrupted by an obstacle appearing somewhere in the path? It is a research field of complex system. That is, a relative simple individual organizes a foraging behavior through cooperation without a centralized control. The complex social behaviors of ants have been much studied by science, and computer scientists are now finding that these behavior patterns can provide models for solving difficult combinatorial optimization problems. Ant colony algorithms [11] is inspired by the behavior of natural ant colonies, in the sense that they solve their complex problems such as building nest, looking for foods, migrating and cleaning by multi agent cooperation using indirect communication through modifications in the environment. It is a distributed and elicited search algorithm to simulate one aspect of ant behavior, the ability to find what computer scientists would call shortest paths. It is proposed by Colomi[12] earliest and mainly used to solve some complex combinatorial optimization problems such as Traveling Salesman Problem[13], Job Shopping Scheduling Problem[14], Graph Coloring Problem[15], etc. The ant colony-clustering algorithm proposed in the paper will be introduced through the shortest path strategy base on ants pick-drop behavior.

2. Ant colony clustering algorithm

2.2 Ant Colony clustering algorithm 2.1 Introduction of ant colony algorithm
Biologists discover a queer appearance in the nature The behavior of social insects in general, and of ants living in colonies in particular, has fascinated researchers in ethologic and animal behavior for a long time. As known, Real ants are capable of finding the shortest path from their nest to a food source without visual sensing. They are also able to adapt to changes in the environment. Individually each ant is blind, frail and almost insignificant yet by being able to co-operate with each other the colony of ants demonstrates complex behaviors. One of these is the ability in their studies, which is the ants can assemble the ant bonuses in the ant nest into some heaps. If there is an ant bones heap, it will attract the other ants to put more and more bones on the heap. So a few bigger bones heaps are formed at end. Deneubourg[16] explained the appearance mentioned above, and proposed one model(BM -basic model) to describe the ants clustering behavior. The general idea is that an individual ant could pick up and drop an object at some location where more objects of


the similar type are present. There are two major factors that should influence any local action taken by the ant-like agent: the number of objects in its neighborhood, and their similarity (including the object carried by one ant).That is, when a randomly unloaded moving ant encountered an object, the less similar objects around the object loaded by the ant, the more probabilities for the ant to pick it up. Otherwise, the more similar objects around the object, the more probabilities for an ant to drop it. So it can assure that the objects in the bigger heaps are not destroyed, and some individual objects can be clustered in a small heap. Inspired by social insects clustering behavior, specialists tried to propose many clustering algorithm. In the paper, the ant colony clustering algorithm applied in color image quantization is proposed to follow the ants picking up and dropping object behaviors. Experiment result shows that the approach used in the paper can cluster similar objects in a same kind, such as color image segment, data mining, VLSI design, etc. The BM model interpreting the behavior where the spatial structure of the nest emerges as a result of sample, local interactions without the need for any centralized control or global representation of the environment. Lumer and Faietas model [17] have generalized Deneubourg et al.sbasic method, and extended it to exploratory data analysis by introducing a measure of dissimilarity between data objects. The general idea is: (1) Randomly put the original data objects on a plane, and then some virtual ants will be generated from the coordinates on the plane. That is, as clustering centers, these data objects have their own properties; (2)The behavior of an isolated ant on the plane is similar to that in the BM mentioned above. The different is that the first looks for some similar but not same data objects within its neighborhood. Assume a data set of clustering analysis O={Oi|Oi=(oi1 ,oi2,.oim)} means a food sources set that ants looks for. Then integrated similarity criterion is
f (Oi , O j ) =
Ojarea ( Oi , r )

Here d (Oi , O j ) is the weighted distance between data objects Oi and O j ;

Pk is an adaptive weighted parameter, its value

can be adjusted dynamically according to its benefit to the clustering process; area(Oi , r ) is the local clustering region of data object Oi with clustering radius r ; f (Oi , O j ) is the similarity of data objects Oi and
O j ,if weighted parameter Pk is selected well, then

0 f (Oi , O j ) 1.While f (Oi , O j ) =0,the similarity is least, while f (Oi , O j ) =1,the similarity is biggest. It can be seen form Formula (1) that the more similar data objects Oi and O j , the smaller distance
d (Oi , O j ) and the bigger similarity f (Oi , O j ) .

(3)Convert the similarity of data objects into picking-up or dropping data objects probability with probability conversion function. The models of probability conversion function[18] include: Picking up data objects probability: Dropping data objects probability:
pp = ( 1 )2 1+ f / fp

pd = (

1 )2 1 + fd / f

Where f p is the similarity threshold of the current data object which picked up data object, f d is the similarity threshold of the current data object with dropped data object. In our paper, a simplified probability conversion model is introduced: Picking up data objects (3) probability:

p p = 1 f (Oi ,Oj )

Dropping data objects probability:

pd = f (Oi , O j )


If the ant is unloaded, compute picking up probability Pp , if the ant is loaded, compute dropping probability Pd . (4) According to the probability of Pp or Pd , the clustering behavior of an isolated ant is completed. That is, similar data objects can be grouped in a cluster around a

1 d (Oi , O j ))


d (O i , O

) =

p k ( o ik , o



clustering center.

k =1


Assume P0 is the probability threshold, whether O j is grouped in the cluster of Oi dependes on following rules: Compared Pp and Pd with P0 respectively. If an ant is unloaded and Pp < P0 , the ant does not pick up data object, another data object is randomly given to the ant; else the ant picks up data object, the state of the ant becomes loaded. If an ant is loaded and Pd > P0 , the ant drops data object, the properties of the ant are given to data object, the state of the ant becomes unloaded, else the ant continues moving loaded with data objects. Assume Ci={Oj| f (Oi , O j ) f j=1,2,I},where

ant and loaded ant can be designed in Figure 1. The purpose of color image quantization is to choose some representative colors from the color image. It consists ten steps to achieve a less distortion result. They are described in detail as follows: 1) Clustering centers selection:Some representative data points are selected from the color image according to the experience or requirement as original clustering centers. There are many approaches to get representatives data points. In this paper, cluster numbers are decided by experiments according to the characteristics and properties of the basis problem. Then some suited data points are found from the data set to be original clustering centers. typedef struct Ant_unloaded { int x; // The X coordinate of the ant // The Y coordinate of the ant int y;

Ci is a set grouped in a cluster of data object O j , the ideal clustering cluster is gained according to following formula:
Ci = 1 I


}; typedef struct Ant_loaded { int x; // The X coordinate of the ant int y; // The Y coordinate of the ant BYTE red; // The color of the data object: red weighted BYTE green; // The color of the data object: green weighted BYTE blue; //The color of the data object: blue weighted };

j =1

Here O j C i It is called ideal center, because it is maybe not present in the set.

3. Our proposed techniques

In this section, we propose our scheme in Section 3.1, and also analyze the possible performance based on the relevant data in Section 3.2.

3.1 Our proposed scheme

typedef struct data_object Color quantization is the process of grouping n data points to k cluster. In according to cluster analysis based on ant colony algorithm mentioned above, data of a color image include can be treated as the ants with different characteristic, while cluster centers can be treated as the ant heaps that the ants want to look for. So the process of color clustering can be treated as a process of ants looking for their own heaps. In this experiment, the data structure of the unloaded };
Figure 1 data structure of ant

{ BYTE red; // The color of the data object: red weighted BYTE green; // The color of the data object: green weighted BYTE blue; // The color of the data object: blue weighted


2) Parameters initialized: such as adaptive weighted coefficient p, initial ant number num, the radius of clustering area r, and other parameters. 3) Color image to be clustered is put on the plane randomly, every coordinate pair (x, y) of image (pixel) is regarded as a virtual ant. It is assumed that the ants original state is loaded. 4) The data set of ants starts to clustering cycle. According to formula, the similarity between data object and the other data object within a local region with radius r:
f (Oi , O j ) =
Ojarea(Oi , r )

in Figure 2. As illustrated in Figure 2, the original image aggregately contained more than eighty kinds of colors. Generally, the pattern of cloth image is distinct and easily identified. With our clustering scheme, the colors of original image can be grouped twelve clusters illustrated in Figure 3. In our scheme, the color space is restricted to the RGB color space. Compared with median-cut algorithm[2], which is widespread used in image applications, the ant colony algorithm spreads the clustering error throughout the entire image while the median-cut algorithm tends to consider its error in some image region. The proposed algorithm in the paper seems to work well for the problem considered. The empirical results also reveal the importance of using optimization techniques clustering data objects. In this paper, our focus was to group similar data objects of a color cloth image into a cluster. Compared the two images, we can see that, though colors are incorporate, but main colors and contours of color quantized image are similar to original image. The dominant color of a cluster comes from the color with more pixels in a color image so that it avoids image distorting produced by executing traditional quantization algorithm. Consequently, it is an ideal quantization algorithm for color image.

1 d (Oi , O j ))

data object Oi and O j are variables of data type struct data_object mentioned above, they consist three partitions: red color, green color and blue color. 5) If the ant is loaded, data drop probability Pd can be computed according to Formula 4), else if the ant is unloaded, data picking-up probability pp is computed according to Formula 3). 6) Compare

pp and

pd with a threshold


respectively. According to the result of pp and pd comparing with Pk , the cluster behavior of a single ant is completed. At last, some cluster centers are formed and some similar data are incorporated a cluster. 7) If all the ants in the data set finish actions of pick-up or drop data, then continue to execute the next step, else select a next ant without any actions of pick-up or drop data to go to do step 4). 8) Adjust adaptive weighted coefficient p and other parameters such as cluster center, etc. 9) If data clustering is not completed, go to do step 4) and continue cycle; else output the clustering result, end the algorithm.

Figure 2 Original Cloth Image


Performance analysis
To demonstrate the results of our color cloth image

clustering algorithm, we have selected a 24-bit color cloth image. In order to satisfy vision, the original image is particulated before clustering. The original image is shown
Figure 3 Colors Clustered Cloth Image


4. Conclusions
We have proposed a new color image clustering scheme based on ant colony clustering algorithm. It is simple to implement and achieve a good result. Future research will also incorporate more color quantization algorithms to improve color image quantized qualities from the clustered data. The contribution of different clustering algorithms will be also investigated to improve the applications of color image.

[11] E. Bonabeau, M. Dorigo and G. Theraulaz. Swarm Intelligence: from natural to artificial systems. Oxford, 1999 [12] Colorni A.,Dorigo M.,Maniezzo V. Distributed

Optimization by Ant Colonies. Proceeding of The First European Conference Artificial Life, 1991:134-142 [13] M. Dorigo, L.M. Gambardella. Ant Colonies for the Traveling Salesman Problem. Biosystems 43,1997:73-81 [14] Demirkol E., Mehta S., Uzsoy R. Benchmarks for Shop Scheduling Problems. European Journal of Operational Research,1998,Vol.109(1):137-141 [15] Tommy R.J.,Bjarne T. Graph Coloring Problems. Wiley

[1] What is color quantization?

press,1994 [16] L.Deneubourg, S.Aron, S.Goss, and J.M. Pasteels. The Selforganizing Exploratory Patterns of the Agentine Ant. Journal of Insect Behaviour, 1990,3:159-168 [17] Lumer E., and Faieta B. Diversity and Adaptation in Populations of Clustering ants. Proceeding of the 3rd Conference on Simulation of Adaptive Behavior,MIT Press, 1994:499-508 [18] Wu Bin, Zheng Yi, Liu Shaohui, Shi Zhongzhi. CSIM:a Document Clustering Algorithm Based on Swarm Intelligence. Proceedings of the 2002 Congress on Evolutionary

http://www.faqs.org/faqs/jpeg-faq /part1/section-8.html [2] P. Heckbert. Color image quantization for frame buffer display. Computer Graphics 1982,Vol.16(3):297307

[3] Heckbert P. Color Image Quantization for Frame Buffered Display. Computer Graphics, 1982, Vol.16(2):297-307 [4] Ling Ling. Research on Color Image Quantization Methods. Journal of South China University of Technology, 2000, Vol.28(1): 81-85 [5] Xia Wan, C.C.Jay Kuo. A New Approach to Image Retrieval with Hierarchical Color Clustering. IEEE Transactions on Circuits and Systems for Video Technology, 1998,Vol.8(5)::628-642 [6] K. Kanjanawanishkul, B. Uyyanonvara. Fast Adaptive Algorithm for Time-Critical Color Quantization Application, Proc. VIIth Digital Image Computing: Techniques and Applications, 2003:781-790 [7] Ashdown I. Octree Color Quantization. Radiosity-A Programmer's Perspective, Wiley, 1994 [8] A.H. Dekker. Kohonen Neural Networks for Optimal Colour Quantization. Network Computation in Neural Systems,1994,Vol. 5: 351-367 [9] Geng Guo-hua. Analyzing the Quality of Some Common Used Algorithm of Color Quantization. Mini-micro System, 1990,11 : 52-58 [10] Wu Yin_qian, Hu Xin_rong, etc. A new Approach to Color Quantization of Images Based on Neural Networks. The Journal of 2000,2: 33-36 Wuhan Automotive Polytechnic University,

Computation, USA, 2002: 477-482

This work is funded by the China National Textile And Apparel Council (20007083) and Hubei Digital Textile Equipment Key laboratory (DTL200702), it is greatly appreciated.