1 Introduction

Contrast enhancement methods have been applied for better visual interpretation. Histogram equalization (HE) is one of the most simple and widely used methods for contrast enhancement (Gonzalez and Woods 2002).

The method of traditional histogram equalization (Gonzalez and Woods 2002) is described below:

Suppose the original image \(f(i,j)\) has total W number of pixels within the dynamic range \([{X_0},~{X_{L - 1}}]\). L is the number of discrete gray levels. Then the probability density function \(PDF({X_k})\) of intensity level \({X_k}\) of the image is given by:

$$PDF({X_k})=\frac{{{n_k}}}{W}\;{\text{for}}\;~0 \leq k \leq L - 1$$
(1)

where \({n_k}\) is the total number of pixels with intensity level \({X_k}\). The plot of \({X_k}\) vs. \({n_k}\) is called histogram of image \(f.\) The cumulative density function is defined as (Gonzalez and Woods 2002):

$$CDF({X_k})=\mathop \sum \limits_{{i=0}}^{k} PDF({X_i})$$
(2)

Traditional HE maps the corresponding image into the total dynamic range \(\left[ {{X_0},~{X_{L - 1}}} \right]\) with the help of the \(CDF\) as given below:

$$f(X)={X_0}+~\left( {{X_{L - 1}} - {X_0}} \right) \cdot CDF(X)$$
(3)

Basically, HE procedure flattens the histogram of the original image. As the entire gray levels are distributed uniformly, HE improves the image contrast and maximizes the image entropy. As the histogram of the output image is uniformly distributed, the mean brightness is approximately changed to the middle of the gray level regardless of the input image’s mean (Chen and Ramli 2004; Kim 1997). The equation of the mean or statistical expectation \(E( \cdot )\) of the output image G is given below:

$$E(G)={G_{mean}}=~\frac{1}{2}\left( {{X_0}+{X_{L - 1}}} \right)$$
(4)

where \({G_{mean}}\) is the mean intensity of the output image of traditional HE procedure. Therefore, the traditional HE procedure is not suitable for the consumer electronics purpose (Chen and Ramli 2004).

In order to overcome this problem, several modifications have been done on traditional HE (Chen and Ramli 2004, 2003a, 2003a, b; Kim 1997; Cheng and Shi 2004; Wang and Ward 2007; Sengee and Choi 2008; Kim and Chung 2008). The common two techniques of most of these methods are:

  1. 1.

    Divided the image into two parts based on some specific threshold, and then equalize each part individually (Chen and Ramli 2004, 2003a, 2003b; Kim 1997; Cheng and Shi 2004).

  2. 2.

    Weighting and thresholding the probability density function (PDF) of the image before equalization to preserve the original brightness (Shanmugavadivu et al. 2014; Wang and Ward 2007; Sengee and Choi 2008; Kim and Chung 2008).

Brightness preserving bi-histogram equalization (BBHE) is one of the simpler variants of basic HE (Chen and Ramli 2004, 2003a; Kim 1997). In BBHE histogram of the image separated around its mean and then the two divided parts equalized separately (Shanmugavadivu et al. 2014; Chen and Ramli 2004). It is proved that BBHE method preserves the original brightness to a certain level (Shanmugavadivu et al. 2014; Chen and Ramli 2004). In dualistic sub-image histogram equalization (DSIHE) proposed by Wan et al. (Shanmugavadivu et al. 2014; Chen and Ramli 2004), the procedure was same as BBHE but the histogram was separated by median instead of mean (Shanmugavadivu et al. 2014; Chen and Ramli 2004, 2003a, b). DSIHE method is suitable for only those kinds of images which have uniform intensity distribution. The potential of preserving the original brightness is not so good in DSIHE method. Another variant of BBHE method is known as minimum mean brightness error bi-histogram equalization (MMBEBHE), proposed by Chen and Ramli (2004, 2003a) in which the histogram had been separated using a specified threshold which preserved the minimum mean brightness error between input and output image. Then the two parts had been equalized independently. This technique is better than BBHE and DSIHE but it also suffers from a deficiency of contrast and brightness (Shanmugavadivu et al. 2014). Recursive mean separate histogram equalization (RMSHE) is another HE based procedure proposed by Chen and Ramli where the input image was separated recursively (Shanmugavadivu et al. 2014; Chen and Ramli 2004, 2003b). Each part was equalized independently and then all parts were combined to give an enhanced image. It was proved that this RMSHE method was better than BBHE (Chen and Ramli 2004) as RMSHE could preserve the brightness well and could give a natural enhancement (Chen and Ramli 2004). The disadvantage of RMSHE was its large time complexity for recursion. So, all the above discussed HE variants suffer from the problem for preserving the original brightness. The main reasons for these drawbacks are that these techniques do not change the original probability density function (PDF) or normalized histogram, and thus higher probable intensity levels are over-enhanced. The simple weighted and thresholded technique has been developed in literature to change the PDF (Wang and Ward 2007; Sengee and Choi 2008; Kim and Chung 2008). A fast and effective image and video contrast enhancement technique was proposed which was known as weighted threshold HE (WTHE) (Wang and Ward 2007). In this technique, the PDF of the image was modified by weighting and thresholding prior to HE. A mean adjustment factor was also added to normalize the luminance changes. The advantages of that method were adaptivity of different images and control over the enhancement, which were very difficult to achieve in traditional HE method and all theabove-discussed variants like BBHE, DSIHE, and MMBEBHE. Two other weighted methods were also developed by Sengee and Choi (2008) and Kim and Chung (2008). A weighted clustering HE (WCHE) (Sengee and Choi 2008) and a recursively separated and weighted HE (RSWHE) (Kim and Chung 2008) were proposed. Wang and Ward (2007) introduced two parameters in WTHE. One was used to choose a proper threshold and another was power law coefficient, which was used to modify the PDF. If the parameters were chosen properly, then it gave much better results which did not include over-enhancement or artifacts. So, the efficiency of that method crucially was depended on these parameters. The only demit of WTHE was the manual selection of the parameters. In this study, these problems have been taken into consideration and one novel variant of HE; called weighted and thresholded Bi-HE (WTBHE) has been developed by combining WTHE and MMBEBHE in Sect. 2. WTBHE has been developed by separating the input histogram using a specified threshold which minimizes the absolute mean brightness error (AMBE) between the original and enhanced images. Then the sub-histograms have been modified with the assistance of these four enhancement control parameters for providing original brightness preserved enhanced output. The parameters of the corresponding HE variant have been found by employing Bat algorithm (BA) and its variants. In Sect. 3, discussion about the BA and its modifications has been done. Section 4 emphasizes the experimental results which clearly reveal that the modifications on BA increases its efficiency in the image enhancement domain and WTBHE produces better brightness preserved enhanced images than some existing HE variants.

2 Weighted and thresholded Bi-HE (WTBHE)

This method combines the strength of MMBEBHE and WTHE. MMBEBHE is used to separate the histogram as MMBEBHE outperforms BBHE and DSIHE to preserve the original brightness of the image (Chen and Ramli 2004, 2003a). The algorithm is explained below:

  1. 1.

    Separate the histogram of the image based on the threshold level, which will yield minimum difference between input and output mean, called absolute mean brightness error (AMBE).

  2. 2.

    Formulate the upper and lower weighing constraints to modify the lower and upper histogram.

  3. 3.

    Optimize the constraints by using Bat algorithm and its variants.

  4. 4.

    Apply HE method over lower and upper histogram independently.

  5. 5.

    Then unite the both to get an enhanced final image.

