The implementation of optimization methods for contrast enhancement

The performances of the multivariate techniques are directly related to the variable selection process, which is time consuming and requires resources for testing each possible parameter to achieve the best results. Therefore, optimization methods for variable selection process have been proposed in the literature to ﬁnd the optimal solution in short time by using less system resources. Contrast enhancement is the one of the most important and the parameter dependent image enhancement technique. In this study, two optimization methods are employed for the variable selection for the contrast enhancement technique. Particle swarm optimization (PSO) and artiﬁcial bee colony (ABC) optimization methods are implemented to the histogram stretching technique in parameter selection process. The results of the optimized histogram stretching technique are compared with one of the parameter independent contrast enhancement technique; histogram equalization. The results show that the performance of the optimized histogram stretching is better not only in distorted images but also in original images. Histogram equalization degraded the original images while the optimized histogram stretching has no effect due to being an adaptive solution.


INTRODUCTION
Optimization is one of the key mathematical process in computer science. It is briefly described as the selection of the best parameter within several alternatives, which gives the highest success in defined criteria [1]. Selection process is a maximizing or minimizing problem of a function. Each input values of function should be, systematically, calculated in terms of possible solutions. Otherwise, obtained findings for a special state might be misleading solution to use in the next state. In this case, each possible finding should be utilized in equation to form an optimal solution of function. However, this requires more system resources. Additionally, it increases the complexity of algorithm when a brute force technique is employed. Therefore, optimization techniques are necessary.
Optimization methods have been used extensively in many real world applications such as airspace surveillance systems [2], image processing on embedded systems [3], automatic parking systems [4] etc. Optimization techniques provide not only the high success in results but also the low complexity, processing * Correspondence Author. E-mail: aelbir@yildiz.edu.tr times, and memory requirements in running systems. Therefore, real time systems require the best optimization technique to obtain quick response and correct analysis [5]. Image processing is another challenging field, which requires more optimization due to the high dimensions of input and more parameter dependent algorithms. Edge detection, segmentation of objects by clustering or classification, object tracking, image enhancement are several well-known image processing problems that need optimization for the best results and utilization in real time systems. In this study, we utilize two optimization techniques to optimize parameters for contrast enhancement technique to enhance images.
Image enhancement is a pre-processing technique providing better quality images in order to extract more informative features. According to [6], image enhancement techniques are mainly divided into spatial and frequency domain analyses. Histogram stretching and equalization, negative image, exponential or logarithmic transformation are some examples of spatial domain enhancement while the filters with different tuning are the main process in frequency based enhancement techniques [6,7]. Mostly image enhancement techniques are multi parameter dependent. Therefore, algorithms should be well tuned for obtaining the best enhanced image. However, the configuration process might be time consuming and also have high complexity. Images are in two-dimensions, hence, techniques can perform inefficiently and slowly over images as a result of limited system resources. Hence, image enhancement techniques with optimization methods provide better enhancements on images with fewer resources and shorter time requirements. Optimization decreases the complexity of enhancement process. However, results can be different according to selected optimization method. Therefore, different methods should be tested on the problem. In this study, we tested two nature inspired optimization methods (particle swarm optimization (PSO) and artificial bee colony (ABC)).
PSO is the most well-known technique in optimization theory. Kennedy and Eberhart firstly proposed it in 1995 [8]. The algorithm was inspired by the flock of bird and shoal of fish. PSO can be utilized in many problems. Malik et al. performed PSO and genetic algorithm on image histogram to enhance the image in their study [9]. Additionally, Gorai et al. also reviewed PSO and genetic algorithm usage on several problems and presented as a comparison study [10]. Another PSO based optimization was used by Dikmen et al. [11]. They utilized the PSO on image enhancement problem by increasing the differences between minimum and maximum Lumina values of histogram. Zhuang used improved version of PSO, Center Based Particle Swarm algorithm, in wavelet transform for de-noising signals [12]. He select the optimal threshold for each sub-band in different scales of wavelets. As a result, de-noising does not require any prior knowledge of the noise due to the learning type of the noise from the signal itself intelligently. Yang et al. have also used PSO to enhance performance of the artificial neural network in tracking control for under actuated ships [13]. He select the optimal values for the best quantization factor curves using in neural network by PSO The ABC algorithm is a swarm based meta-heuristic algorithm that was introduced by Karaboga in 2005 [14] for optimizing numerical problems. It was inspired by the intelligent foraging behavior of honeybees. Subramaniam et al. implemented the ABC algorithm in the classification of brain cancer images by Neural Network [15]. Singh tested the ABC algorithm on minimum spanning tree problem and compared to genetic algorithm, particle swarm optimization algorithm, differential evolution algorithm, and evolution strategies [16]. Performance of ABC was reported to be better or similar to those of other populationbased algorithms with the advantage of employing fewer control parameters. In another recently published study, Kuru et al. implemented ABC in reactive power optimization problem [17]. They used a variation of ABC, Chaotic Artificial Bee Colony and Henon map against random number generator in decreasing of active power losses, voltage control, and for the optimization of the power coefficients in power systems. Additionally, optimization is employed for adaptive filtering [18]. They used the Lagrange multiplier theory as an optimization tool.

