1 Introduction

Image segmentation is an important step in pattern recognition, computer vision and image processing. It is a process of partitioning different non-overlapping regions of an image. Many segmentation techniques like threshold based, edge based, region based, graph cut based, connectivity-preserving relaxation techniques, etc. have been proposed to segment different objects of an image. Threshold-based segmentation among them has become popular to the research community because of its simplicity, accuracy, and robustness. However, the primary challenge for this category of segmentation is to find out the best optimized threshold values to partition the different regions with sufficient accuracy. In most of the cases, the traditional optimization algorithms are inefficient to solve major real-world problems because of their failure to search the best set of optimized threshold values. Nature inspired metaheuristic optimization algorithms are thought recently to be a promising solution in this regard.

The real-world problems are somehow associated with some optimization problems. Hence, optimization has got tremendous importance as an area of research in the course of time. However, it has now become a large area of mathematics and encompasses a lot of techniques to solve different types of problems. These techniques are broadly categorized into classical algorithms [1, 2] and evolutionary algorithms [3, 4]. The classical algorithms are particularly gradient-based, and the optimized values are estimated by evaluating the derivatives of the objective functions. The evolutionary algorithms are metaheuristic and inspired by the nature or biological behavior of the living entities. Since the objective functions of many real-world problems are multimodal, the gradient-based classical methods fail to assure global or near global solutions. There is a high chance that the solutions will stick at the local optima depending on the assumption of the initial solutions. Moreover, the derivative based algorithms unsuitable for those problems whose objective functions are not differentiable. These factors lead us to search for new algorithms for finding global or near global solutions for a given problem. Evolutionary algorithms have become potential solutions for these cases.

Recently, a wide range of nature inspired metaheuristic evolutionary algorithms have been proposed and applied to solve different types of large-scale optimization problems. Some examples of such algorithms are: genetic algorithm (GA) [5,6,7], biogeography based optimization (BBO) [8], particle swarm optimization (PSO) [9, 10], artificial bee colony (ABC) [11], modified ABC [12], differential evolution (DE) [13], bacterial foraging optimization (BFO) [14], ant colony optimization (ACO) [15], cuckoo search (CS) [16], honey bee mating optimization (HBMO) [17], social spider optimization (SSO) [18], flower pollination [18], BAT algorithm [19] etc. These algorithms are successfully applied to solve the complicated and challenging engineering problems in different fields. Some good references in this regard are Bhandari et al. [12], a multilevel thresholding algorithm for segmentation of gray-level satellite image using a modified artificial bee colony algorithm (MABC), Ouadfel et al. [18], social spiders optimization (SSO) and flower pollination algorithm for multilevel image thresholding, Agrawal et al. [16], Tsallis entropy based optimal multilevel thresholding using cuckoo search algorithm, Bakhshali et al. [20], segmentation of color lip images using BFO, Khairuzzaman et al. [21], multilevel image thresholding using grey wolf optimizer, Aziz et al. [22], Whale Optimization Algorithm and Moth-Flame Optimization for multilevel thresholding image segmentation, etc. Moreover, in line with the no free-lunch theorem [23], a particular metaheuristic algorithm may not be able to produce the best result in the solution of all types of problems. This leads us to develop and/or search a metaheuristic algorithm or enhance the performance of the existing algorithm by various hybrid or improved version. Some such hybrid algorithms are: enhancing particle swarm optimization using generalized opposition-based learning [24]; opposition-based artificial bee colony with dynamic Cauchy mutation [25]; opposition-based kill herd algorithm with Cauchy mutation and position clamping [26]; opposition-based differential evolution [27] etc.

EHO is newly developed metaheuristic algorithm, proposed by Wang et al. [28] This algorithm has been inspired by the herding behaviour of the elephant in nature and is applied to improve the solutions of many real-life problems. Meena et al. [29] have used improved elephant herding optimization for multi-objective DER accommodation in distribution systems. Tuba et al. [30] have applied EHO to obtain optimal parameters for the support vector machine to determine the exact erythemato-squamous diseases. However, though EHO has shown its potential performance with better results in many cases; sometimes premature stagnation at local optima makes it inferior with respect to other contemporary evolutionary algorithms. To combat it, we propose a variant of EHO by incorporating opposition-based learning (OBL) [31] and Dynamic Cauchy Mutation (DCM) [32,33,34] to EHO and use it to obtain the improved optimal threshold in multilevel image thresholding with higher speed.