The pseudo-code is as follows:

  1. 1.

    Compute the threshold \({X_T}\) by using MMBEBHE procedure image (Chen and Ramli 2004, 2003a).

  2. 2.

    Compute PDFs for lower histogram, i.e., \(PD{F_L}\) and upper histogram i.e. \(PD{F_U}\).

  3. 3.

    Compute the mean of the \(PD{F_L}\) and \(~PD{F_U}\), i.e., \({m_L}\) and \({m_U}\), respectively.

  4. 4.

    Applying the following constraints to the \(PD{F_L}\), compute weighted and thresholded \(PD{F_L}\) (\(PD{F_{LWT}}\)):

    $$\begin{aligned} PD{F_{LWT}}\left( {{X_k}} \right) & =~\theta \left( {PDF\left( {{X_k}} \right)} \right) \\ & =~\left\{ {\begin{array}{*{20}{ll}} {{P_{u}}\quad ~if~PDF\left( {{X_k}} \right)>{P_u}} \\ {{{\left( {\frac{{\left( {PDF\left( {{X_k}} \right) - {P_l}} \right)}}{{\left( {{P_u} - {P_l}} \right)}}} \right)}^{{r_l}}} \times {P_u}\quad ~ if~{P_l} \leq PDF\left( {{X_k}} \right) \leq {P_u}} \\ {0~\quad if~PDF\left( {{X_k}} \right)<{P_l}} \end{array}} \right. \\ \end{aligned}$$

    where \({P_u}={v_l} \times \hbox{max} (PDF({X_k})),0~<{v_l} \leq 1.\)

\({P_l}=0.0001~\), \({r_l}\) is the power factor and \(~0<{r_l} \leq 1\).

  1. 5.

    Compute the mean of \(PD{F_{LWT}}\), i.e. \({m_{LWT}}\).

  2. 6.

    Find the mean error \({m_{eL}}=({m_{LWT}} - {m_L})\)

  3. 7.

    Add \({m_{eL}}\) to \(PD{F_{LWT}}.\)

  4. 8.

    Find the cumulative density function of the \(PD{F_{LWT}}\)

$$CD{F_{LWT}}({X_k})=\mathop \sum \limits_{{i=0}}^{k} PD{F_{LWT}}({X_i})$$
  1. 9.

    Equalization step of lower part:

$$f_{L}^{o}(X)={X_0}+~({X_T} - {X_0})CD{F_{LWT}}(X)$$
  1. 10.

    Applying the following constraints to the\(PD{F_U}\). Compute weighted and thresholded \(PD{F_U}\) (\(PD{F_{UWT}}\)):

    $$\begin{aligned} PD{F_{UWT}}\left( {{X_k}} \right) & =~\theta \left( {PDF\left( {{X_k}} \right)} \right) \\ ~ & =~\left\{ {\begin{array}{*{20}{ll}} {{h_{u}} \quad if~PDF\left( {{X_k}} \right)>{h_u}} \\ {{{\left( {\frac{{\left( {PDF\left( {{X_k}} \right) - {h_l}} \right)}}{{\left( {{h_u} - {h_l}} \right)}}} \right)}^{{r_u}}} \times {h_u} \quad if~{h_l} \leq PDF\left( {{X_k}} \right) \leq {h_u}} \\ {0 \quad if~PDF\left( {{X_k}} \right)<{h_l}} \end{array}} \right. \\ \end{aligned}$$

    where \(~{h_u}={v_u} \times \hbox{max} (PDF({X_k})),0~<{v_l} \leq 1\), \({h_l}={m_U},~~{r_u}\) is the power factor and \(0<{r_u} \leq 1\).

  1. 11.

    Compute the mean of \(PD{F_{UWT}}\), i.e. \({m_{UWT}}\).

  2. 12.

    Find the mean error \({m_{eU}}=({m_{UWT}} - {m_U})\)

  3. 13.

    Add \({m_{eU}}\) to \(PD{F_{UWT}}.\)

  4. 14.

    Find the cumulative density function of the \(PD{F_{UWT}}\)

    $$CD{F_{UWT}}({X_k})=\mathop \sum \limits_{{i=0}}^{k} PD{F_{UWT}}({X_i})$$
  1. 15.

    Equalization step of lower part:

    $$f_{U}^{o}(X)=({X_T}+1)+~({X_{L - 1}} - ({X_T}+1)) \cdot CD{F_{UWT}}(X)$$
  1. 16.

    Output image: \(~{f^o}=f_{L}^{o}\mathop \cup \nolimits^{} f_{U}^{o}\).

In lower part, \({P_l}=0.0001\) which is very low. It means that the contribution of such intensities is negligible for the enhancement process. In the case of upper part, \({h_l}={m_U}\) which helps to control the mean brightness error between the input and output image. So, four parameters which controls the enhancement process are \({v_l}\), \(~{r_l}\), \({v_u}\)and \({r_u}\). \({v_l}\) and \({v_u}\) prevent the dominancy of the high probable intensity values over the less probable intensity values. \({r_l}\) and \({r_u}\) are the power factors which control the rate of enhancement and lies within the range [0, 1]. When they approach 1, the proposed method behaves like traditional HE. When these two parameters become greater than 1 then the over enhancement occurs. Actually, more weight is shifted to the high probable intensity levels and WTBHE gives stronger effect than traditional HE. This property is also necessary for some kind of applications where high probable levels (or background) need to enhance with extra strength.

Basically, the proper setting of these four parameters for different kind of images is not an easy task. Manual selection of the parameter values does not impart fully automation power to the proposed method. That’s why this image enhancement model has been formulated as an optimization problem and solved by employing BA and its variants with developed objective function. The application of nature-inspired optimization algorithms with proper objective functions has been discussed below.

3 Application of nature-inspired optimization algorithms in image enhancement field

Recently, image enhancement techniques have been formulated as an optimization problem and solved by employing nature-inspired optimization algorithms (Dhal et al. 2017; Dhal and Das 2017; Sowjanyal and; Kumar 2017; Yang and Papa 2016). Genetic algorithm (GA), particle swarm optimization (PSO), differential evolution (DE), Cuckoo search (CS), artificial bee colony (ABC), Firefly algorithm (FA) are some nature inspired metaheuristic algorithms which were effectively used in the image enhancement field (Gorai and Ghosh 2009, 2011; Munteanu and Rosa 2001; Pal et al. 1994; Hashemi et al. 2010; Coelho et al. 2009; Dhal et al. 2015a, b, c; Braik et al. 2007; Shanmugavadivu et al. 2014). PSO gave a better result than GA in the image enhancement domain by maximizing employed entropy based objective function. ABC, CS and FA outperformed the GA in terms of better convergence rate when these algorithms maximized or minimized the used objective functions (Gorai and Ghosh 2009, 2011; Yang and Deb 2009; Yang 2010a, b). CS and FA also outperformed PSO by considering the ability to maximize or minimize some benchmark mathematical functions (Yang 2010a, b). The performance of these algorithms can be increased by some mechanism such as the use of different random number generators to modify the solutions (Coelho et al. 2009; Dhal et al. 2015a, b, c), use of different inertia weight to get a better convergence rate (Dhal et al. 2015c; Bansal et al. 2011), use of communication between solutions (Walton et al. 2013). Mutation factor and crossover rate had been modified by a chaotic sequence of traditional DE algorithm and the experimental result showed that modified DE was far better than traditional DE in the image enhancement field with faster convergence rate and also maintained a good diversity property (Coelho et al. 2009). Levy flight with chaotic step length had been used to generate new solutions and one population diversity measurement technique had been used as a safeguard from premature convergence to modify FA and DE which outperformed the traditional FA and DE in the image enhancement domain by maximizing the employed objective function with faster convergence rate (Dhal et al. 2015a, b). A newly proposed metaheuristic algorithm called Bat algorithm (BA) which already outperformed GA and PSO (Yang 2010c, 2013) in mathematical optimization field. BA gave better results than the CS algorithm in image enhancement field (Dhal et al. 2015c). Some modifications were also reported on BA in literature to improve its performance (Fister Jr et al. 2014a; Fister et al. 2014b; Yilmaz et al. 2014; Fister Jr et al. 2013a; Fister et al. 2013b; Liu et al. 2012; Gandomi and Yang 2014). Fister et al. proposed a new BA having the capability of a self-adaption of control parameters that used DE as local search heuristics and their BA returned better results than traditional BA (Fister Jr et al. 2014a). The modified BA presented by Yilmaz et al. in which pulse rate and loudness modification rules of BA had been changed and modified BA gave better results (Yilmaz et al. 2014). BA was also hybridized with DE where DE was applied as a local optimizer and this modification also increased the efficiency of traditional BA (Fister Jr et al. 2013a; Fister et al. 2013b). Doppler Effect had been used to formulate a new equation for frequency modification in BA (Liu et al. 2012). In standard BA velocity and location of the bats crucially depend on frequency. Hence, frequency modification also increases the efficiency of the BA. Gandomi and Yang proposed one chaotic BA variant where pulse rate, loudness, and frequency were replaced by different chaotic sequences (Gandomi and Yang 2014). Experimental results showed the supremacy of modified BA over standard one to some great extent when only the pulse rate was replaced by sinusoidal chaotic map (Gandomi and Yang 2014). Therefore, modification and hybridization carry out important roles to enhance the effectiveness of BA. BA had also been effectively employed in the multi-objective optimization field (Yang 2011). In this study, an improved Bat algorithm (BA) has been developed with the assistance of one dynamic inertia weight and self-adaption strategies of algorithm’s parameters. Where, both inertia weight and values of the parameters are updated based on the solution’s own performance. Chaotic sequence and developed population diversity metric are employed over BA to perform the local search and generate one improved initial population respectively. The improved BA has been compared with other recently developed BA variants and gives outstanding performance. One novel co-occurrence matrix based objective function has been also formulated which facilitates the proposed BA for finding the optimal parameters of WBTHE which is discussed in next sub-section.

3.1 Objective function

Contrast, entropy, and energy of the image have been taken into account to develop the objective function. Depending on the gray level co-occurrence matrix contrast, energy has been calculated.

3.1.1 Gray-level co-occurrence matrix (GLCM)

Gray-level co-occurrence matrix (GLCM) (Haralick 1979), also known as the gray-level spatial dependence matrix is a statistical method of examining texture that considers the spatial relationship of pixels. The GLCM functions characterize the texture of an image by calculating how often pairs of the pixel with specific values and in a specified spatial relationship occur in an image. The number of gray levels in the image determines the size of the GLCM. Each element (i, j) in the resultant GLCM is simply the sum of the number of times that the pixel with the value i occurred in the specified spatial relationship to a pixel with value j in the input image. The element of the (i, j)th entry of the co-occurrence matrix is defined as

$$t(i,j)=~\mathop \sum \limits_{{m=0}}^{{M - 1}} \mathop \sum \limits_{{n=0}}^{{N - 1}} \partial (m,n)$$
(5)

where M and N are the numbers of pixels in horizontal and vertical directions.

$$\begin{aligned} \partial \left( {m,n} \right) & =1~\quad if~f\left( {m,n} \right)=i~and~f\left( {m,n+1} \right)=j~or~f\left( {m,n} \right)=i~and~f\left( {m+1,n} \right)=j \\ & =0\quad Otherwise \\ \end{aligned}$$

The co-occurrence matrix has been created depending on the two directions, horizontal and vertical which are sufficient to store information of the image. However, the matrix is not symmetric as a report by Haralick (Pal and Pal 1989). Other directions do not add so much more information about the image. Hence the time complexity to calculate the GLCM is reduced.

In this paper normalized co-occurrence matrix has been used which can be defined as:

$$p\left( {i,j} \right)={\raise0.7ex\hbox{${t(i,j)}$} \!\mathord{\left/ {\vphantom {{t(i,j)} {\mathop \sum \nolimits_{{i=0}}^{{M - 1}} \mathop \sum \nolimits_{{j=0}}^{{N - 1}} t(i,j)}}}\right.\kern-0pt}\!\lower0.7ex\hbox{${\mathop \sum \nolimits_{{i=0}}^{{M - 1}} \mathop \sum \nolimits_{{j=0}}^{{N - 1}} t(i,j)}$}}$$
(6)

Actually, there are 18 parameters which can be measured from normalized GLCM. In this study, two parameters, namely contrast and energy has been taken into consideration to develop the objective function.

Contrast Local variations of gray levels are measured by contrast parameter. Large neighboring gray level differences are associated with high contrast (Haralick 1979). The equation of the contrast is given below:

$$Contrast({I_{con}})=~\mathop \sum \limits_{{i,j}} {\left| {i - j} \right|^{2~}}p(i,j)$$
(7)

Energy Energy is the measure of image homogeneity and it reflects pixel-pair repetitions (Haralick 1979). It is defined as:

$$Energy~({I_{en}})=~\mathop \sum \limits_{{i,j}} p{(i,j)^{2~}}$$
(8)

The range of energy is [0, 1]. For constant image, it is 1.

Entropy Shannon defined the entropy as a function of the probability of occurrence of states of the system (Pal and Pal 1989; Shannon 1948). Basically, an image can be thought as an information resource. The source is described by the probability vector which is nothing but the gray level histogram. Let probability vector \(~P~as~({p_{0~}},{p_1},~ \ldots ,{p_i}, \ldots ,~{p_{L - 1}})\). For an 8 bit image the value L is 256. \({p_{i~}}\) is the probability of occurrence of ith gray level in an image, for \(0 \leq i \leq 255\). Basically, \({p_i}\) is the ratio between number of occurrence of a specific gray level to the total number of pixels in that image. According to Shannon, if a system has n different states with probability of occurrence \({p_i}\) for \(i=1,2,3, \ldots .n~\) then the gain of information from ith event with probability \({p_i}\) is given by \({I_{Gi}}=~ - lo{g_{2~}}{p_i}\). The expectation of the values of \({I_{Gi}}\) for \({G_i}=1,2, \ldots ~n\) is called entropy of the system. For an 8 bit image, n is replaced by L = 256. So the entropy of an image is defined as (Kapur et al. 1985):

$$Entropy(H_{e} ) = - \sum\limits_{{i = 0}}^{n} {p_{i} \log _{2} p_{i} .}$$
(9)

Actually, different authors have defined entropy of an image in a different way, but in this study, this definition has been taken into consideration. Entropy value reveals the information content in the image. If the distribution of the intensities is uniform, then we can say that histogram is equalized and the entropy of the image is more. For a constant image, the value of entropy is 0.

Depending upon these three parameters the proposed objective function has been described as:

$$FIT\left( {{v_l},{r_l},{v_u},{r_u}} \right)=log\{ \left[ {{I_{con}} \times \exp \left( {{H_e}} \right)} \right]/{I_{en}}\}$$
(10)

where \(FIT(.)\) is the objective function. \(~{H_e}\) is the entropy of the enhanced image, \(~{I_{con}}\) and \({I_{en}}\) are the contrast and energy of the co-occurrence matrix. exp is the exponential operator. So the optimization problem has been defined as:

$$\left\{ {{v_l}_{0},{\text{~}}{r_l}_{0},{\text{~}}{v_u}_{0},~{r_u}_{0}} \right\}=\arg [max{~_{{v_l},{r_l},{v_u},{r_u}}}\{ FIT({v_l},{r_l},{v_u},{r_u})\} ]$$
(11)

3.2 Creation of initial population

The initial population is usually created randomly. The equation of standard method is given below:

$${Y_i}=low+(up - low) \times \partial$$
(12)

\({Y_i}\) is the ith individual. \(up~\) and \(low\) are the upper and lower bound of the search space of the objective function. \(\partial\) is the random variable belongs to [0,1]. If the initial population carries a great variance, then it helps to restrict the premature convergence of the algorithm. The variance of the initial population significantly depends on \(\partial\). In literature, \(\partial\) has been generated by uniform distribution. But here \(\partial\) has been generated with the help of one powerful chaotic sequence generator called logistic equation. It is proved in Sect. 3.3 that the variance of initial population is better when \(\partial\) is generated by logistic equation. To measure the population diversity of the initial population one metric has been proposed called diversity factor \(({D^t})\) (see Sect. 3.2.2). If the value of diversity metric is less than the specified threshold, then this initial population is suitable for searching the global best solution. The threshold value has been taken as 0.4 in this study. This has been done in this study because population with greater variance/diversity increases the search capacity of population based metaheuristic algorithms (Fister Jr et al. 2013a; Fister et al. 2013b). The detailed explanation has been given in the next two sub-sections.

3.2.1 Chaotic sequence

The complex behavior of the non-linear deterministic system is defined by chaos (Boccaletti et al. 2000; Leandro and Viviana 2009). It has been proved that the cooperative behavior of ants and food collection behavior of bees and birds also shows chaotic behavior (Sheikholeslami and Kaveh 2013). Chaos has non-repetition property and for this, it searches the best solution faster than any searching strategy that depends upon the probability distribution (Leandro and Viviana 2009). It also has ergodicity property. Recently, chaos combined with metaheuristic algorithmshas been reported to produce good results (Leandro and Viviana 2009; Coelho and Mariani 2008; Caponetto et al. 2003). Chaotic sequences are used in metaheuristic algorithms for three purposes 1. To generate random numbers 2. To generate inertia weight 3. To perform the local search. In this study, it has been used to perform local search and to generate random numbers.

There are several chaotic generators like a logistic map, tent map, gauss map, sinusoidal iterator, lozi map, Chua’s oscillator etc. (Caponetto et al. 2003). Among that logistic equation is used in this study. The equation of logistic map is given below:

$${L_{m+1}}=a{L_m}(1 - {L_m})$$
(13)

a is a control parameter in the range 0 < a ≤ 4, \({L_m}\) is the chaotic value at mth iteration. The behavior of the system mostly depends on the variation of a. Value of a is set to 4 and \({L_0}\) does not belong to {0, 0.25, 0.5, 0.75, 1} so as the logistic equation shows chaotic behavior (Coelho et al. 2009).

Another well-known chaotic map is Kent map (Fister Jr et al. 2014a; Fister et al. 2014b). It is used to generate a pseudo-random number and mainly used in secure encryption. It is defined as:

$$x\left( {n+1} \right)=~\left\{ {\begin{array}{*{20}{c}} {x\left( n \right)/m\quad if~0<x(n) \leq m} \\ {\frac{{(1 - x(n))}}{{1 - m}}~\quad if~m<x(n)<1} \end{array}} \right.$$
(14)

where \(0<m<1\). So, if \(~x\left( 0 \right) \in \left[ {0,1} \right]\) for all \(n \geq 1\), \(x\left( n \right) \in \left[ {0,~1} \right]\). In accordance with the propositions (Fister Jr et al. 2014a; Fister et al. 2014b), m = 0.7 has been used in this study.

3.2.2 Diversity factor (\({D^t}\))

Diversity factor has been used to measure the variance of the population in the swarm-based algorithms. It is defined as:

$${D^t}=\left| {\overline {{Fi{t_t}}} /Fi{t_{tbest}}} \right|$$
(15)

where \(0<{D^t} \leq 1\).

\(Fi{t_{tbest}}\) is the fitness value of best solution and \(\overline {{Fi{t_t}}}\) is the mean fitness value of the population at tth iteration. It is quite clear from the above Equation of diversity factor that if \({D^t}\) is close to 1 then population diversity is low at tth iteration.

A population with a better variance increases the ability to jump out from local trapping. Population diversity was also measured by one metric called fitness diversity metric (FDM) (Fister Jr et al. 2013a; Fister et al. 2013b). FDM had been successfully employed in FA (Dhal et al. 2015a) and DE (Dhal et al. 2015b). However, it is evident from Fig. 1 that the proposed \({D^t}\) is opposite in nature compares to the FDM (Fister Jr et al. 2013a; Fister et al. 2013b).

Fig. 1
figure 1

Variance (X-axis) vs. {FDM and \(~{D^t}\) (Y-axis)} {FDM (popfact) and \({D^t}\) (divfact)}

3.3 Graphical analysis of the variance measurement of random number generators

Graphical and mathematical analysis of different random number generators have been performed in this study to prove that which random number generator is superior to produce better initial population in terms of greater variance. Greater variance among population also signifies the greater population diversity. There are three random number generators: uniform distribution based, logistic equation based and kent map based have been used and compare among each other in this paper. Figures 2a, 3a, and 4a are the graphical representation of these three random number generators respectively with 100 individuals within 100 iterations. Whereas, Figs. 2b, 3b, and 4b are the graphical representation of these three random number generators respectively with 25 individuals within 20 iterations. From the Figs. 2, 3 and 4, it is clear that population generated by the logistic equation carries greater variance than population generated by uniform distribution and Kent map when the number of individuals and iterations are small or large respectively. The values of average variances which are summarized in Table 1 also demonstrates that logistic equation is better for producing better variance based initial population.

Fig. 2
figure 2

a Population generated by Uniform Distribution (X-axis: iteration number, Y-axis: variance: with 100 iterations and 100 individuals). b Population generated by Uniform Distribution (X-axis: iteration number, Y-axis: variance: with 20 iterations and 25 individuals)

Fig. 3
figure 3

a Population generated by Kent Map (X-axis: iteration number, Y-axis: variance: with 100 iterations and 100 individuals). b Population generated by Kent Map (X-axis: iteration number, Y-axis: variance: with 20 iterations and 25 individuals)

Fig. 4
figure 4

a Population generated by Logistic Equation (X-axis: iteration number, Y-axis: variance: with 100 iterations and 100 individuals). b Population generated by Logistic Equation (X-axis: iteration number, Y-axis: variance: with 20 iterations and 25 individuals)

Table 1 Values of average variances

So, if the number of individuals is between 20 and 100 then using of a logistic equation to generate population is justified. The initial population has been used for further processing in proposed BA as per the following rule:

$$if\{ {D^t}\left( {initial~population} \right) \leq 0.4\}$$

then the corresponding population has been used for further processing in the proposed BA.

4 Bat algorithm and its variant

Bat algorithm, originally presented by Xin-She Yang under the inspiration of the echolocation behavior of bats (Yang 2010c, 2013) is one of the most efficient and rigid metaheuristic algorithms for solving computational problems.

4.1 Idealize the behavior of bats

There are three ideal rules which are assumed in the development of the algorithm.

  1. 1.

    All bats use echolocation to sense distance, and they also ‘know’ the differencebetween food/prey and background barriers in some magical way.

  2. 2.

    Bats fly randomly with velocity Vi at position Yi with a fixed frequency fmin, varying wavelength λ and loudness A to search for prey. They can automatically adjust the wavelength (or frequency) of their emitted pulses and adjust the rate of pulse emission r ∈ [0, 1], depending on the proximity of their target.

  3. 3.

    Although the loudness can vary in many ways, we assume that the loudness varies from a large (positive) A0 to a minimum constant value Amin. (Yang 2010c)

  4. 4.

    Pulse rate increase and loudness decrease when the bat going to reach to its prey.

  5. 5.

    In general, the frequency fmin a range [fmin,fmax] corresponds to a range of wavelengths [λmin, λmax] (Yang 2010c).

4.2 Bat algorithm and its working strategy

The pseudo-code of BA is as follows:

  1. 1.

    Objective function has been taken following Eq. (10).

  2. 2.

    Initialize the population of bats, Y = {Yi|i = 1,2,3,…,n} as per Eq. (11) where \(\partial\) is generated with the help uniform distribution. Where, n is the number of bats or population size, and Yi is the ith bat.

  3. 3.

    Initialize the Velocity (V), Loudness (A), and Pulse rate (r) to each bat randomly.

  4. 4.

    Global Search step: Generate new solutions by adjusting frequency using equations these are given below:

    $$f_{i}^{t}={f_{min}}+\left( {{f_{max}} - {f_{min}}} \right) \cdot \beta$$
    $$V_{i}^{{t+1}}=V_{i}^{t}+\left( {Y_{i}^{t} - {Y_*}} \right) \cdot f_{i}^{t}$$
    $$Y_{i}^{{t+1}}=Y_{i}^{t}+V_{i}^{{t+1}}$$

Here \({f_i}\)controls the pace and range of the movement of every bat. \(\beta \in [0,~1]\) random number generated from uniform distribution.

  1. 5.

    Local Search step: Select corresponding best solution \({Y_{best}}\) and create new solution using equation as:

$$\begin{gathered} if\left( {rand>{r_i}} \right){\text{~~~}}then~~Z={Y_{best}}+\varepsilon \times {A_{avg}} \hfill \\ Otherwise,{\text{ }}remains{\text{ }}same \hfill \\ \end{gathered}$$

where \({A_{avg}}\) is the average loudness of all bats and \(\varepsilon \epsilon \left[ { - 1,1} \right]\), \(rand\epsilon \left[ {0,1} \right]\) is taken from uniform distribution

  1. 6.

    Simulated Annealing step: It is for maintaining population diversity.

    $$\begin{gathered} if(rand<{A_{i~}}\& ~fit(Z)<fit({Y_i})) \hfill \\ \quad accept{\text{ }}solution{\text{ }}of{\text{ }}local{\text{ }}search \hfill \\ \end{gathered}$$

As pulse rate increases and loudness decrease when a bat is going to reach to its prey, So, increase \(~{r_i}\) using

$$r_{i}^{{t+1}}=r_{i}^{o} \times \left( {1 - exp\left( { - \alpha t} \right)} \right)$$

where \(\alpha ~\) = 0.3, \(t\) is the current iteration number. \(r_{i}^{o}\) is the initial pulse rate of ith bat.

Decrease Ai using

\(A_{i}^{{t+1}}=A_{i}^{t} \times \gamma\) where, \(\gamma\) = 0.9.

  1. 7.

    Rank the bats and find the current best \({Y_*}\).

  2. 8.

    Repeat steps 4–7 until the stopping criterion.

  3. 9.

    Post process and visualize the result.

Bat algorithm is a composition of global search, local search and simulated annealing steps. At first, global search step or exploration has been done in step 4 followed by a random local search or exploitation on the best solution in step 5. Therefore, the exploration and exploitation efficiency of the BA purely depends on step 4 and 5. The simulated annealing step (i.e. step 6) helps the algorithm to maintain population diversity. Mature convergence to the actual global best position in less time is a crucial matter in swarm based algorithms which can be significantly controlled by the proper parameter setting strategies, employed local search techniques and inertia weight. It is reasonably clear from the traditional Bat algorithm that its simulated annealing step helps to maintain the population diversity. For that reason, this study mainly concentrates on developing a proper inertia weight. It is also true that the local search ability and the simulated annealing step of the BA are significantly affected by the loudness (A) and pulse rate (r). That’s why this study also focuses to modify the updating rules of r and A. The proposed dynamically adapted inertia weight and modified rules for updating r and A are explained below:

4.3 Dynamically adapted inertia weight

The search process of Bat algorithm is very much complex. The linearly increasing inertia weight is not a good idea (Bansal et al. 2011). This inertia weight does not help too much to converge in the actual global optima because it does not search the every point of the search space and does not depend on the individual’s performance. In this study, a dynamically adapted inertia weight which is given to every individual is different for every solution/individual. The modification of the inertia weight of every individual has been done depending on the performance of the solution.

Different inertia weight to each individual could be given by using chaotic sequence as it has the ergodicity property (Dhal et al. 2015c; Bansal et al. 2011). But chaotic inertia weight is a kind of random inertia weight, which does not affected by the individual performance and population diversity. Therefore, in order to overcome that problem, an appropriate dynamically adapted inertia weight has been formulated here depending on the individual’s fitness value and diversity of the population.

Two main factors of dynamic inertia weight are evolution speed factor which is purely determined by the speed of each individual and aggregation degree which is deduced by the performance of the whole swarm. Yang et al. also proposed these two factors for particle swarm optimization algorithm in (Yang et al. 2007). But the definition of two factors in this paper is quite different from those of Yang et al.

4.3.1 Evolutionary speed factor (ESF)

$$\begin{gathered} ~Evolutionary~speed~factor~(ESF_{i}^{t}) \hfill \\ \quad ~=\left| {\frac{{Fi{t_{gbest}} - Fit_{i}^{t}}}{{{\text{max}}(Fi{t_{gbest}}~,~~Fit_{i}^{t})}}} \right| \hfill \\ \end{gathered}$$
(16)

where \(Fi{t_{gbest}}\) is the fitness value of global best solution up to generation number t. \(Fit_{i}^{t}\) is the fitness value of ith individual at generation number t. It can be obtained that \(0 \leq ESF \leq 1\).

From the Eq. (16), it is clear that ESF strictly depends on the speed of the solution means how fast the solution reaches to the global best solution. If ESF is small then it is a good solution and inertia weight must be small for that individual. When a solution is near to the global best solution then its speed becomes slow and it needs a local search or intensification around it. For this reason, the inertia weights of good solutions or the solutions with lower ESF values are decreased and those of bad solutions are increased, as inertia weight is inversely proportional to the ESF. From the equation, it is clear that ESF metric is different from the ESF used by Yang et al. in 2007.

4.3.2 Aggregation degree (\(\theta\))

The Equation of aggregation Degree is given below:

$${\text{Aggregation degree }}(\theta )=\left| {\frac{{\overline {{Fi{t_t}}} - Fi{t_{min}}}}{{Fi{t_{max}} - Fi{t_{min}}}}} \right|$$
(17)

\(\overline {{Fi{t_t}}}\) is the mean fitness value of the population at tth iteration. \(Fi{t_{max}}\) and \(Fi{t_{min}}\) are the maximum and minimum fitness values at tth iteration respectively.

When the value of \(\theta\) is small then population diversity is low. The capability to jump out from local minima is increased when diversity in population is better. So, inertia weight increases when \(\theta\) is increased.

Depending on these two factors the inertia weight is defined as follows:

$$U_{i}^{t}={U_{ini}} - {\alpha _1}\left( {1 - ESF_{i}^{t}} \right)+{\beta _1} \cdot \theta$$
(18)

As \(0 \leq ESF \leq 1\) and \(0 \leq \theta \leq 1\), the range of inertia weight is \(1 - {\alpha _1} \leq U \leq 1+{\beta _1}\). \(~{U_{ini}}\) is the initial value of \(U\) which is set to 1 in this study. The values of parameters \({\alpha _1}\) and \({\beta _1}\) are within the range [0, 1]. In this study the values are taken from experiences where, \({\alpha _1}=0.9~\) and \({\beta _1}=0.1\).

4.4 Self-adaption of pulse rate (r) and loudness (A)

Pulse rate and loudness are initialized by logistic equation. Pulse rate is used in the Bat algorithm for intensification and loudness is used for simulating annealing step. As the iteration number increases the pulse rate increases and loudness decreases, but these traditional updating rules of pulse rate and loudness distort the main characteristics of any metaheuristic algorithm. The main characteristic of any metaheuristic algorithm is when the number of generations increases the intensification is done around the solutions and takes the best solutions for the next generation. But the basic Bat algorithm shows the opposite characteristics due to the conditions of the intensification and simulated annealing parts. For this reason, a new update technique for pulse rate and loudness has been taken into account in this study as given below:

$$\begin{aligned} r_{i}^{{t+1}} & =r_{i}^{o} \times \left( {1 - exp\left( { - \alpha t} \right)} \right)\quad if~rand<ESF_{i}^{t} \\ & =r_{i}^{t}\quad Otherwise \\ \end{aligned}$$
(19)
$$\begin{aligned} A_{i}^{{t+1}} & =A_{i}^{t} \times {\text{~}}\gamma \quad if~rand<ESF_{i}^{t} \\ ~ & =A_{i}^{t}\quad Otherwise \\ \end{aligned}$$
(20)

\(r_{i}^{t}\) is increased if \(X_{i}^{t}\) is a bad solution and is remained same if it is a good solution. \(A_{i}^{t}\) decreases if \(X_{i}^{t}\) is a bad solution. The modification of pulse rate and loudness of each individual is greatly affected by ESF value of the corresponding solution. If \(ESF_{i}^{t}\) approaches to 1 then it is a bad solution, otherwise it is a good solution. It is a quite good idea that if a solution is better then increases the probability of intensification around the corresponding solution and takes it for the next generation. But if a solution is not good, then increases the chance of diversification around that solution to reduce its chance to go in the next generation. These facts are clearly supported by the conditions of the pulse rate and loudness modification.

4.5 Updation of frequency (f i)

Frequency plays a key role in Bat algorithm. It controls the rate of convergence of a solution to the global best solution. If it changes randomly for all solutions then it can affect the convergence rate of Bat algorithm. At first, the frequency has been given to all bats randomly using a logistic chaotic generator within the range [0, 1].The range of fi must be small for a good solution because it needs intensification and reduction for a bad solution as it desires diversification. As \(ESF\) value determines whether a solution is good or bad the modification is done depending upon that value as defined below:

$$f_{i}^{t}={\text{min}}(f_{i}^{t},~ESF_{i}^{t})$$
(21)

ESF always takes a small value for best solutions as described before. This modification always correct because if the solution is among the best solutions then the change in magnitude of that solution is small. So intensification is done around the best solution which is the target of any metaheuristic algorithm.

4.6 Chaotic local search

Local search strategies are beneficial when large jumps move the solution into a poor position and finding the global optimum is a step by step fine tuning procedure. In the proposed BA, the chaotic local search has been done as it helps to converge into global optima (Choi and Lee 1998; Dhal and Das 2015).

4.7 Dynamically adapted and weighted Bat algorithm (DAWBA)

DAWBA has been proposed depending on novel dynamically adapted inertia weight and modified rules of r, A and f. The algorithm is given below:

  1. 1.

    Objective function has been formed following Eqs. (10) and (11).

  2. 2.

    Initialize the population of n bats, Y = {Yi|i = 1,2,3,…,n} as per Eq. (11) where \(\partial\) is generated with the help of logistic equation. Then depending on the Diversity Factor (\({D^t}\)) of the generated population, it has been chosen by the following rule:

    $$if\{ {D^t}\left( {initial~population} \right) \leq 0.4\}$$

Then the corresponding population has been used for further processing in the proposed BA.

  1. 3.

    Initialize the Velocity (V), Loudness (A), and Pulse rate (r) to each bat with the help of logistic equation.

  2. 4.

    Global Search Step: Generate new solutions by adjusting frequency using equations those are given below:

    $$f_{i}^{t}={f_{min}}+\left( {{f_{max}} - {f_{min}}} \right) \cdot \beta$$
    $$f_{i}^{t}={\text{min}}(f_{i}^{t},~ESF_{i}^{t})$$
    $$V_{i}^{{t+1}}=U_{i}^{t}*V_{i}^{t}+\left( {{Y_*} - Y_{i}^{t}} \right) \cdot f_{i}^{t}$$
    $$Y_{i}^{{t+1}}=Y_{i}^{t}+V_{i}^{{t+1}}$$

Here \({f_i}\) controls the pace and range of the movement of every bat. \(\beta \in [0,~1]\) random number generated using logistic equation.

  1. 5.

    Local Search step: select corresponding best solution \({Y_{best}}\) and create new solution using equation as:

$$\begin{gathered} if(rand>{r_i}) \hfill \\ \quad Z={Y_{best}}+{L_m} \times sign(rand - 0.5) \times {A_{avg}} \hfill \\ Otherwise,{\text{remains same}} \hfill \\ \end{gathered}$$

where \({A_{avg}}\) is the average loudness of all bats and \(rand\epsilon \left[ {0,1} \right]\), \({L_m} \in [0,1]\) is the chaotic sequence generated by logistic equation.

  1. 6.

    Simulated Annealing step: it is for maintaining population diversity.

$$\begin{gathered} if(rand<{A_{i~}}\& ~fit(Z)<fit({Y_i})) \hfill \\ \quad accept{\text{ }}solution{\text{ }}of{\text{ }}local{\text{ }}search \hfill \\ \end{gathered}$$

As pulse rate increase and loudness decrease when bat going to reach to its prey. Therefore, increase \(~{r_i}\) and decrease Ai using the Eqs. (19) and (20), respectively.

  1. 7.

    Rank the bats and find the current best \({Y_*}\).

  2. 8.

    Repeat steps 4–7 until stopping criterion.

  3. 9.

    Post process and visualize the result.

4.8 Stopping condition

Find the optimal stopping condition is a challenging matter. It has been chosen experimentally. It stopping conditions are:

  1. 1.

    When the fitness value of the global best solution does not change for continuous ten iterations for a specific image.

  2. 2.

    But the maximum limit of iteration number is 100 to find the optimal parameters.

4.9 Quality metrics

4.9.1 Absolute mean-brightness error (AMBE)

AMBE is basically used to measure the degree of the brightness preservation (Shanmugavadivu et al. 2014). Let input image is \(f\) and output image is G then the AMBE is calculated as:

$$AMBE=\left| {Mea{n_f} - Mea{n_G}} \right|$$
(22)

where \(Mea{n_f}\) and \(Mea{n_G}\) are the mean intensity of the input and output image respectively. If the value of AMBE is low, then the brightness preservation is better.

4.9.2 Peak-signal to noise ratio (PSNR)

This statistical metric is also used to measure the performance of image enhancement methods. PSNR is the ratio between the maximum possible power of the signal and the power of the noise (Yim and Bovik 2011). It is actually distortion metric which crucially depends on Mean-Squared Error (MSE) which is defined as:

$$MSE\left( {f,G} \right)=~\frac{{\mathop \sum \nolimits_{{i=0}}^{{N - 1}} \mathop \sum \nolimits_{{j=0}}^{{M - 1}} {{[f\left( {i,j} \right) - G(i,j)]}^2}}}{{M \times N}}$$
(23)

where \(f~\)and\(G~\)are the inputs and output image respectively. \(~M~\) and \(~N\) are the numbers of rows and columns of the image.

The PSNR is calculated as follows:

$$PSNR\left( {f,G} \right)=10lo{g_{10}}~(\frac{{{{(L - 1)}^2}}}{{MSE(f,G)}})~$$
(24)

\(L~\) is the number discrete gray level. For 8 bit image it is 256.

If the value of PSNR is increased then the contrast of the image is also enhanced and Absolute Mean Brightness Error (AMBE) is also reduced to some extent.

4.9.3 Quality Index based on local variance (QILV)

QILV is used to measure the structural information of the image (Dhal and Das 2017). A great amount of the structural information of an image is coded in its local variance distribution. Local variances features of an image can help to compare two images properly. The local variance of an image I is defined as \(Var\left( {{I_{i,j}}} \right)=E({({I_{i,j}} - \overline {{{I_{i,j}}}} )^2})\), being \(\overline {{{I_{i,j}}}} =E({I_{i,j}})\) the local mean of the image. It may be estimated using a weighted neighborhood \({{{\varvec{\upeta}}}_{i,j}}\) pixel under analysis with respective weights \({\omega _{\text{p}}}\) as:

$$Var\left( {{I_{i,j}}} \right)=~\frac{{\mathop \sum \nolimits_{{p \in \eta i,~j}} {\omega _p}{{\left( {{I_{i,j}} - \overline {{{I_{i,j}}}} } \right)}^2}}}{{\mathop \sum \nolimits_{{p \in \eta i,~j}} {\omega _p}}};~\overline {{{I_{i,j}}}} =~\frac{{\mathop \sum \nolimits_{{p \in \eta i,~j}} {\omega _p}{I_p}}}{{\mathop \sum \nolimits_{{p \in \eta i,~j}} {\omega _p}}}$$
(25)

The estimated local-variance of the image will beused as a quality measure of the structural similarity between two images. The mean of the local variance \({\mu _{{V_I}}}\) is estimated as:

$${\mu _{{V_I}}}=~\frac{1}{{MN}}\mathop \sum \limits_{{i=1}}^{M} \mathop \sum \limits_{{j=1}}^{N} Var({I_{i,j}})$$
(26)

The (global) standard deviation of the local variable is defined as:

$${\sigma _{{V_I}}}={\left( {\frac{1}{{MN - 1}}\mathop \sum \limits_{{i=1}}^{M} \mathop \sum \limits_{{j=1}}^{N} {{\left( {Var\left( {{I_{i,j}}} \right) - {\mu _{{V_I}}}} \right)}^2}} \right)^{\frac{1}{2}}}$$
(27)

Finally, the covariance between the variances of two images I and J is defined as:

$${\sigma _{{V_I}{V_J}}}=~\frac{1}{{MN - 1}}\mathop \sum \limits_{{i=1}}^{M} \mathop \sum \limits_{{j=1}}^{N} \left( {~~Var\left( {{I_{i,j}}} \right) - {\mu _{{V_I}}}} \right)\left( {Var\left( {{J_{i,j}}} \right) - {\mu _{{V_J}}}} \right)~$$
(28)

Quality Index based on local variance (QILV) between two images I and J is as follows:

$${\text{QILV~}}(I,~J)=\frac{{2{\mu _{{V_I}}}{\mu _{{V_J}}}}}{{\mu _{{{V_I}}}^{2}+~\mu _{{{V_J}}}^{2}}} \times \frac{{2{\sigma _{{V_I}}}{\sigma _{{V_J}}}}}{{\sigma _{{{V_I}}}^{2}+~\sigma _{{{V_J}}}^{2}}} \times \frac{{{\sigma _{{V_I}{V_J}}}}}{{{\sigma _{{V_I}}}{\sigma _{{V_J}}}}}$$
(29)

The first term of QILV equation carries out a comparison between the mean of the local variance distributions of both images. The second one compares the standard deviation of the local variables. The third term is the one to introduce spatial coherence. If QILV increases, then the structural information about the enhanced image is preserved.

5 Result section

The experiment is performed over 100 Gy-level images using MatlabR2009b with Windows-7 OS, x32-based PC, Intel(R) Pentium (R)-CPU, 2.20 GHz with 2 GB RAM. As BA is stochastic in nature, it produces dissimilar results in different run. That’s why BA and its variants have been run 20 times for each image and the enhanced image with maximum corresponding fitness value is taken into consideration.The proposed BA variant DAWBA has been compared with six other metaheuristic algorithms which include four well-known BA variants, traditional BA and Particle Swarm optimization (PSO) listed in Table 2. Tables 3 and 4 lists the values of the quality parameters and the objective functions of the Fig. 5a–h and 6a–h. Friedman ranking (Derrac et al. 2011) based on fitness function maximization ability is also done in Tables 3 and 4. To compare the performance of BA variants average values of the quality parameters over 100 images have been computed and represented in Table 5. Average computational times over 100 images are also measured and ranking based on it is also done in Table 6. Results of Tables 3, 4, 5 and 6 clearly demonstrate that DAWBA significantly outperforms the other six metaheuristic algorithms in terms of convergence speed and objective function maximization capability.

Table 2 Algorithms used for the comparison
Table 3 Quality parameters values for Fig. 5 (Aircraft image)
Fig. 5
figure 5

Aircraft image: a original, b result of DAWBA, c result of HSABA, d result of HBA, e result of CBA-IV, f result of MBA, g result of BA, h result of PSO, i result of BBHE, j result of DSIHE, k result of MMBEBHE, l result of CLAHE

Fig. 6
figure 6

Jet image: a original, b result of DAWBA, c result of HSABA, d result of HBA, e result of CBA-IV, f result of MBA, g result of BA, h result of PSO, i result of BBHE, j result of DSIHE, k result of MMBEBHE, l result of CLAHE

Table 4 Quality parameters values for Fig. 6 (Jet image)
Table 5 Average quality parameters values over 100 images
Table 6 Computational time and ranking of the BA variants based on it

5.1 Analysis of the consistency of the BA and its variants

The consistency of the BA and its variants has been measured by maximizing the proposed objective function iteratively. Each variant has been run 20 times for each image and the values of the maximum and minimum objective function have been recorded for that image over that 20 runs. Now the consistency has been taken as the difference between the maximum and minimum objective values of that corresponding 20 runs. Therefore, the less difference represents better consistency. The same methodology has been used for 100 images. Then the average difference (AD) over 100 images has been computed by the following equation:

$${\text{Average~difference~(AD)}}=\frac{1}{{\text{p}}}\mathop \sum \limits_{{{\text{i}}=1}}^{{\text{p}}} {\text{Diff}}({{\text{X}}_{\text{i}}})$$
(30)

\({\text{Diff(}}{{\text{X}}_{\text{i}}}{\text{)}}={\text{Max~Obj(}}{{\text{X}}_{\text{i}}}{\text{)}} - {\text{Min~Obj(}}{{\text{X}}_{\text{i}}}{\text{)}}\); \({\text{p}}=100\)where \({\text{Max~Obj(}}{{\text{X}}_{\text{i}}}{\text{)}}\) and \({\text{Min~Obj(}}{{\text{X}}_{\text{i}}}{\text{)}}\) are the maximum and minimum objective function values over 20 iterations for ith image respectively, and \({\text{Diff}}\left( {{{\text{X}}_{\text{i}}}} \right)\) is the difference between these two. The values AD for each BA variant have been given in Table 7 and their ranking is also done based on AD.

Table 7 Ranking based on the consistency of the BA variants

From the Table 7, it is clear that HSABA outperforms DAWBA and other variants. DAWBA is the second most consistent algorithm among those seven algorithms in terms of AD. But, Average values of the objective functions (Avg. Obj.) corresponding to that 20 runs have been computed which also indicates the measurement of the consistency. According to average objective function value over that 20 runs DAWBA is better than other employed algorithms. Therefore, it can be said that there is greater chance of local trapping for HSABA compares to DAWBA because it gives minimum AD but fails to maximize the objective function like DAWBA.

5.2 Effect of logistic equation based initial population

It is proved in the Sect. 3.3 that logistic equation based initial population always carries greater variance. In this section, it is also proved that logistic equation based initial population also contains better gbest solution in terms of fitness value. Table 8 lists the fitness values of the gbest solution of the initial population generated by uniform distribution and logistics equation. It can be noticed that the average fitness value of gbest solution of the initial population generated by logistic equation is always greater than the uniform distribution based gbest solution.

Table 8 Effect of initial population generated by different random number generators

5.3 Effect of different strategies

DAWBA has been proposed by employing three strategies: a novel inertia weight, chaotic local search and dynamic adaption of frequency (f), Pulse Rate (r) and Loudness (A). To investigate the effects of these strategies, the comparison has been done between the performances of BA with these strategies. This comparison will reveal the effectiveness of those strategies individually. The involved algorithms are as follows:

Standard BA.

BA with chaotic local search and proposed dynamic parameter adjustment method.

BA with chaotic local search, dynamic parameter adjustment method and proposed inertia weight.

The fitness values, computational time and Friedman ranking based on their objective function maximization ability have been performed in Table 9. The effect of the proposed inertia weight, dynamic parameter adjustment method and chaotic local search is quite clear from the Table 9. Chaotic local search and proposed parameter adjustment method increase the convergence speed and efficiency of the standard BA and hence, reduces the computational time. But application proposed inertia weight over that significantly enhances the capability of BA in terms of computational time and objective function’s maximization ability.

Table 9 Measurement of effects of the different strategies

5.4 Parameter settings

Standard BA and DAWBA associated with a few parameters on which their efficiency significantly depends. Proper setting of these parameters is performed based on the experience and self-adaption strategy. The parameters and their values are listed in Table 10.

Table 10 Parameter settings of BA and DAWBA

5.5 Graphical analysis of convergence rate

Convergence rate of the BA and its variants corresponding to Figs. 5 and 6 have been given in Fig. 7a, b, respectively. It can be easily verified that convergence rates of DAWBA, HSABA and HBA are far better than other BA variants and PSO. But, computational time clearly reveals that DAWBA is the best BA variants according to the convergence rate. It can be also seen from the corresponding graphs that the initial starting points of DAWBA are always above of the existing BA variants because the initial population for DAWBA is generated by logistic equation.

Fig. 7
figure 7

Convergence curves of the BA and its variants: a For Fig. 5. b For Fig. 6

5.6 Graphical analysis of brightness preservation ability of objective function

The selection of the objective function for image enhancement is a crucial task because it is a mathematical quality measurement of an image which is not always depicted correctly the visual quality. Original brightness preservation of the images which is the key necessity in consumer electronics field is also main aim of this study. The employed objective function is excellent to preserve the original brightness because Fig. 8 shows that when the value of the objective function is increased for one specific image the AMBE reduces and PSNR increases maximum times. Therefore, this developed objective function is effective to evaluate an image in the original brightness preservation based image enhancement domain.

Fig. 8
figure 8

Changes of AMBE and PSNR with respect to objective function: a For Fig. 5. b For Fig. 6

5.7 Comparison with other enhancement techniques

The image enhancement capability of the proposed WTBHE has been measured by comparing it to the different existing and well-known histogram equalization (HE) variants such as BBHE (Shanmugavadivu et al. 2014; Chen and Ramli 2004), DSIHE (Shanmugavadivu et al. 2014; Chen and Ramli 2004), MMBEBHE (Chen and Ramli 2004, 2003a), and contrast limited adaptive histogram equalization (CLAHE) (Zuiderveld 1994) which are also developed to maintain the original brightness if the image. Values of the Quality parameters such as QILV, PSNR and AMBE also measured of the enhanced images which are given in Table 11. For example, Fig. 5i–l and 6i–l represent the enhanced images produces by different techniques. Quality parameters in Table 11 and visual analysis of Fig. 5i–l and 6i–l clearly prove that WTBHE is far better than these techniques. In Table 11, MMBEBHE gives lowest AMBE values as this technique separate the input histogram by a specified threshold which preserved the minimum AMBE between input and output image. But visual analysis and other quality parameters clearly demonstrate that WBTHE is superior to MMBEBHE by maintaining the second lowest AMBE. Therefore, it can be said that measurement of only AMBE is not a great criterion for assessing the enhanced image.

Table 11 Values of the quality parameters

6 Conclusion

This study proposed an improved BA variant called dynamically adapted and weighted BA (DAWBA) by employing three strategies: (1) dynamically parameter adjustment method (2) chaotic local search (3) fitness based inertia weight. The first strategy intends to change the rules for modifying the pulse rate (r), loudness (A) and frequency (f) of each bat in BA. The proposed modified rules successfully accelerate the convergence rate and reduce the computational time of proposed BA variant. The second one focuses on the enhancing of exploitation ability of BA by incorporating chaotic local search into it. The third one defines a new fitness based dynamic inertia weight to balance between exploration and exploitation which also assists to increase the efficiency of the BA. The efficiency of the DAWBA has been measured in the image enhancement domain. A parameterized variant of HE associated with four enhancement control parameters has been proposed in this study called weighted and thresholded Bi-HE (WTBHE). The proper enhancement of the input image significantly depends on the fine tuning of these four parameters and proper selection of objective function. An objective function is formed based on entropy, contrast and homogeneity information. Experimental results prove that this objective function helps to preserve the original brightness of the input image to some great extent. DAWBA and other metaheuristic algorithms are employed to set the four parameters of WTBHE properly with the assistance of developed objective function. Experimental results show that DAWBA gives better performance than other some existing modified BA and other well-known employed metaheuristic algorithms in terms of maximization of the objective function, computational time and consistency. Table 9 clearly demonstrates that proposed dynamic parameter adjustment method with chaotic local search significantly enhance the capability of BA within less computational time. But, application of proposed inertia weight again increases the efficiency of BA to some great extent by considering the convergence rate and maximization of objective functions. Proposed WTBHE also proves its significant supremacy over existing well-known HE variants such as BBHE, DSIHE, MMBEBHE and CLAHE visually and mathematically. In future, these proposed three strategies may help other metaheuristic algorithms to increase their efficiency in several optimization fields and the proposed image enhancement model may be useful in the medical image enhancement domain.