MATERIALS AND METHODS
This paper mainly focuses on the integration of optimization theory with one of the image enhancement idea. Tampere Im-age Dataset (TID2008) [19] was used to test the proposed optimized approaches of histogram stretching and regular histogram equalization technique in this study. Ponomarenko et al. totally performed 17 distortion effects on 25 reference images with 4 different levels [19]. As a result, dataset includes 1700 images having 512 × 384 pixel resolutions. Histogram stretching and equalization has, typically, effects on the pixel values. Main idea is to adjust the contrast levels. Therefore, we only selected contrast based distorted images with its levels. In this respect, 100 distorted and 25 original images were selected to evaluate techniques. One of the images with its contrast-based distortion in different levels is presented in Figure 1.
Tests were performed on not only distorted images but also original images to see the effect of the proposed techniques. One of the contrast enhancement technique; histogram stretching, was utilized within the image enhancement idea, and the optimization theory was applied on the determination of variables. Addition to parameter dependent technique, a non-parametric contrast enhancement technique; auto histogram equalization, was performed on images. Comparison of optimized parameter dependent and independent contrast enhancement techniques was made based on several metrics. Flowchart of this study was presented in Figure 2. Each step is explained in sub-headings with employed parameters in tests.

Standard histogram equalization
Histogram equalization is contrast adjusting based image enhancement technique. It automatically modifies the histogram curve by using the pixel probabilities in the image [20]. Firstly, the probability mass function (PMF) are calculated for all pixels in image. Then, cumulative distributive function (CDF) are computed by using the PMF and multiplied by levels to find the new pixel intensities. The general formula of the method is presented in Eq. 1, where L is the multiplication level for the calculated CDF( p n ) and indicates the bit number of possible color or intensity values, f i, j indicates the coordinates of pixels corresponding to i th row and j th column, g i, j refers to the generated new image pixel.

Histogram stretching
Mathematical operations are performed on the pixel values of images in histogram stretching technique [21]. In this study, we applied multiplication, addition and root extraction operations to pixel values. The coefficients of the operations are the key parameters to sustain an efficient enhancement algorithm for each image. Constant values cannot be utilized. Therefore, an adaptive coefficient specific to each image should be utilized. In this respect, PSO and ABC optimization techniques are employed to determine the best optimal coefficients of implemented mathematical operations. Each optimization process requires a convergence to stop iteration and find the best parameters. In this study, Equation 2 is utilized in the definition of the convergence  point.
where I indicates the intensity values of image t and n refers to the number of color in the histogram chart of the image t. The invariability of the S within the certain range is the convergence criteria for the employed optimization techniques. If the S value is stable during the last k iteration of optimization process, histogram stretching will be terminated. k can be selected as an arbitrary constant. Equation 3 indicates the stopping criteria.
We arranged 100 iteration as the convergence limit with ±20 reference zone for the invariability detection of the S for both optimization technique in the histogram stretching. Equation 4 indicates the utilized histogram stretching formula.
where I i, j is the intensity values of image at i th and j th location α, β and γ are the tuning parameters of the stretching as scaling, shifting and degrading of the image contrast respectively. PSO and ABC optimization methods will be implemented on α, β and γ parameter selection process. g i, j indicates the obtained new pixels by the histogram stretching.

Particle Swarm Optimization (PSO)
The combination of particles forms the "swarm" while each element represents the "particle" in PSO algorithm. The particles start exploring the best optimum by taking random values in the solution space. Each particle has two vector components; the vector x for position and the vector v for velocity. The position vector holds the position information of the particle, and the velocity vector stores the change of position and direction information of the particles. PSO basically relies on transferring the current position of each particle in the swarm to the best position for particle (pbest) that has been found before and the best global position for swarm (gbest) that has been found so far. All particles try to orient themselves to these two best positions with their velocity vectors. Updating process of velocity and position are calculated by using Eq. 5.
where c 1 and c 2 are the constants for learning parameters leading the particles to the its pbest and gbest position. Generally, 2 is selected in practice. rand k 1 and rand k 2 are randomly selected numbers between [0-1] in uniform distribution at iteration k. W represents the weight of inertia to be used in definition of balance between local and global searching. v k i and x k i indicates the velocity and position of i th particle in swarm at iteration k.
x refers to the vector including α, β and γ parameters which needs to be optimized in the histogram stretching equation.