The opposition based learning (OBL) was first proposed by Tizhoosh [31]. The key concept of OBL is to search for better candidate solutions by the simultaneous evolution of an estimate and its corresponding opposite estimate which is closer to the global optimum. According to central opposition theorem [35],the probability that the opposite candidate solution is closer to the global optimum is greater than the probability of a second random presumption. Many researchers have utilized the concept of OBL in combination with different soft computing algorithms. These include particle swarm optimization (PSO), artificial bee colony (ABC), Krill Herd algorithm (KH) and Differential Evolution (DE) to solve the real-life complex optimization problems. In this paper, OBL and DCM have been incorporated in the conventional EHO to accelerate the convergence rate as well as to enrich the performance of standard EHO in terms of the optimized threshold values.

We organize the article as follows: Sect. 2 presents the basic EHO and OBL theory, Sect. 3 proposes the improved EHO. Section 4 represents the mathematical model for image segmentation. Section 5 demonstrates the application of the proposed algorithm to solve the image thresholding problem. Section 6 describes the simulation results of the proposed improved EHO on multilevel thresholding in image segmentation. Finally, the conclusions are drawn in Sect. 7.

2 Elephant herding and opposition based learning algorithms

This section presents a brief overview of elephant herding and opposition based learning algorithm.

2.1 Elephant herding optimization (EHO) algorithm

In Wang et al. [28] developed a new metaheuristic algorithm called elephant herding optimization (EHO) algorithm. The EHO algorithm is developed from the natural behaviour of elephant herding. An elephant group is composed of a number of clans headed by a matriarch. A clan consists of females with their calves. Female members prefer to live with family members whereas the male members prefer to live a nomadic and solitary life. Therefore, they will gradually become independent of their families until they break away the relationship with their families completely to either roam alone or find a small group of male elephants.

Wang et al. have modelled this herding behaviour of elephant into clan updating and separation operator to solve an optimization problem. For solving an optimization problem using this herding behaviour of the elephant, the following assumptions are considered.

  • Each elephant group is composed of some number of clans and each clan consists of a fixed number of elephants under the headship of a matriarch

  • In each generation, a fixed number of male elephants live away from the clan and they are considered as minimum fitness value (for the maximization problem).

  • The matriarchs are represented by the maximum fitness value.

2.1.1 Clan updating operator

As matriarchs are the leaders of the elephant group, all the members of a particular clan \(c_i\) are influenced by the matriarch of the clan \(c_i\), so in each generation the next position of the member’s jth elephant of the clan \(c_i\) is calculated as

$$\begin{aligned} x_{new,c_i,j}=x_{c_i,j} + \alpha \times (x_{best,c_i}-x_{c_i,j}) \times r \end{aligned}$$
(1)

where \(x_{best,ci}\) is the fittest elephant of the clan is \(c_i\), \(x_{new,ci,j}\) represents the new updated position of jth elephant in clan \(c_i\) respectively. Matriarch influence to the jth elephant of the clan \(c_i\) is determined by the control parameter \(\alpha \in [0,1]\) and \(r\in [0,1]\), is a random number taken from a set of uniformly distributed numbers. The next updated position of fittest elephant for \(x_{ci,j}=x_{best,ci}\) is calculated as follows

$$\begin{aligned} x_{new,c_i,j}= \beta \times x_{center,c_i} \end{aligned}$$
(2)

where \(\beta \in [0,1]\) is a control parameter which determines the influence factor of \(x_{center,ci}\) on \(x_{new,ci,j}\). The \(x_{center,ci}\) of the clan \(c_i\) can be determined by the following equation.

$$\begin{aligned} x_{center,c_i,d}=\frac{1}{n_{c_i}}\times \sum _{n_{c_i}}^{j=1}{x_{c_i}d} \end{aligned}$$
(3)

