1 Introduction

Contrast enhancement techniques improve the perception of information in images or provide meaningful information for real-time image processing applications. Human perception excels at building a visual representation with bright colors and details across the wide-ranging photometric levels due to lighting variations. Reproducing an image equivalent to direct observation of the human visual system is an arduous task. The scene captured by the human visual system is extremely non-linear. Consequently, the captured image often deviates from the human perception of the original scene [9]. The contrast enhancement techniques found in literature works well on gray level images with uniform spatial distribution. But complexity arises when the recorded images suffer from a loss in clarity of the data and shade as light levels drop within the shadows and the distance from the lighting source increases. Henceforth it is necessary for a contrast enhancement algorithm that produces an enhanced color image which matches the direct observation of a scene by human visual system [17, 45, 47]. This paper addresses the contrast enhancement algorithm that overcomes the difficulties in the recorded image in an optimized way.

The rest of the paper is organized as follows. Attributes of visual sensation are discussed in section 2 and various color models are discussed in section 3. Various contrast enhancement algorithms are discussed in section 4 and the proposed contrast enhancement algorithm is discussed in section 5. Experimental results and performance evaluation of the proposed work are discussed in section 6. Finally, conclusions are drawn in section 7.

2 Attributes of visual sensation

The aim of contrast algorithm is to provide a more appealing image with vivid colors and clarity of details [48]. The contrast enhancement algorithms are intimately related to different attributes of visual sensation. The attributes are brightness, lightness, hue, colorfulness, chroma and saturation.

Brightness is a relative term and it depends on the visual perception of a human. Brightness can be defined as the amount of energy output by a source of light relative to the source compared to it. Lightness means the brightness of an area judged relative to the brightness of a similarly illuminated area that appears to be white or highly transmitting [48].

