Computational Intelligence and Neuroscience

Volume 2013, Article ID 231916, 8 pages

http://dx.doi.org/10.1155/2013/231916

## Color Image Quantization Algorithm Based on Self-Adaptive Differential Evolution

^{1}School of Mathematics and Statistic, Hubei Engineering University, Xiaogan, Hubei 432000, China^{2}School of Sciences, Wuhan University of Technology, Wuhan, Hubei 430070, China

Received 17 March 2013; Accepted 13 June 2013

Academic Editor: Daoqiang Zhang

Copyright © 2013 Qinghua Su and Zhongbo Hu. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

Differential evolution algorithm (DE) is one of the novel stochastic optimization methods. It has a better performance in the problem of the color image quantization, but it is difficult to set the parameters of DE for users. This paper proposes a color image quantization algorithm based on self-adaptive DE. In the proposed algorithm, a self-adaptive mechanic is used to automatically adjust the parameters of DE during the evolution, and a mixed mechanic of DE and -means is applied to strengthen the local search. The numerical experimental results, on a set of commonly used test images, show that the proposed algorithm is a practicable quantization method and is more competitive than -means and particle swarm algorithm (PSO) for the color image quantization.

#### 1. Introduction

Color image quantization, one of the common image processing techniques, is the process of reducing the number of colors presented in a color image with less distortion [1]. The main purpose of color quantization is reducing the use of storage media and accelerating image sending time [2]. Color image quantization consists of two essential phases. The first one is to design a colormap with a smaller number of colors (typically 8–256 colors [3]) than that of a color image. The second one is to map each pixel in the color image to one color in the colormap. Most of the color quantization methods focus on creating an optimal colormap. For being an NP-hard problem, it is not feasible to find the optimal colormap without a prohibitive amount of time [4]. To address this problem, researchers have applied several stochastic optimization methods, such as GA and PSO. In particular, the literature [5–8] has compared the color image quantization algorithm using PSO (PSO-CIQ) and several other well-known color image quantization methods. The experimental results show that PSO-CIQ has higher performance.

Differential evolution algorithm (DE) [9–11] is a population-based heuristic search approach. DE has been applied to the classification for gray images [12–14]. In the literature [12–14], DE and PSO show similar performance. However, due to simple operation, litter parameters, and fast convergence, DE is the better choice to use than PSO [12]. However, few researches have been done for using DE to solve the color image quantization. This paper applies DE to solve the color image quantization. However, the performance of DE is decided by two important parameters, the scaling factor and the crossover rate CR. In practice, it is difficult to set the two parameters. For this difficulty, this paper proposes a color image quantization algorithm based on self-adaptive DE (SaDE-CIQ). In SaDE-CIQ, the self-adaptive mechanics in the literature [15, 16] are used to automatically adjust the parameters of DE during the evolution, and -means is mixed into DE with a little probability for strengthening the local search. SaDE-CIQ starts with an initialized population, in which each individual represents a candidate colormap. A small number of candidate colormaps are adjusted by -means. Then the adjusted candidate colormaps and the rest ones are repeatedly updated by DE operations, in which the parameters are automatically adjusted. The optimal solution is the optimal colormap, by which the quantized image is generated. By some commonly used color images, the performance of SaDE-CIQ in the color image quantization is compared with that of -means and PSO.

This paper is organized as follows. Section 2 introduces the classical DE briefly. In Section 3, a self-adaptive mechanic of DE parameters and a mixed mechanic of DE and -means are introduced. In Section 4, SaDE-CIQ is proposed. In Section 5, numerical experiments are performed to compare the color image quantization qualities of SaDE-CIQ, -means, and PSO. Section 6 concludes this paper.

#### 2. Classical Differential Evolution

DE is a simple and powerful stochastic global optimization algorithm, and several DE variants or strategies have been presented. In this paper, we focus on the classical DE, which applies the simple arithmetic operations: mutation, crossover, and selection to evolve the population. Before the introduction of the classical DE, the following symbols used throughout this paper are defined:(i): objective function or fitness function, (ii): the dimension of an optimization problem,(iii): population size,(iv): population,(v): the th individual in the population , ,(vi): scaling factor, (vii): crossover rate.