where \(n_{c_i}\) is the number of elephants of each clan; \(1\le d \le D\) represents the dth dimension and D is the total dimension.

2.1.2 Separating operator

In the elephant group, young male elephants prefer to leave alone so, they leave their family members. This characteristic is implemented in this optimization technique as separating operator. In each generation worst elephant of each clan updates its position by the following.

$$\begin{aligned} x_{wrost,c_i}=x_{min} + (x_{max}-x_{min}) \times rand \end{aligned}$$
(4)

where \(x_{worst,{c_i}}\) is the worst elephant of the clan \(c_i\) of elephant group \(x_{max},x_{min}\) are the maximum and minimum value of the search space and \(rand \in [0,1]\) follows the uniform distribution.

2.2 Opposition-based learning (OBL)

Generally, the initial population for all the evolutionary algorithms is generated randomly and gradually they reach to the optimal solution in subsequent iterations and stop at the predefined condition. The convergence time of the algorithms are linked to the distances of these initial guesses from the optimal solution. If the selection of the initial solution is closer to the optimal solution then it converges quickly, otherwise, it takes a longer time to converge. Opposition based learning (OBL) [29] is one of the efficient concepts to improve the initial solution by simultaneously evaluating the current candidate solution and its opposite solution and choose the more fitted one as the initial solution. The underlying concept is that as per probability theory any predicted solution is 0.5 times far away from the actual solution than its contrary solution. The method is useful not only for starting population but also for each iteration to improve the final solution.

The concept of OBL in optimization problem is based on simultaneously evaluation of current candidate solution and its opposite solution. Some definitions related to OBL are given below:

2.2.1 Opposite number

Opposite number (\(\overline{x}\) ) of a real number (x) is express as \(\overline{x}=a+b-x\), where \(x\in [a,b]\). The same concept may be applied for generating opposite number in multidimensional problem.

2.2.2 Opposite point

Let \(P=(x_1,x_2,\ldots ,x_D)\) be a point in D-dimensional space, where \(x_i\in R\) and \(x_i\in [a_i,b_i]\) and \(\{i=1,2,\ldots ,D\}\). The opposition point \(P_o (x_1,x_2,\ldots ,x_D)\) can be defined as

$$\begin{aligned} \overline{x}= a_i+ b_i - x_i \end{aligned}$$
(5)

The concept of this opposition based optimization by using the idea of opposite point is defined as follows:

Let \(P=(x_1,x_2,\ldots ,x_D)\) be the candidate solutions in D-dimensional problem space and f(P) be the fitness function for measuring the candidate fitness. The point \(P_o\) is the opposite point of the point P. In maximization problem,the point P is replaced by the point \(P_o\) if \(f(P_o )\ge f(P)\). Hence, a point and its opposite point are evaluated at the same time and choose the fittest one.

3 Proposed opposition based EHO with DCM

The basic operations of all evolutionary algorithms are divided into two parts, initialization and produced a new population in the subsequent generations. In the proposed algorithm we will enhance these two sections by embedding the concept of opposition based learning and dynamic Cauchy mutation into the standard EHO to improve the performance of the EHO as well as convergence speed. Details of the proposed algorithm ae shown in Fig. 1.

Fig. 1
figure 1

Details of improved EHO(IEHO) algorithm

3.1 Opposition based initial population

The literature review of evolutionary algorithms reveals that almost all evolutionary algorithms are started with the randomly generated initial population without prior information of the problem area. Here, the concept of OBL can be useful to create fitter starting population without prior knowledge of the problem field. In the proposed algorithm a population is produced by the conventional random number generator, and then the opposite population is produced and combined with the original population. Finally, the initial population is taken by selecting the best subpopulation depending on the fitness value.

3.2 Opposition based generation by jumping probability

The similar concept may be used in each iteration to improve the solution by forcefully changing the current population to its opposite population by using generation jumping \((J_r)\) concept, which may be fitter than the old population. After generating a new population by the IEHO in each iteration, the opposite population is formed and combined with the old population. Then we select the fittest population from the merged population as a new population for the next iteration.