Artificial Bee Colony (ABC)
The algorithm consists of two main components: bees and food source. Bees search for the rich food source, which is the second component, close to their hive. The ABC algorithm contains three groups of bees: employed bees associated with specific food sources, onlooker bees watching the dance of employed bees within the hive to choose a food source, and scout bees searching for food sources, randomly. ABC is initialized with the Equation 6.
where u and l indicates the upper and lower boundaries of the dimension i. rand is the same parameter as in PSO algorithm. It is a randomly selected number between 0 and 1 in uniform distribution. x represents the i th solution in the swarm. After first iteration, each employed bee (x i ) generates a candidate solution (v i ) by using Equation 7.
x j is the random selected employed bee, but i and j must be different. i is another randomly selected number within [−1, +1] to weight the current employed bee to the optimal solution. If the candidate solution which is nominated as v i is better than its parent x i , then update current bee to the candidate by i . The best values of v i employed as the and α, β and γ parameter in the histogram stretching formula (Eq. 3).

Performance Evaluation
Reference images are compared with enhanced versions of the distorted images by the proposed two optimized histogram stretching and standard histogram equalization techniques. Some image quality metrics such as Mean Square Error (MSE), Peak Signal to Noise Ratio (PSNR) and Structural Similarity Index (SSIM) were calculated for the performance evaluation [22]. MSE can be calculated as in Eq. 9. (9) where N and M represent the total number of pixels in images as width and height size, respectively. X (i, j ) and Y (i, j ) indicates the pixel values at i th row and j th column of original and contrast enhanced of the distorted images. PSNR metric can be derived from the MSE. Equation 10 is used to calculate PSNR values.
A higher PSNR value indicates more symmetric images in PSNR metric. In case of identical images, PSNR is infinite or undefined due to the "0" MSE value. SSMI is another image quality measurement that mainly quantifies the image quality degradation. SSIM forms perception-based models that considers image degradation as perceived change in structural information. It is given in Equation 11.
where μ x , μ y , σ x , σ y , and σ xy are the local means, standard deviations, and cross-covariance for images X and Y , respectively.

RESULTS
Optimized histogram stretching and standard histogram equalization methods were separately tested on the images to evaluate the methods in terms of enhancement for contrast-based distortions. There are 25 reference images in dataset. Totally 100 distorted images have been generated by changing 4 distortion levels of the each reference image. First, enhancement techniques have been applied on distorted images to measure the success rate, quantitatively. Then, methods have been also performed on the raw reference images to measure the distortion effects of the methods on original images. It is expected that the enhancement methods should restore the distorted images to the    Hist. Eq.
(15 dB) Figure 4 The worst distortion effects of methods on referance images. levels due to being a parameter independent method. Standard deviation values in Table 1 also indicate the consistency of the PSO and ABC based optimized histogram-stretching methods. Optimization provides an adaptive solution. Hence, all images in same distortion level are enhanced by an adaptive optimal solution by stretching its histograms. Therefore, standard deviations of the obtained results were less when optimization methods were employed. But histogram equalization is a fixed technique and variable independent. Hence, the standard deviation for the same distortion levels, each images resulted in different enhancement ratios. As a result, outcomes vary according to type of input images. When compared within the optimization techniques, PSO is more consistent than ABC. MSE indicates the differences more clearly.
Three examples giving the best PSNR metric for each method are presented in Figure 3. Histogram equalization technique visually degrades the already distorted images much worse than the distortion effect where the optimized techniques resulted in better enhancement. The best result of the histogram equalization method is not as good as the other methods. In this case, PSNR is not a useful metric to evaluate the methods. Sometimes the PSNR values may be the same even the images appear different visually. In this case, the SSIM metric appears to be better to differentiate images, objectively. We also evaluated the methods in SSIM metric. Addition to the evaluation of methods in image enhancement idea, process times of the optimization techniques were measured. Process, or progressive time gives information about the complexity and required system resources of algorithms. The mean values were presented in Table 2.
ABC has less complexity than the PSO [23,24]. According to the processing time results, ABC optimized the histogram stretching method in shorter time than the PSO. It is 1.5 times faster. However, the performance is less than the PSO. In this study, we also tested the distortion effects of the enhancement techniques on the reference images. Results are presented in Table 3 with mean and standard deviation of the original 25 images. Table 3 shows that the histogram equalization distorted the original images more than others. Identically, original images and the enhanced images should be the same. So, the SSMI and PSNR should be infinite while MSE should be zero.
The worst cases of distortion effect of each method are given in Figure 4. Standard histogram equalization method visually distorted all the original images where the others have minimal effect in this respect.

CONCLUSION
In this study, the contribution of artificial intelligent based optimization techniques was examined within the context of image enhancement. While ABC and PSO were selected as the optimization techniques, the histogram stretching was selected as the image enhancement technique to be optimized. Optimization idea is performed to arrange an optimal parameter in histogram stretching technique. Additionally, another image enhancement technique, histogram equalization, is also evaluated by testing on the same dataset. Although histogram equalization is a parameter-independent technique that does not require optimization, the parameters in the histogram stretching method directly affect the performance. Tests are performed on 125 images having 4 different distortions and original versions. Results indicate that the optimization techniques require more processing time, but the enhancement result in terms of PSNR, MSE and SSMI is increased when compared to regular histogram equalization. The PSO is more efficient to adapt on histogram stretching than the ABC. However, it requires more time processing.