Consider the following optimization problem: where and are the lower bound and upper bound of variable and is the feasible domain of this problem.

An initial population including individuals is generated randomly, where each individual , .

The following mutation operation is performed to generate a donor vector for each individual : where is donor vector, , , and are three uniformly different integers on , and the scaling factor is a parameter on .

Then, the following crossover operation is performed to obtain a trial vector for each individual : where is trial vector, the crossover rate is a parameter on , is a uniformly random value on , and is a uniformly random integer on for each different to assure that at least one component of is taken from the donor vector.

Finally, according to the fitness values of the fitness function, the population is updated by the following selection operation: where is the updated individual for the next generation population .

As stated previously, for obtaining the best solution of the fitness function , DE starts with a randomly generated initial population and repeatedly updates the population with the mutation, crossover, and selection operations until the stopping condition is satisfied.

#### 3. A Self-Adaptive Mechanic and a Mixed Mechanic of DE

The scaling factor and the crossover rate CR can influence the convergence and stability of DE. In practice, it is more difficult to set right and CR for user. One of the effective methods to solve this difficult problem is to self-adaptively control the parameters in DE during evolution. In the following SaDE-CIQ, and CR are automatically updated for each individual in each generation by the self-adaptive mechanics of the literature [15, 16]:

Generally, self-adaptively adjusting parameters maybe have negative effect on the performance of DE. For improving the color quantization quality of self-adaptive DE, a mixed mechanic is used in the following SaDE-CIQ. -means is a quickly cluster algorithm with better local search ability. In the mixed mechanic, a small number of individuals from a population are selected by a little probability . Before being updated by DE, the selected individuals are adjusted by -means quickly. The mixed operation can simplify the search space of DE and improve its convergence speed.

#### 4. Color Image Quantization Algorithm Based on Self-Adaptive DE

In RGB color space, each color pixel of a color image is a combination of red, green, and blue (RGB). For color images, the data space is . For a given color image , the color number of the image is set to be , and the set of all colors belonging to is set to be , called a colormap, is a subset withcolors in , where . The color image quantization is to design a colormap and to create a map , by which each color pixel in is replaced by one of the colors in . Thus, a new color image , called the quantized image of , with the colors in is constructed. The objective to quantize the color image is to minimize the color error between the color image and its quantized image .

The color image quantization consists of two major phases:(i)design a better colormap with a reduced number of colors (typically 8–256);(ii)create the mapping relationship between the color image and the colormap by which a quantized image is obtained.

In the process of color image quantization, it is most important to design an optimal colormap. To address this problem, researchers have applied some heuristic techniques for color image quantization. These techniques can be mainly categorized into preclustering approaches and postclustering approaches. Although being time consuming, the postclustering approaches are superior to the preclustering approaches in the quantization quality. Postclustering approaches perform clustering of the color space [17]. A postclustering algorithm starts with an initial colormap concluding colors. Each color pixel of the image is mapped to the color in the colormap with the minimal color distance from the color pixel. Thus, all the color pixels in imageare clustered into clusters whose centers are separately the colors in the colormap. Then the colormap and the clusters are iteratively modified to improve the optimum.

This section describes a new postclustering color image quantization approach using self-adaptive DE, called the color image quantization algorithm based on self-adaptive DE (SaDE-CIQ). A measure is given to quantify the quality of the resultant quantized image, after which the SaDE-CIQ is introduced.

##### 4.1. Measure of Quality

The mean square error (MSE) is the most general measure of quality of a quantized image [4]. It represents the color error between image and its quantized image . In the following SaDE-CIQ, the MSE is set to be the fitness function, which is defined as follows: where the symbols used in (7), which will be used in the remaining parts of this paper, are explained as follows:(i): the number of image pixels,(ii): the color number in the colormap, (iii): the th pixel of the color image , ,(iv): the th color triple in the colormap, .

##### 4.2. Description of the SaDE-CIQ