According to the literature, generation jumping \((J_r)\) during exploration is more desirable than during exploitation [36]. In our segmentation problem if we set the value of jumping rate \((J_r)\) to 0.4 or 0.2 we see premature convergence for some images. We observed that if we set the value between 0.2 and 0.4, we get desired results for a large number of image data.

3.3 Dynamic Cauchy Mutation (DCM)

Various mutation operators are proposed in the literature of evolutionary optimization to improve the performance by avoiding premature convergence. Among them, Gaussian and Cauchy distribution have become popular. Compare to the Gaussian probability distribution, Cauchy probability distribution has more possibility to escape from local optima because of its longer tail probability distribution function. This motivates us to used Cauchy probability distribution as a mutation operator to enrich the performance of the conventional EHO.

In the conventional EHO, an elephant group is composed of a number of clans headed by a matriarch (global best). The other members of the clan update them by the influence of matriarch to reach better position. Hence matriarch can guide when the other member of the clan tends to be trapped.

In this algorithm, the DCM is applied on matriarch to enhance the performance of EHO.We apply the DCM operator on the matriarch as follows:

$$\begin{aligned} x_{c_i,M}=x_{c_i,M} + \delta \times CM() \end{aligned}$$
(6)

where \(x_{c_i,M}\) is the matriarch of clan \(c_i\); \(\delta\) is the dynamic weight and CM() is the random number generator by the Cauchy probability distribution.

Dynamic weight \(\delta\) is calculated as follows

$$\begin{aligned} \delta =\delta _0 + \frac{MI-I}{I} \times \delta _1 \end{aligned}$$
(7)

where \(\delta _0=0.01\); MI is the maximum number of iteration; I is the current iteration; \(\delta _1\) is calculate as follows

$$\begin{aligned} {\delta _1}= \frac{N_{max}-N_{min}}{1000} \times \delta _1 \end{aligned}$$
(8)

where \(N_{max},N_{min}\) are the maximum and minimum value of problem domain.

4 Mathematical model of thresholding problem

Thresholding is a method of dividing an image into dissimilar regions based on the intensity level (L).In bi-level thresholding, the background and foreground of an image may be separated by a threshold value by the following rules.

$$\begin{aligned} \begin{aligned}&R_1 \leftarrow P \qquad if \qquad 0\le P< T \\&R_2 \leftarrow P \qquad if \qquad T\le P < L-1 \end{aligned} \end{aligned}$$
(9)

where threshold value T divides the image into two regions and is the one of the value of the pixel in L-level gray scale image. Multiple threshold value require more than one threshold values, which divided the whole image into multiple regions. The idea of bi-level thresholding can be express to multilevel thresholding techniques also by the following rules:

$$\begin{aligned} \begin{aligned}&R_1 \leftarrow P \;\quad if \; 0\le P< T_1 \\&R_2 \leftarrow P \; \quad if \; T_1 \le P< T_2 \\&R_{n-1} \leftarrow P \; \quad if \; T_{n-1} \le P< T_n \\&R_n \leftarrow P \;\quad if \; T_n \le P < L-1 \end{aligned} \end{aligned}$$
(10)

where \(T_1<T_2<\cdots<T_{n-1}<T_n\) are the threshold value.

Let assume an L number of grey image in the range \(\{0,1,2,\ldots .(L-1)\}\) with \(n+1\) number of objects or regions. \(\{h(1),h(2),\ldots ,h(L-1)\}\) be the grey level frequency of gray level \(\{0,1,2,\ldots .(L-1)\}\), N be the total number of pixel in that image. Where it is required to find n number of threshold values by optimizing one (or more) objective function(s). If an objective function is f(.), the optimal threshold values \(T_1^*,T_2^*,\ldots ,T_n^*\) can be computed as follows:

$$\begin{aligned} (T_1^*,T_2^*,\ldots T_n^*)=argmax(f(T_1,T_2,\ldots ,T_n)) \end{aligned}$$
(11)

The choice of objective functions is one of the important issues in finding out the optimal threshold values. Otsu [37], Kapur’s entropy [38] method are some examples of popular objective functions which are widely used in image segmentation problems discussed in the next subsection.

4.1 Otsu’s method

