Color Image Quantization Algorithm Based on Self-Adaptive Differential Evolution

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 K-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 K-means and particle swarm algorithm (PSO) for the color image quantization.


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 NPhard 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][6][7][8] has compared the color image quantization algorithm using PSO (PSO-CIQ) and several other wellknown color image quantization methods. The experimental results show that PSO-CIQ has higher performance.
Differential evolution algorithm (DE) [9][10][11] is a population-based heuristic search approach. DE has been applied to the classification for gray images [12][13][14]. In the literature [12][13][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 bymeans. 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.

Computational Intelligence and Neuroscience
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.

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: where and are the lower bound and upper bound of variable and ∏ =1 [ , ] is the feasible domain of this problem.
Then, the following crossover operation is performed to obtain a trial vector for each individual : where is trial vector, the crossover rate CR is a parameter on [0, 1], rand is a uniformly random value on [0, 1], and rnbr is a uniformly random integer on [1, ] 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 = { 1 , 2 , . . . , }. 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.

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 bymeans quickly. The mixed operation can simplify the search space of DE and improve its convergence speed. Update CR by formulas (6) Calculate ( , ) and ( , ) if ( , ) > ( , ) then , +1 = , else , +1 = , //selection Find the global optimal solution best = ( best 1 , best 2 , . . . , best ) Output the optimal colormap { 1 , 2 , . . . , } , = ( best 1+3( −1) , best 2+3( −1) , best 3+3( −1) ) , = 1, 2, . . . , Construct the quantized image Pseudocode 1: The pseudocode of the SaDE-CIQ.

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 [0, 255] 3 . 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 with colors in [0, 255] 3 , 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 image are 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.

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:

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 = { 1 , 2 , . . . , } represents a set of candidate colormaps. Each individual represents a candidate colormap with color triples in the RGB color space   Computational Intelligence and Neuroscience   (7): ] } } } , = 1, 2, . . . , .
The stopping condition of the algorithm is to reach a specified maximal number of iterations max .
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 [0, 255] 3 . -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 0.5 and 0.6 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.

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].

Images and Parameters
Set. The set of test images include Lena, Peppers, Baboon, and Airplane, which have the same size 512 × 512 pixels. They are shown in Figure 1.
The parameters in the SaDE-CIQ are set as the population size = 100, the maximal number of iterations max = 200, and the mixed probability = 0.05.
The PSO-CIQ has more parameters than the SaDE-CIQ. They are set as the swarm size = 100, the inertia weight = 0.72, the acceleration constants 1 = 2 = 1.49, the maximum velocity max = 0.4, and the maximal number of iterations max = 200. These parameters except for the last one are as same as those in the literature [5].

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. 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.

Analysis of Experimental Results. As shown in
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 thanmeans and PSO-CIQ; (iii) the SaDE-CIQ converges more quickly than the PSO-CIQ.

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.