In the SaDE-CIQ, the classical DE with the previously mentioned self-adaptive mechanic and mixed mechanic is used for the color image quantization. A population represents a set of candidate colormaps. Each individual represents a candidate colormap with color triples in the RGB color space . Theth individual is denoted by where , . Thus, the dimension of each individual is , and the feasible domain is . The quality of each individual is measured by the MSE in (7): The stopping condition of the algorithm is to reach a specified maximal number of iterations .

In the first phase of the SaDE-CIQ, an optimal colormap is designed. A set of candidate colormaps are initialized. Each colormap consists of randomly selected color triples in the color space . -means is applied to adjust a small number of colormaps randomly selected from all the candidate colormaps by a little probability . Then the adjusted colormaps and the rest ones are repeatedly updated by mutation and crossover operations, where and CR with the initial values and are updated by formulas (5) and (6). The -means and DE operations are performed until the stopping condition is satisfied. The last optimal solution is the optimal colormap. In the second phase of the SaDE-CIQ, the mapping relationship is created according to the minimal color distance principle. By replacing each pixel in the color image with its corresponding color in the optimal colormap, is to be reconstructed to obtain the quantized image .

See Pseudocode 1 of the SaDE-CIQ.

#### 5. Numerical Experiments

In this section, the SaDE-CIQ is tested on a set of four commonly used test images in the quantization literature. In addition, the performance of the SaDE-CIQ is compared with that of -means and the color image quantization algorithm using PSO (PSO-CIQ) presented in literature the [5].

##### 5.1. Images and Parameters Set

The set of test images include Lena, Peppers, Baboon, and Airplane, which have the same size pixels. They are shown in Figure 1.

The parameters in the SaDE-CIQ are set as the population size, the maximal number of iterations , and the mixed probability .

The PSO-CIQ has more parameters than the SaDE-CIQ. They are set as the swarm size , the inertia weight , the acceleration constants , the maximum velocity , and the maximal number of iterations . These parameters except for the last one are as same as those in the literature [5].

##### 5.2. Experimental Results

For each algorithm, the test images are quantized into 16 colors. The colors quantized images with the smallest MSEs over 10 simulations are shown in Figure 2. The smallest MSEs and the largest MSEs over 10 simulations are listed in Table 1, and for SaDE-CIQ and PSO-CIQ, the MSE variations with the number of iterations are exhibited in Figure 3.

##### 5.3. Analysis of Experimental Results

As shown in Figure 2, the SaDE-CIQ outperforms -means and PSO-CIQ in the visual quality of the quantized images for all test images. The quantized images a-1, b-1, c-1, and d-1 have richer layers and more details than the other quantized images.

As illustrated in Table 1, the SaDE-CIQ generates a smaller MSEs than -means and PSO-CIQ for each test image.

Shown in Figure 3, the SaDE-CIQ has a smaller average MSE than the PSO-CIQ at each same number of iterations. Moreover, the average MSE resulting from the SaDE-CIQ decreases more quickly than that resulting from the PSO-CIQ with the increasing number of iterations.

The above experimental results can be summarized as follows: (i)the SaDE-CIQ is an effective color image quantization method; (ii)the SaDE-CIQ has better quantization quality than -means and PSO-CIQ;(iii)the SaDE-CIQ converges more quickly than the PSO-CIQ.

#### 6. Conclusions

This paper presents a color image quantization algorithm based on self-adaptive DE (SaDE-CIQ). Numerical experiments are implemented to investigate the performance of the SaDE-CIQ and to compare it against -means and PSO-CIQ presented in the literature [5]. For a set of commonly used test images, the experimental results demonstrate the feasibility of the SaDE-CIQ and its superiority to -means and PSO-CIQ in the quantization quality. In addition, the SaDE-CIQ has simpler operation, litter parameters, and faster convergence than the PSO-CIQ.

#### Acknowledgments

This work was supported in part by the National Natural Science Foundation of China under Grant no. 61070009, the Fundamental Research Funds for the Central Universities under Grant no. 2012-YB-19, and the Nature Science Foundation of Hubei, China, under Grant no. 2011CDC161.

#### References