This is one of the most popular methods, proposed by Otsu’s [37], for both bi-level and multiple thresholding, it is based on finding the optimal thresholding by maximizing the between-class variance of the segmented region which can be defined as the sum of sigma functions of each region by the equation given below:

$$\begin{aligned} f(t)=\sigma _1+\sigma _2 \end{aligned}$$
(12)

where

$$\begin{aligned} \sigma _1=\omega _0(\mu _0-\mu _T)^2 \, and\, \sigma _2=\omega _1(\mu _1-\mu _T)^2 \end{aligned}$$
(13)

where \(\mu _T\) in Eq. 13 represents the mean intensity of the whole image, and for bi-level thresholding. Mean of each class can be defined as

$$\begin{aligned} \mu _0=\sum _{i=0}^{t-1}\frac{ip_i}{\omega _0} \,and\, \mu _1=\sum _{i=t}^{L-1}\frac{ip_i}{\omega _1} \end{aligned}$$
(14)

The optimal threshold can be obtained by maximizing between-class variance.

$$\begin{aligned} (t^*)=argmax(f(t)) \end{aligned}$$
(15)

This method can be express for multilevel thresholding problem by the following function

$$\begin{aligned} f(t)=\sum _{i=0}^{m} \sigma _i \end{aligned}$$
(16)

The sigma function can be express through Eq. 17

$$\begin{aligned}&\sigma _1=\omega _1(\mu _0-\mu _T)^2 \, , \, \sigma _2=\omega _2(\mu _1-\mu _T)^2 \, , \, \nonumber \\&\sigma _j=\omega _j(\mu _j-\mu _T)^2 \, , \, \sigma _m=\omega _m(\mu _m-\mu _T)^2 \end{aligned}$$
(17)

And mean level van be defined as

$$\begin{aligned}&\mu _0=\sum _{i=0}^{t_1-1}\frac{ip_i}{\omega _i} \,,\, \mu _1=\sum _{i=t_1}^{t_2-1}\frac{ip_i}{\omega _i} \,,\, \mu _j=\sum _{i=t_j+1}^{L-1}\frac{ip_i}{\omega _i}\,,\, \nonumber \\&\mu _m=\sum _{i=t_m}^{t_j+1-1}\frac{ip_i}{\omega _i} \end{aligned}$$
(18)

Optimal threshold value can be obtained by maxizing the objective function of the Eq. 19

$$\begin{aligned} (t^*)=argmax\left( \sum \limits _{i=0}^{m}{\sigma _i}\right) \end{aligned}$$
(19)

4.2 Kapur’s entropy method

The most popular and widely used entropy-based method is Kapur’s entropy-based [38] thresholding. It describes the method to maximize the entropy of the segmented histogram in order that each segmented section has a more centralized distribution [38].

Optimal threshold for bi-level thresholding by Kapur’s entropy can be defined as maximizing the following function

$$\begin{aligned} f(t)=H_0+H_1 \end{aligned}$$
(20)

where

$$\begin{aligned} \begin{aligned}&H_0=-\sum _{i=0}^{t-1}\frac{p_i}{\omega _0}ln\frac{p_i}{\omega _0} \,\, \text {and} \,\, \omega _0=\sum _{i=0}^{t-1}{p_i}\\&and \,\,H_1=-\sum _{i=t}^{L-1}\frac{p_i}{\omega _1}ln\frac{p_i}{\omega _1} \,\, \text {and} \,\, \omega _1=\sum _{i=0}^{t-1}{p_i} \end{aligned} \end{aligned}$$

This entropy method can also be express for multilevel thresholding by maximizing the following equation

$$\begin{aligned} f([t_1.t_2,t_3\ldots t_m])=H_0+H_1+H_2+\cdots +H_n \end{aligned}$$
(21)

where \(t_1<t_2<t_3\cdots <t_m\)    and