Hue is the term for the pure spectrum colors commonly referred to by the “color names” - red, orange, yellow, blue, green violet - which appear in the hue circle or rainbow (http://char.txa.cornell.edu/language/element/color/color.htm). Colorfulness is a visual sensation according to which the perceived color of an area appears to be more or less chromatic. Chroma is the colorfulness relative to the brightness of a similarly illuminated area that appears to be white or highly transmitting. The colorfulness of an area is judged in proportion to its brightness (http://char.txa.cornell.edu/language/element/color/color.htm).

The objective of contrast enhancement algorithms is to increase the visibility of details that may be obscured by deficient global and local lightness. The aim of color enhancement can be either (i) to increase the colorfulness or (ii) to increase the saturation. Increasing the lightness can give a perception of increased colorfulness. The perceived saturation can be increased by increasing chroma or reducing lightness, or both. If chroma is increased moderately while slightly reducing the lightness, both saturation and colorfulness in an image can be enhanced. Hence, it necessary to develop algorithms that satisfy the following attributes while improving the contrast of the image.

3 Color models

This section describes the color models used in color image processing applications. The choice of the color space plays a major role in color image contrast enhancement algorithms and that should not introduce any artifacts in the enhanced images.

3.1 RGB color space

RGB color space did not correspond with the human color perception and so, image enhancement algorithms applied directly to RGB images could lead to color artefacts [42]. Hence it is necessary to transfer the RGB image into some other color space whose dimensions corresponded to luminance, hue and saturation. The commonly used color spaces are HSV, HSL and CIE lαβ color spaces.

3.2 HSL and HSV color spaces

HSL stands for hue, saturation, and lightness. HSV stands for hue, saturation and value. These two are the most commonly used color spaces developed in 1970’s for computer graphics applications and used nowadays in color pickers, in image editing software, and less commonly in image analysis and computer vision applications [42]. These two color models are cylindrical-coordinate representations of points in an RGB color model. RGB is the way computer screens work, but it is not very intuitive. HSL is more intuitive, but you need to convert it to RGB before you can draw a pixel with it. The advantage in the application of this color model is that we can easily create rainbow gradients or change the color, lightness or saturation of an image with this color model.

3.2.1 RGB to HSV conversion

RGB to HSV and HSL conversions are given by [42]. Let R, G, B denotes red, green and blue colors. Now saturation(S) and value (V) can be computed as follows.

$$ S=\mathit{\operatorname{Max}}-\mathit{\operatorname{Min}}/\mathit{\operatorname{Max}} $$
(1)
$$ V=\mathit{\operatorname{Max}} $$
(2)

Where Max = max (R,G,B) and Min = min (R,G,B). Hue is defined by three different formulas that depend on maximum of value RGB color channel as given below:

  1. (i)

    If Red is max, then Hue = (G − B)/(Max − Min)

  2. (ii)

    If Green is max, then Hue = 2.0 + (B − R)/(Max − Min)

  3. (iii)

    If Blue is max, then Hue = 4.0 + (R − G)/(Max − Min)

3.2.2 RGB to HSL conversion

In HSL space, the luminance or lightness (L) can be calculated by adding the max and min values and dividing the sum by 2.

$$ L=\frac{1}{2}\left( \max + \min \right) $$
(3)

Saturation (S) is calculated based on the level of the luminance.

  1. (i)

    If luminance is smaller than 0.5, then S = (Max − Min)/(Max + Min)

  2. (ii)

    If luminance is greater than 0.5, then S = (Max − Min)/(2.0 − Max  − Min)

The Hue (H) formula depends on what RGB color channel has the max value. The three different formulas are:

  • If red is max, then H = (G − B)/(Max − Min)

  • If green is max, then H = 2.0 + (B − R)/(Max − Min)

  • If blue is max, then H = 4.0 + (R − G)/(Max − Min)

The Hue value needs to be multiplied by 60 to convert it to degrees on the color circle.

3.3 RGB to lαβ color space

When a color image is represented in any of the color spaces, correlations can exist between different color channels. In RGB color space, most pixels have larger values for the red and green channel if the blue channel is large. This shows that if we want to change the appearance a pixel’s color, we must modify all color channels in tandem [34]. This complicates the contrast enhancement process. In order to avoid complications in contrast enhancement process, an orthogonal color space without correlation among the axes is required [4]. Such kind of color space was proposed by, Ruderman et al. [35] called lαβ color space. The lαβ color space was proposed to minimize the correlation between the achromatic and chromatic channels. A color is defined in the lαβ space by an achromatic channel (brightness l), the red- green chrominance channel (α) and the yellow-blue chrominance channel (β). The procedure for converting the RGB image into Ruder man’s lαβ color space is as follows.

  1. Step 1:

    The RGB image is converted into LMS cone space. Since lαβ is the transform of LMS cone space. We convert the image into LMS cone space in two steps. The first step is the conversion from RGB to XYZ tristimulus values.

$$ \left[\begin{array}{c}\hfill X\hfill \\ {}\hfill Y\hfill \\ {}\hfill Z\hfill \end{array}\right]=\left[\begin{array}{ccc}\hfill 0.5141\hfill & \hfill 0.3239\hfill & \hfill 0.1604\hfill \\ {}\hfill 0.2651\hfill & \hfill 0.6702\hfill & \hfill 0.0641\hfill \\ {}\hfill 0.0241\hfill & \hfill 0.1228\hfill & \hfill 0.8444\hfill \end{array}\right]\left[\begin{array}{c}\hfill R\hfill \\ {}\hfill G\hfill \\ {}\hfill B\hfill \end{array}\right] $$
(4)

Then, the LMS cone space is constructed from XYZ space as follows

$$ \left[\begin{array}{c}\hfill L\hfill \\ {}\hfill M\hfill \\ {}\hfill S\hfill \end{array}\right]=\left[-\begin{array}{ccc}\hfill 0.3897\hfill & \hfill 0.6890\hfill & \hfill -0.0787\hfill \\ {}\hfill 0.2298\hfill & \hfill 1.1834\hfill & \hfill 0.0464\hfill \\ {}\hfill 0.0000\hfill & \hfill 0.0000\hfill & \hfill 1.0000\hfill \end{array}\right]\left[\begin{array}{c}\hfill X\hfill \\ {}\hfill Y\hfill \\ {}\hfill Z\hfill \end{array}\right] $$
(5)
  1. Step 2:

    The data in this color space shows a great deal of skew, which we can largely eliminate by converting the data to logarithmic space.

$$ \begin{array}{l} L= \log L\\ {} M= \log M\\ {} S= \log S\end{array} $$
(6)
  1. Step 3:

    The logarithmic LMS cone space is de-correlated using principal component analysis (PCA) to treat the three color channels separately.

$$ \left[\begin{array}{c}\hfill l\hfill \\ {}\hfill \alpha \hfill \\ {}\hfill \beta \hfill \end{array}\right]=\left[\begin{array}{ccc}\hfill \frac{1}{\sqrt{3}}\hfill & \hfill 0\hfill & \hfill 0\hfill \\ {}\hfill 0\hfill & \hfill \frac{1}{\sqrt{6}}\hfill & \hfill 0\hfill \\ {}\hfill 0\hfill & \hfill 0\hfill & \hfill \frac{1}{\sqrt{2}}\hfill \end{array}\right]\left[\begin{array}{ccc}\hfill 1\hfill & \hfill 1\hfill & \hfill 1\hfill \\ {}\hfill 1\hfill & \hfill 1\hfill & \hfill -2\hfill \\ {}\hfill 1\hfill & \hfill -1\hfill & \hfill 0\hfill \end{array}\right]\left[\begin{array}{c}\hfill L\hfill \\ {}\hfill M\hfill \\ {}\hfill S\hfill \end{array}\right] $$
(7)

Thus the l axis represents an achromatic channel, while the α and β channels are chromatic red–green and yellow–blue opponent channels. In order to enhance the contrast of the image, algorithms can be applied on l axis.

  1. Step 4:

    After processing the l axis, transfer the result back into RGB to display the result. That is inverse operations can be applied to lαβ color space to convert into RGB space. First, the lαβ color space is converted into LMS using matrix multiplication

$$ \left[\begin{array}{c}\hfill L\hfill \\ {}\hfill M\hfill \\ {}\hfill S\hfill \end{array}\right]=\left[\begin{array}{ccc}\hfill 1\hfill & \hfill 1\hfill & \hfill 1\hfill \\ {}\hfill 1\hfill & \hfill 1\hfill & \hfill -1\hfill \\ {}\hfill 1\hfill & \hfill -2\hfill & \hfill 0\hfill \end{array}\right]\left[\begin{array}{ccc}\hfill \frac{\sqrt{3}}{3}\hfill & \hfill 0\hfill & \hfill 0\hfill \\ {}\hfill 0\hfill & \hfill \frac{\sqrt{6}}{6}\hfill & \hfill 0\hfill \\ {}\hfill 0\hfill & \hfill 0\hfill & \hfill \frac{\sqrt{2}}{2}\hfill \end{array}\right]\left[\begin{array}{c}\hfill l\hfill \\ {}\hfill \alpha \hfill \\ {}\hfill \beta \hfill \end{array}\right] $$
(8)
  1. Step 5:

    Then, after raising the pixel values to the power ten to go back to linear space, we can convert the data from LMS to RGB using

$$ \left[\begin{array}{c}\hfill R\hfill \\ {}\hfill G\hfill \\ {}\hfill B\hfill \end{array}\right]=\left[\begin{array}{ccc}\hfill 4.4679\hfill & \hfill -3.5873\hfill & \hfill 0.1193\hfill \\ {}\hfill -1.2186\hfill & \hfill 2.3809\hfill & \hfill -0.1624\hfill \\ {}\hfill 0.0497\hfill & \hfill -0.2439\hfill & \hfill 1.2045\hfill \end{array}\right]\left[\begin{array}{c}\hfill L\hfill \\ {}\hfill M\hfill \\ {}\hfill S\hfill \end{array}\right] $$
(9)

HSL and HSV are simple transformations of RGB which preserve symmetries in the RGB cube unrelated to human perception, such that its R, G, and B corners are equidistant from the neutral axis, and equally spaced around it. Unlike the RGB, HSV and HSL color models, lαβ color is designed to approximate human vision. It aspires to perceptual uniformity, and its L component closely matches human perception of lightness. Thus, it can be used in contrast enhancement by adjusting the lightness of the L component. It is illustrated in the images of a fire breather as shown in Fig. 1(a) to Fig. 1 (d). L in an lαβ color space defines quantity intended to match perceptual lightness response, and it appears similar in lightness to the original color image. L component of HSL and V component of HSV, by contrast, diverge substantially from perceptual lightness.

Fig. 1
figure 1

Comparison of brightness component of various color spaces. (a) Color image (b) L in lαβ (c) L in HSL (d) V in HSV

4 Related works

Contrast enhancement techniques are used as a pre-processing step in applications where the quality of the image is considered important. The core objective of contrast enhancement is to improve the perception of objects in an image and highly desired in many areas such as medical image processing, image/video processing [17, 22] and surveillance applications [32]. Contrast enhancement becomes more significant for image processing applications, as the utilization of digital images over the internet has expanded. The gamma correction approach is broadly used as a contrast enhancement algorithm in the literature in spite of many other existing algorithms due to its brightness preservation. However, various other contrast enhancement algorithms have also been reported to enhance the specific details of the image such as histogram equalization, global and local histogram equalization [5, 39] adaptive histogram equalization and Contrast Limited Adaptive histogram equalization [29, 49] and other histogram equalization based algorithms [1, 2, 6,7,8, 10, 12, 13, 21, 23, 27, 28, 37, 44]. Histogram based techniques introduce two main artefacts namely, over enhancement in the image where the region has more frequent gray levels and under enhancement where the region has less occurrence of gray levels. Brightness preserving dynamic histogram equalization (BPDHE) can produce an output image with the mean intensity that is almost equal to the mean intensity of the input image [19]. BPDHE maintains the mean histogram of the image and hence overcome the limitations of histogram equalization.

Adaptive histogram equalization (AHE) is a local contrast enhancement technique that can enhance the overall contrast of the image more effectively. AHE method is different from ordinary histogram equalization techniques. In AHE method, many histograms are computed where each histogram corresponds to a different image. In this technique, a small window slides through every pixel of the input image sequentially and only those blocks of pixels are enhanced that fall in this window. Gray level mapping is done only for the centre pixel of that window [20]. AHE makes good use of local information and more details can be observed. However, in AHE, the computational cost goes very high due to its fully overlapped sub-blocks and causes over enhancement in some portions of the image [14]. Another problem is that enhances the noise effect in the image as well [40].

Contrast limited adaptive histogram equalization (CLAHE) is an improved version of AHE. The AHE has practical limitation that homogenous regions of an image can cause over-amplification of noise because a narrow range of pixels is mapped to an entire visualization range. CLAHE was developed to prevent this over-amplification of noise in homogeneous regions. In CLAHE, the input image is partitioned into many non-overlapping regions that have almost equal sizes and HE is applied to each of this region. The obtained histograms for each region are clipped by a clip limit that is based on the desired contrast expansion and the size of the neighbourhood region. For each clipped histogram, a transformation function is obtained that performs gray scale mapping. Finally, CLAHE applies bilinear interpolation to eliminate the region boundaries [43]. However, CLAHE amplifies the noise in the flat region and produces ring artefacts at strong edges [30].

In order to obtain the desired quality of the enhanced images and overcome the drawbacks of histogram based techniques, swarm intelligent technique is combined with classical contrast enhancement techniques. Many researchers [3, 18, 25, 26, 36] used particle swarm optimization to enhance the quality of the image due to its effectiveness and implementation through any programming languages [26]. In order to overcome the drawback of the histogram- based technique, Shanmugavadivu et al. [36] combined the classical contrast enhancement technique with particle swarm optimization for improving the contrast of gray scale images. The main idea of this model is to first segment the input image into two parts using Otsu threshold method. The two sub-images are equalized independently using PSO by applying the brightness and contrast based objective function. This technique provides better results compared with other histogram based techniques, but the edges are not preserved in this work. An edge in an image is a boundary or contour at which a significant change occurs in some physical aspects of an image, such as the surface reflectance, illumination or the distances of the visible surfaces from the viewer. Edges also can be defined as discontinuities in image intensity from one pixel to another. The edges of an image are the important characteristics that offer an indication of the presence of high frequencies. Edges characterize boundaries and are therefore considered of prime importance in image processing such as face hallucination [25]. Moreover, histogram equalization based methods are only suitable for images with poor intensity distribution but not for images with uniform intensity.

Gorai and Ghosh [18] considered the contrast enhancement as an optimization problem and used PSO to solve it. The authors used parameterized transformation function for contrast enhancement by considering the local and global information present in the image. The authors achieved the best result, according to the objective function by optimizing the parameters of the transformation function with the help of PSO. The author in [3] also uses the same parameterized transfer function as in [18] but they have applied Accelerated PSO to optimize the parameters of the function. But both approaches fail to preserve the mean intensity and suitable for grayscale not for color images.

Qinqing et al. [31] also took contrast enhancement as an optimization problem and simulated annealing PSO algorithm is used to solve it. The authors also applied the parameterized transformation function for contrast enhancement of grayscale images based on local and global information on an image. The parameters are selected based on the entropy and edge based objective function. In this paper, the initial parameters are selected using a random process. The velocity and position of each particle are updated using PSO, and then simulated annealing is applied to each individual particle in order to select the individuals for the next generation. This hybrid procedure preserves the edge content and meanwhile, increases the computational complexity.

In literature, many works can be found for enhancing grayscale images, but for color images only minimal numbers of works are available. The above-mentioned techniques work well for the grayscale image but complexity arises while applying for color images. The reason is that in color image the intensity values of the pixels are highly correlated and changes in one part of the image lead to a drastic color change in another part. This will affect the overall contrast of the entire image. Hence, it is necessary to convert the image into any one of the color space and separate it into color and luminance channel. Brightness enhancement can be done only in the luminance part in order to avoid annoying artefacts in the color channels. Shibudas et al. [41] proposed a Gaussian based contrast enhancement technique which uses PSO that has an edge over other state-of- art methods. In this work, first, the input image is converted into lαβ color space (luminance and chrominance). The luminance histogram is modeled by the Gaussian mixture model. Enhanced image is generated by transforming a function that depends on PSO optimized parameters. In Gaussian mixture modeling an image with low contrast is automatically improved in terms of an increase in the dynamic range. But it is not suitable for high contrast images. Kwok et al. [24] proposed a contrast enhancement technique for color images using PSO. The author used RGB color space, although it is convenient for display, but not good for color image processing due to high correlation [16]. The authors tried to preserve the mean intensity and maximize the information content. Selecting the best color space still is one of the difficulties in image processing.

To overcome drawbacks of the existing system we have chosen an optimal color space lαβ containing every color the human eye can perceive and the entire gamut of CMYK and RGB. It is an excellent space for contrast enhancement, as it does not have any of the color limitations of other color spaces. Maximization of entropy and edges can provide meaningful features for image understanding. The main contribution of the proposed work is summarized as follows.

  • Preservation of mean intensity due to gamma correction approach

  • Particle swarm optimization algorithm is applied to select optimal gamma factor with the objective of maximization of entropy and edge content.

  • Edges are well enhanced that is suitable for good image understanding

  • The lαβ color space provides de-correlated achromatic channels for color images. The changes in one color would minimally affect the other. This makes it an effective optimal contrast enhancement for the color images without any cross-channel artefacts.

5 Proposed contrast enhancement algorithm

In this section, we present the proposed contrast enhancement approach which improves the contrast of the luminance channel based on the optimal gamma value determined by the particle swarm optimization. Fig. 2 demonstrates the block diagram of the proposed approach, in which PSO is employed to find an optimal gamma value for contrast enhancement. First, the RGB color image is transformed into lαβ color space and α, β channels are kept constant to avoid strange colors in the resultant image. After luminance enhancement, the brightness channel is added with chromatic components and then it is converted back into RGB color space.

Fig. 2
figure 2

Block diagram of proposed optimized contrast enhancement algorithm

5.1 RGB to lαβ color space conversion

For contrast enhancement of color images, it is necessary to separate the color components from intensity for various reasons such as robust lighting changes, or removing shadows and improving contrast. In our work, the color image is transformed to lαβ color space which separates luminance channel from chrominance. A color is defined in the lαβ space by an achromatic channel (brightness l), the red-green chrominance channel (α) and the yellow-blue chrominance channel (β). The color transformation procedure as follows

  1. Step 1:

    The RGB image is converted into LMS cone space using Eq. (4) and (5)

  2. Step 2:

    The logarithmic LMS cone space calculated from LMS cone space using Eq. (6)

  3. Step 3:

    The logarithmic LMS cone space is de-correlated using principal component analysis (PCA) to treat three the color channels separately using Eq.(7)

The lαβ color space is selected in the proposed approach and the reason is that it provides de-correlated achromatic channels for color images. So the changes in one color would minimally affect the other. This makes it an effective optimal contrast enhancement for the color images without any cross-channel artefacts. Our proposed method enhances the brightness of the image which in turn significantly improves the visibility of the image while preserving the original chrominance of the image.

5.2 Gamma correction approach

Gamma correction is a type of histogram modification technique and enhancement is achieved by using an adaptively changing parameter called gamma (γ) [10, 12]. It is a non-linear operation which adjusts the lightness or darkness of an image. The basic form of the transformed gamma correction (TGC) is given by

$$ TGC={I}_{\max }{\left(\raisebox{1ex}{${I}_{in}$}\!\left/ \!\raisebox{-1ex}{${I}_{\max }$}\right.\right)}^{\gamma} $$
(10)

where γ refers to intensity curve, which follows a simple power law, I in is the actual intensity value of the input image and I max is the maximum intensity value of the input image. After applying Eq. (10) on the input image, the intensity value of each pixel in the input image is transformed into TGC. According to the gamma value, only image brightness can be adjusted. The gamma value ranges from 0.0 to infinity. Gamma value equal to 1.0 implies the faithful reproduction of the input image. If gamma value is less than 1.0 it lightens the image and gamma value greater than 1.0 darkens the image [17]. Therefore the precise value of gamma is imaging dependent and based on its intensity profile.

In this paper, an optimal framework has been developed to choose an optimal gamma value that enhances the contrast of an image, includes many intensive edges and maximizes the information content.

5.3 Particle swarm optimization

PSO is a population-based optimization technique with the aim of exploiting the population of possible solutions to probe the search space simultaneously. In a mathematical context, PSO can be stated as follows. Let

$$ A\subset {R}^n\kern0.5em \mathrm{and}\kern0.5em f: A\to Y\subseteq R $$

where, A is the search space and f is the objective function. The whole population is called a swarm and its individuals are called particles. The swarm is defined as a set:

$$ S=\left\{{x}_1,{x}_2,\dots, {x}_N\right\}, $$

of N particles (possible solutions), defined as:

$$ \begin{array}{cc}\hfill {x}_i={\left({x}_{i1},{x}_{i2},\dots, {x}_{i d}\right)}^T\in A\hfill & \hfill i=1,2,\dots, N\hfill \end{array} $$

Indices are randomly assigned to particles, the number of particles (N) is a user defined parameter of the algorithm and d is the dimension. Each particle has a unique fitness function value:

$$ {f}_i= f\left({x}_i\right)\in Y $$

The particles are assumed to move inside the search space iteratively by adjusting their position using a proper location shift called velocity, as indicated:

$$ \begin{array}{cc}\hfill {v}_i={\left({v}_{i1},{v}_{i2},\dots, {v}_{i d}\right)}^T,\hfill & \hfill i=1,2,\dots, N\hfill \end{array} $$

Velocity is updated iteratively to make the particles efficiently move in any region. If t represents the iteration count, then the current position of the i th particle and its velocity is indicated as x i (t) and v i (t) respectively. The velocity of the particle is updated based on the information gained from previous steps of the algorithm [11]. PSO also has a memory set:

$$ P=\left\{{P}_1,{P}_2,\dots, {P}_N\right\} $$

This contains the best positions:

$$ \begin{array}{cc}\hfill {P}_i={\left({P}_{i1},{P}_{i2},\dots, {P}_{i d}\right)}^T\in A,\hfill & \hfill i=1,2,\dots, N\hfill \end{array} $$

These best positions are always visited by each particle. These positions are defined as

$$ {P}_i(t)={ \arg}_t \max {f}_i(t), $$

PSO is modeled based on the social behavior of birds that allows particles to mutually communicate their experience. The algorithm calculates the global best position, in a completely connected swarm behaviour by sharing the information of the best position visited by any particle. The global best position is denoted by index g. i.e. (highest fitness function value in P at a given iteration),

$$ {P}_g(t)={ \arg}_t \max f\left({P}_i(t)\right) $$

The velocity and positions of each particle are updated during each iteration by applying the following equation

$$ {v}_i\left( t+1\right)=\omega {v}_i(t)+{c}_1{r}_1\left({P}_i(t)-{x}_i(t)\right)+{c}_2{r}_2\left({P}_g(t)-{x}_i(t)\right) $$
(11)
$$ {x}_i\left( t+1\right)={x}_i(t)+{V}_i\left( t+1\right) $$
(12)

where, ω is called as the inertia weight that controls the convergence behavior of PSO. Large inertia weight aids global search (searching new areas), while small inertia weight aids local search. The parameters c 1 and c 2 stabilizes the influence of the individual best and global best positions. The parameters r 1 and r 2 are applied to control the diversity of the population, and they are distributed in the range [0, 1].

5.4 Optimal gamma factor estimation using PSO

In this paper contrast enhancement is formulated as an optimization problem as given: The set of particle values (gamma value) is defined as a set of N particles

$$ \gamma =\left\{{\gamma}_1,{\gamma}_2,\dots, {\gamma}_N\right\} $$

Where,

$$ {\gamma}_i={\left({\gamma}_{i1},{\gamma}_{i2},\dots, {\gamma}_{i d}\right)}^T\in A $$

The entropy of the image is calculated for the gamma value and maximized using

$$ { \arg}_t \max (H)=-\sum_{i=0}^{255} p(i)\times { \log}_2\left( p(i)\right) $$
(13)

Where p(i) is the probability of occurrence of i th intensity of the enhanced image. The particle set γ should also maximize the objective function (Edge content)

$$ { \arg}_t \max \left( E C\right)=\frac{n\_ edges(E)}{T} $$
(14)

where, n_edges(E) stands for the number of detected edge pixels in the enhanced image which is calculated by a canny edge detector and T is the total number of pixels in the enhanced image. When more than one objective function is associated with the problem it is called a multi-objective optimization [33].

A multi-objective optimization technique usually applies a method called Pareto dominance, but this may increase the computational complexity. The effective approach to handling the multi-objective optimization issue is to construct an overall objective function as a linear arrangement of the multiple objective functions [33].

The overall objective function is defined as follows:

$$ f(x)={\alpha}_1{f}_1(x)+{\alpha}_2{f}_2(x) $$
(15)

Where α 1 and α 2 are factors that show the relative importance of the objective function f 1 and f 2 . In this paper, the objective functions entropy and edge content are taken with equal importance, that is the value α 1  = α 2  = 0.5.

The proposed multi-objective function is formulated as follows:

$$ f(x)={\alpha}_1\left[-\sum_{i=0}^{255} p(i)\times { \log}_2\left( p(i)\right)\right]+{\alpha}_2\left[\frac{n\_ edges(E)}{T}\right] $$
(16)

Algorithm for the proposed method is given below.

figure c

In the proposed method, a random process is used to generate an initial population and velocity. The random process is a good start that plays an important role in search direction. After population initialization, the value of each particle set is passed to gamma correction approach to enhance the given input image. After enhancement, the entropy and edge content are calculated for each enhanced image. A comparison is made of all the particles and the best one is stored as the global optimum. If the result of the objective function is greater than that of the previous iteration, then the current iteration gamma value is considered as global optimum. The same process is continued until termination criteria, and the final gamma value is taken as the optimal gamma value that can be used to produce the contrast enhanced image.

A termination criterion is a condition that is used for ending the procedure of PSO. This condition may be a specified number of iterations or timing constraints or error threshold etc. In this paper, a specific number of iterations have been used as the termination criterion. The reason is that the particles get converged in between from 30 iterations to 45 iterations. In this work, the maximum number of iterations is set as 50 which is a termination criteria for the proposed work.

Figure 3 illustrates the concept of the proposed contrast enhancement algorithm using PSO. In this example the values 80, 20, 50, 90, 100, 110, 70, 60 and 50 are pixel values of the input image. The maximum intensity value of the image is 110. In this example, the first pixel having the actual intensity value as 80 is mapped to the enhanced pixel intensity value of 93, after gamma correction using the gamma value (0.5) generated from PSO. The same procedure is repeated for the entire image. The edge content and entropy of the enhanced image are calculated. For a single iteration, all the gamma values generated from PSO (0.5 to N) are used to calculate the new intensity values for the enhanced image. The same process is repeated until the maximum number of iterations is reached. The particle (gamma value) gives the maximum entropy and edge content considered as global best (gbest). Finally, using this gbest value, the image is enhanced that will be the final output image.

Fig. 3
figure 3

Illustration of the proposed contrast enhancement algorithm using PSO

6 Experimental results and discussion

This section describes the implementation details of the proposed algorithm and other state- of- the-art techniques used for comparison. The result of proposed contrast enhancement algorithm is compared with other methods in terms of subjective user test and objective analysis.

6.1 Implementation details

The proposed algorithm was implemented by MATLAB2013 and tested on diverse color images taken from the USC SIPI database (http://sipi.usc.edu/pub/database/misc.zip) and (http://visl.techion.ac.il/1999/99-07). To evaluate the performance of the proposed optimized contrast enhancement algorithm it is tested against the histogram equalization (HE) [39], brightness preserving dynamic histogram equalization (BPDHE) [19], adaptive histogram equalization (AHE) [5] and contrast limited histogram equalization (CLAHE) [29]. The comparison has been made in terms of ability in - contrast and edge enhancement, appropriateness of enhanced images for real-time image processing applications and also the capability of the proposed contrast enhancement method to produce natural looking images.

6.2 Parameters selection

The images are subjected to PSO-based gamma correction approach with 50 generations. More particles might speed up the convergence of an algorithm. We have chosen 30 particles to form a particle swarm. The particle size depends on the problem space. If it is small it is better to use a small number but if the problem space is large it is better to use a larger swarm size. The proposed work deals with a single dimensional problem that is considered as a small problem space. Particle size 20 to 40 is the optimal size for small-scale problems [11, 33]. In this work, we chose 30 particles to reduce computational complexity and increase convergence speed. The parameters selected for PSO listed in Table 1.

Table 1 Parameters of PSO

6.3 Optimal gamma factor and convergence of PSO

Figure 4 shows the PSO-based optimal gamma value search that maximizes the entropy and edge content for pears, swan, Notredam, girl, bowl and couple images. The graph results in Fig. 4 clearly shows the effective implementation of optimal search mechanism since the best gamma value of each generation revolves around the global best entropy and edge content without much deviation. The optimal gamma factor (1.58, 0.2, 0.42, 0.26, 1.07, 0.2, 0.4 and 0.3) for contrast enhancement of pears, swan, Notredam, girl, bowl, couple, street and room images are converged in 31, 21, 44, 43, 33, 44, 37 and 30th generations respectively.

Fig. 4
figure 4

PSO search for optimal gamma factor

6.4 Subjective assessment-mean opinion score (MOS)

In this work, Mean Opinion Score (MOS) is used to strengthen the hypothesis that the proposed contrast enhancement algorithm can better match the direct observation of a scene by human visual system. In MOS, several individuals judge the quality of an image and then the mean value of their score is used as measure [46]. The subjective experiments were conducted with 50 non-expert viewers. The viewer analyses the tone, contrast, sharpness and texture of the enhanced image. The subjective method mainly includes absolute and relative measures (Table 2) [38].

Table 2 Subjective method for image quality assessment

The observers provided their quality ratings from Grade-5 (excellent) to Grade-1 (very poor) [15]. The MOS scores for various contrast enhancement techniques are listed in Table 3.

Table 3 Comparison of various contrast enhancement techniques using MOS

The MOS score for BPDHE method is very low while AHE and CLAHE methods have a better score than BPDHE. The proposed method has highest MOS score for all the fused images, indicating that the proposed method is visually superior compared to other state-of-the-art algorithms.

6.5 Objective assessment

Entropy and Edge content are the objective rating parameters used to judge the performance of enhancement in addition to subjective evaluation. The factor entropy was used to compare the information level of the resulted images. The image with the highest entropy value was rated as high contrasted image. The entropy obtained for each image is presented in Table 4. Moreover, the edge content measure was used to assess the detail content level of the resulted images. The values of edge content found for each enhanced image have been shown in Table 4 that shows that the proposed contrast enhancement technique outperforms other methods in many cases.

Table 4 Quantitative analysis of various contrast enhancement techniques

Simulation results indicate that the proposed optimized contrast enhancement technique produces more natural looking images. The contrast enhanced images have been shown in Figs. 5, 6, 7, 8, 9, 10, 11 and 12. The enhanced result produced by BPDHE, and AHE for pears (see Fig. 5(e) and Fig. 5(b) respectively) the images are not appealing due to over enhancement. The resultant image of CLAHE is not satisfactory because of the uneven texture pattern of the pears (Fig. 5(c)) and the maximization of noise. The enhanced image of the proposed method improves the contrast of pears and preserves the smooth texture pattern of the pears.

Fig. 5
figure 5

Enhancement results of pears image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed

Fig. 6
figure 6

Enhancement results of swan image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed method

Fig. 7
figure 7

Enhancement results of street image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed method

Fig. 8
figure 8

Enhancement results of room image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed method

Fig. 9
figure 9

Enhancement results of Notredam image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed method

Fig. 10
figure 10

Enhancement results of girl image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed method

Fig. 11
figure 11

Enhancement results of bowl image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed method

Fig. 12
figure 12

Enhancement results of couple image using various contrast enhancement algorithms (a) original image (b) AHE [5] (c) CLAHE [29] (d) HE [39] (e) BPDHE [19] (f) Proposed method

The shadow of the swan image should be removed to produce a better quality image. The proposed method removes the shadow, whereas AHE, CLAHE, and BPHE amplify the shadow; as a result, the swan looks unnatural for AHE, CLAHE and BPHE. In the same way, the proposed method has produced a more natural-looking Notredam image. The building is very clear and dark part of the wall is lightened.

The Fig. 7(b) and (c) we can observe that the AHE and CLAHE method darkens the sky part of the image and produces a number of black pixels around the sky. Whereas the proposed method produces pleasing effect around the sky and building. From Fig. 8(a) we can observe that due the absence of light the bookshelf is not clearly visible. After contrast enhancement, the bookshelf is visible in all state-of-the-art methods. The proposed method gives a clear view of the bookshelf when compared with the other methods (Fig. 9).

The input image of the girl does not reflect the mirror part of girl and trees in the car glass (Fig. 10(a)). The contrast enhancement techniques effectively enhance that information in the resultant images. The result of BPDHE is similar to input images (Fig. 10(e)). The reason is that BPDHE preserves the mean intensity of input image while adjusting the brightness of the image. For the girl image, the outcome of AHE is very poor. The reason behind this poor quality is that the white part of the sky gets reflected and as a consequence, the image looks blurred at many pixel locations around the tree. From the perspective of subjective assessment (MOS score), the result of proposed method for girl image seems to be over lightened. But objective analysis shows that the proposed method has high entropy and edge content when compared with other methods.

The bowl image is already highly contrasted (Fig. 11(a)). If an input image highly contrasted one then there is no point in improving the contrast. So the proposed method preserves the color of the bowl and background (Fig. 11(f)). AHE has introduced a number of white pixels on a bowl image that leads to its unnatural look. In the couple image, the texture of the wall and floor is not very smooth in the enhanced images produced by AHE and CLAHE (see Fig. 12). By visually examining the proposed enhanced images, it is clear that the presented PSO-based contrast enhancement technique produced more natural looking images with improved visual perception.

Thus, the experimental results showed that the presented method worked well on the less illuminated and dark images and improved the visual quality of an image. The proposed method does not introduce any artefacts for high contrast images. But the other state-of-the-art methods introduce artefacts in the fused images. Since it provides better results than other state-of-art methods in two criteria, it is suitable for real-time image processing applications.

7 Conclusion

In this paper, we proposed an optimized contrast enhancement technique based on particle swarm optimization for color images. Simulation results showed that the enhancement of the luminance channel prevented the unwanted artefacts in the chrominance part of the image. The proposed method is based on the gamma correction approach optimized with PSO in which the number of edges and entropy were used as fitness values. To evaluate the performance of the proposed method, less illuminated and dark images were selected as the input images. The experimental test results indicated that the proposed system improved the overall image contrast and enhanced the information content present in the image. The proposed contrast enhancement algorithm has the following attractive features:

First, applying the lαβ color space to the input image provides de-correlated achromatic channels. The changes in one color should minimally affect the other. This makes it an effective optimal contrast enhancement of the color images without any cross-channel artifacts.

Second, particle swarm optimization algorithm is used to select the optimal gamma factor that maximizes entropy and edge content of the image.

Finally, the edges are well enhanced which makes it suitable for good image understanding