- J.-P. Braquelaire and L. Brun, “Comparison and optimization of methods of color image quantization,”
*IEEE Transactions on Image Processing*, vol. 6, no. 7, pp. 1048–1052, 1997. View at Publisher · View at Google Scholar · View at Scopus - F. Alamdar, Z. Bahmani, and S. Haratizadeh, “Color quantization with clustering by F-PSO-GA,” in
*Proceedings of the IEEE International Conference on Intelligent Computing and Intelligent Systems (ICIS '10)*, vol. 3, pp. 233–238, October 2010. View at Publisher · View at Google Scholar · View at Scopus - P. Scheunders, “A genetic c-means clustering algorithm applied to color image quantization,”
*Pattern Recognition*, vol. 30, no. 6, pp. 859–866, 1997. View at Google Scholar · View at Scopus - M. G. Omran, A. P. Engelbrecht, and A. Salman, “A color image quantization algorithm based on Particle Swarm Optimization,”
*Soft Computing in Multimedia Processing*, vol. 29, no. 3, pp. 261–269, 2005. View at Google Scholar - Q. Sa, X. Liu, X. He, and D. Yan, “Color image quantization using particle swarm optimization,”
*Journal of Image and Graphics*, vol. 12, no. 9, pp. 1544–1548, 2007 (Chinese). View at Google Scholar - X. Zhou, Q. Shen, and J. Wang, “Color quantization algorithm based on particle swarm optimization,”
*Microelectronics and Computer*, vol. 25, no. 3, pp. 51–54, 2009 (Chinese). View at Google Scholar - Y. Xu and Z. Jiang, “A K-mean color image quantization method based on particle swarm optimization,”
*Journal of Northwest University*, vol. 42, no. 3, 2012 (Chinese). View at Google Scholar - F. Alamdar, Z. Bahmani, and S. Haratizadeh, “Color quantization with clustering by F-PSO-GA,” in
*Proceedings of the IEEE International Conference on Intelligent Computing and Intelligent Systems (ICIS '10)*, pp. 233–238, October 2010. View at Publisher · View at Google Scholar · View at Scopus - R. Storn and K. Price, “Differential evolution—a simple and efficient heuristic for global optimization over continuous spaces,”
*Journal of Global Optimization*, vol. 11, no. 4, pp. 341–359, 1997. View at Google Scholar · View at Scopus - Y. Shen, M. Li, and H. Yin, “A novel differential evolution for numerical optimization,”
*International Journal of Advancements in Computing Technology*, vol. 4, no. 4, pp. 24–31, 2012. View at Publisher · View at Google Scholar · View at Scopus - H. Li and J. Tang, “Improved differential evolution with local search,”
*Journal of Convergence Information Technology*, vol. 7, no. 4, pp. 197–204, 2012. View at Publisher · View at Google Scholar · View at Scopus - M. G. H. Omran, A. P. Engelbrecht, and A. Salman, “Differential evolution methods for unsupervised image classification,” in
*Proceedings of the IEEE Congress on Evolutionary Computation (IEEE CEC '05)*, pp. 966–973, September 2005. View at Scopus - S. Das and A. Konar, “Automatic image pixel clustering with an improved differential evolution,”
*Applied Soft Computing Journal*, vol. 9, no. 1, pp. 226–236, 2009. View at Publisher · View at Google Scholar · View at Scopus - Q. Su, Z. Huang, and Z. Hu, “Binarization algorithm based on differential evolution algorithm for gray images,”
*ICNC-FSKD*, vol. 6, pp. 2624–2628, 2012. View at Google Scholar - J. Brest, S. B. Bošković, V. Žume, and M. S. Maučec, “Performance comparison of self-adaptive and adaptive differential evolution algorithms,”
*Soft Computing*, vol. 11, no. 7, pp. 617–629, 2007. View at Google Scholar - J. Brest, V. Žumer, and M. S. Maučec, “Self-adaptive differential evolution algorithm in constrained real-parameter optimization,” in
*Proceedings of the IEEE Congress on Evolutionary Computation (CEC '06)*, pp. 215–222, July 2006. View at Scopus - S.-C. Cheng and C.-K. Yang, “A fast and novel technique for color quantization using reduction of color space dimensionality,”
*Pattern Recognition Letters*, vol. 22, no. 8, pp. 845–856, 2001. View at Publisher · View at Google Scholar · View at Scopus