$$\begin{aligned} \begin{aligned} H_0&=-\sum _{i=0}^{t_1-1}\frac{p_i}{\omega _0}ln\frac{p_i}{\omega _0} \,\, \text {and} \,\, \omega _0=\sum _{i=0}^{t_1-1}{p_i}\\ H_1&=-\sum _{i=t_1}^{t_2-1}\frac{p_i}{\omega _1}ln\frac{p_i}{\omega _1} \,\, \text {and} \,\, \omega _1=\sum _{i=t_1}^{t_2-1}{p_i}\\ H_2&=-\sum _{i=t_j}^{t_{j+1}-1}\frac{p_i}{\omega _2}ln\frac{p_i}{\omega _2} \,\, \text {and} \,\, \omega _2=\sum _{i=t_j}^{t_{j+1}-1}{p_i}\\ H_n&=-\sum _{i=t_n}^{L-1}\frac{p_i}{\omega _n}ln\frac{p_i}{\omega _n} \,\, \text {and} \,\, \omega _m=\sum _{i=t_n}^{L-1}{p_i} \end{aligned} \end{aligned}$$

5 Improved EHO and multilevel image thresholding

The IEHO has been used to find the optimal threshold values for multilevel image thresholding of the images taken from well-known benchmark dataset. The steps for implementing IEHO for multilevel image thresholding are as follows:

  • Step 1 Select the initial population based on the concept of OBL of size n, each of the member of the population is of dimension D

  • Step 2 Divide the total population into a fixed number of clans.A matriarch controls every clan. Since it is a maximization problem, the matriarch gives the highest fitness value. For each clan \(c_i\), calculate the fitness function of the jth elephant by the Kapur’s or Otsu’ s method

  • Step 3 In each generation, the next position of the jth member of each clan \(c_i\) is updated by the Eqs. 1 and 2.

  • Step 4 The worst member of each clan is updated its position by the Eq. 4.

  • Step 5 Implement the OBL based on jumping rate \((J_r)\).

  • Step 6 Implement the DCM to update matriarch

  • Step 7 Select the best elephant as the best threshold value from the group in each iteration.

  • Step 8 Repeat Step-2 to Step-7 until the maximum iteration is reached.

Fig. 2
figure 2

(aj) original images and (a’j’) are the histogram of the images respectively

Table 1 Parameters used for EHO, ABC, CS, BAT and, PSO

6 Experiment

6.1 Experiment and setup

This section describes the computational environment used for simulation and experiment of the proposed algorithm; the results are analysis by defining some well-known quality metrics; the stability and the performance of the proposed algorithm in comparison to the other popular algorithms.

Simulation and experiments are carried out in a PC with 2.30 GHz CPU and 4.00 GB RAM in Windows 8 environment. Tests are performed on more than fifty different images collected from the database of Berkeley Segmentation Dataset, out of which the results of ten images are shown in Fig. 2. The same number of iterations and stopping criteria are used for all algorithms to assess the performance without any bias. The parameters used in simulations are given in Table 1. The performance of the proposed algorithm is compared with five recently developed evolutionary algorithms namely, CS, ABC, BAT and, PSO and one classical method DP. Kapur’s entropy and Otsu’s between-class variance are used as the objective fnction for calculating the threshols value of images for all metaheuristic algorithm, In case of DP Modified Otsu Criterion [2] proposed by the Mohamed H. Merzban, Mahmoud Elbayoumi is considered for calculating the threshold values.

Table 2 Threshold values for ten images in different optimization techniques taking Kapur’s entropy as optimization function
Table 3 The highest objective function values of Kapur’s method for the ten test images
Table 4 The highest objective function values of Otsu’s method for the ten test images
Table 5 Comparison between IEHO, EHO, ABC, CS, BAT and, PSO in terms of PSNR, SSIM and FSIM taking Kapur’s entropy as objective function for ten test images
Table 6 Comparison between IEHO, EHO, ABC, CS, BAT and, PSO in terms of PSNR, SSIM and, FSIM taking Otsu’s between-class variance objective function for ten test images
Table 7 List of mean and standard deviation after 30 runs for each algorithm calculated on ten images taking Kapur’s objective function

6.2 Metrics for quality evaluation

Three widely used quality metrics, e.g., peak signal to noise ratio (PSNR), structural similarity index metric (SSIM) [39] and feature similarity index metric (FSIM) [40] are used to quantify the performance of different algorithms. PSNR measures the pixel-to-pixel intensity similarity between the reference and the processed image is obtained by computing the mean square error (MSE) between the original image and segmented image whereas SSIM and FSIM are used to verify the structure and feature similarity of the segmented images in comparison of original images. The definition of the metrics are given in the subsequent parts of this section.

6.2.1 Peak signal to noise ratio (PSNR)

Peak signal to noise ratio in dB is defined as, PSNR measures in decibel (dB) as

$$\begin{aligned} PSNR=10 Log_{10}\left( \frac{255^2}{MAE}\right) \end{aligned}$$
(22)

where MSE is mean absolute error, formulated as:

$$\begin{aligned} MSE=\frac{\sum \nolimits _i^M \sum \nolimits _{j=1}^N |I(i,j)-S(i,j)|}{M*N} \end{aligned}$$
(23)

where \(I(i,j) \; \text {and}\; S(i,j)\) in Eq. (23) denote the original image and segmented images of \(size(M*N)\) respectively.Higher value of PSNR implies better performance

6.2.2 Structural similarity index metric (SSIM)

SSIM is largely used to measure the structural similarity between original and segmented image. Highest value of SSIM represents the better performance. SSIM is defined as follows:

$$\begin{aligned} SSIM(x,y)=\frac{ (2\mu _x\mu _y+c_1) (\sigma _{xy}+c_2 ) }{ (\mu _x^2 + \mu _y^2+ c_1) (\sigma _x^2 + \sigma _y^2 + c_2 ) } \end{aligned}$$
(24)

where \(\mu _x \;and \; \mu _y\) mean intensity of original image and segmented image \(\sigma _x ,\sigma _y\) are the standard deviation of original and segmented image;\(\sigma _{xy}\) is the covariance of original and segmented image. \(c_1\; and \; c_2\) are two constant, such that \(C_1\)=0.01 and \(C_2\)=0.03.

6.2.3 Feature similarity index metric (FSIM)

FSIM is, largely used to find the feature similarity between original and segmented image for two images \(f_1 (X)\) and \(f_2 (X)\), the FSIM is given by,

$$\begin{aligned} FSIM=\frac{\sum \nolimits _{X_\varepsilon \Omega } S_L(X)PC_m(X)}{\sum \nolimits _{X_\varepsilon \Omega PC_m(X)}} \end{aligned}$$
(25)

where \(\Omega\) means spatial domain of whole image and \(S_L(X)=S_{pc}(X)S_G(X)\)\(S_{pc}(X)S_G(X)\) are given by,

$$\begin{aligned}&S_pc(X)=\frac{2PC_1(X)PC_2(X)+T_1}{PC_1^2(x)+PC_2^2+T_1} \;and \nonumber \\&S_G(X)=\frac{2G_1(X)G_2(X)+T_2}{G_1^2(X)+G_2^(X)+T_2} \end{aligned}$$
(26)

where \(PC_1\) and \(PC_2\) are the phase congruency maps take out from two images \(f_1 (X)\) and \(f_2 (X)\) respectively; \(T_1\) and \(T_2\) are constants and taken as \(T_1=0.85\), \(T_2=160\). Higher value of FSIM indicates better performance.

Table 8 List of mean and standard deviation after 30 runs for each algorithm calculated on ten images taking Otsu’s between-class variance objective function
Table 9 Average executing time in seconds of IEHO, EHO, ABC, CS, BAT, and, PSO

6.3 Simulation results

We have simulated five other popular meta-heuristic algorithms along with the proposed one to compare them with the proposed algorithm. The performance is compared in view of solution quality, the stability of the algorithms, convergence speed, and execution time.

6.3.1 Solution quality

The optimized thresholds value of Kapur’s entropy for 5-level, 6-level and 7-levels of all the images are listed in Table 2 and the objective function values of Kapur’s entropy and Otsu’s between class variance are presented in Tables 3 and 4. In Table 3 we have also compute the individual performace of the OBL and DC with EHO, and shown as OEHO and DCEHO column in the Table 3. These results confirm that the proposed IEHO algorithm gives better objective functions values with respect the other methods. As the individual performance of the OBL and DC with EHO is not better,we did not consider this two technique in others tables. It is also observed that the performance the proposed algorithm is gradually improving with the increase of the number of threshold levels. This means that the IEHO can cover larger domain of the problems with respect to the other algorithms.

Segmented images obtained after 5-level, 6-level and 7-levels segmentation of lake, peppers and women are shown in Figs. 3, 4 and 5. The quality of the segmented images is then evaluated by calculating PSNR, SSIM, and FSIM. The measured values of PSNR, SSIM, and FSIM by the Kapur’s entropy and Otsu’s between class variance objective function are shown in Tables 5 and 6 respectively. We see from the table that, IEHO shows better performance in terms of PSNR, SSIM, and FSIM value than the conventional EHO and the other algorithms.

Fig. 3
figure 3

Images of af are the 5-level thresholded lake images using IEHO, EHO, ABC, CS, BAT, and, PSO taking Kapur’s entropy as objective function.(a’f’) represents the histogram with the threshold values of lake images respectively

Fig. 4
figure 4

Images of af are the 6-level thresholded pepper images using IEHO, EHO, ABC, CS, BAT and, PSO taking Kapur’s entropy as objective function.(a’f’) represents the histogram with the threshold values of pepper images respectively

Fig. 5
figure 5

Images of af are the 7-level thresholded women images using IEHO, EHO, ABC, CS, BAT, and, PSO taking Otsu’s between-class variance objective function.a’f’ represents the histogram with the threshold values of women images respectively

Fig. 6
figure 6

a 6-level convergence graph of lena image by kapur’s objective function. b 6-level convergence graph of lena image by Otsu’s objective function. c 7-level convergence graph of fishing image by kapur’s objective function. d 7-level convergence graph of fishing image by Otsu’s objective function

6.3.2 Steadiness of the algorithm

Since the optimization problems are random in nature and the initial population is produced through a random search, the value of the optimized objective function may slightly vary in each execution. Hence, the performance of the algorithms must be verified by computing mean and standard deviation of the values of optimized objective functions through several executions of the algorithm. A higher mean value indicates the better accuracy and a lesser value of the standard deviation suggests higher stability of the algorithm. Incorporation of DCM into the standard EHO has elevated the possibility of producing the same result in each run. It increases the mean value, whereas it decreases the value of standard deviation of the results compared the conventional EHO. Tables 7 and 8 display the values of mean and standard deviation for two optimized objective functions by executing each algorithm 30 times (i.e.30 runs).For example, in case of airplane image with 7-level,the mean of objective function values are 25.4804, 25.4739, 25.433, 25.3866, and 25.4413 and standard deviations are 0.0007474, 0.0087591, 0.0460967, 0.0587565, and 0.010462 respectively. Hence, the proposed IEHO algorithm performs better with respect to the others in segmentation with higher number of threshold levels.

6.3.3 Convergence and computational Time

The convergence graph for different algorithms using two objective functions are shown in Fig. 6 for lena and fishing images. From this figure we find that the convergence rate of conventional EHO has dramatically increased after incorporating the OBL and DC into the conventional EHO. The improved EHO has been converged within 20 to 30 iterations whereas average convergence rate of standard EHO together with other algorithms is above 50 iterations.

The average execution time is measured to compare the computational complexity of the different algorithms used for multilevel thresholding. The average execution time of IEHO, EHO, ABC, CS, BAT and, PSO are shown in Table 9. Each of the algorithms is executed 30 times to calculate the average execution time. It is evident from the table that IEHO base segmentation is faster than other.

7 Conclusions

This paper proposes an OBL based improved elephant herding algorithm incorporating dynamic Cauchy mutation to enrich the performance of the standard EHO. OBL is employed to accelerate the conventional EHO, and DCM is incorporated to reduce the possibility of being confined in local optima. The proposed IEHO is applied to multilevel thresholding for image segmentation. The images under test are taken from standard Berkeley Segmentation Dataset. The performance of IEHO is compared with some recently proposed evolutionary and classical optimization algorithms. From the experimental results, we notice that the proposed IEHO outperforms the conventional EHO, ABC, CS, PSO and DP both in terms of quality at higher level thresholding and convergence rate. This suggests that we can use the proposed algorithm effectively for multilevel thresholding in image segmentation for different applications.