1 Introduction

Color image segmentation is the process of splitting a digital image into distinct non-overlapping homogenous regions according to the similarity in some image features such as color, pattern, intensity value, regional statistics. Segmentation methods are involved as a preprocessing step in various computer vision systems and pattern recognition applications such as edge detection, medical imaging, object detection, video surveillance, classification, industrial production, traffic control system and agriculture fields [1, 5, 12, 15, 22]. Based on the general principle of image segmentation, the taxonomy of different segmentation algorithms can be built which distinguishes the following categories: thresholding methods, edge-based techniques, and region-based techniques. Image segmentation using multilevel thresholding (MT) is one of the leading methods, and thresholding methods play a vital role to accomplish image segmentation. However, most of the techniques are based on the image histogram due to its simplicity, effectiveness, easy to implement, and rapidness. Generally, the thresholding approaches are categorized as bi-level and multilevel thresholding. The easiest one is bi-level thresholding, but for daily-life color images and remote sensing images [9], it does not give optimum results. Among all the remarkable thresholding methods, thresholding based on information entropy theory is a fascinating subject. Entropy-based image segmentation methodology has enticed the devotion of numerous researchers [2, 6, 13, 32, 35] and is considered as one of the prominent global thresholding methods.

Sezgin et al. [42] presented an analysis of image thresholding algorithms and reported that due to the advancements in the information theory, entropy-based thresholding methods have an excessive influence on image segmentation. Pun et al. [34] introduced the concept of entropy-based thresholding for the image segmentation. Afterward, Otsu et al. [3] proposed a method that uses the optimum threshold values by using maximum values of the inter-class variance of gray levels. Kittler and Illingworth have presented a method that optimizes Bayes risk factor to perform thresholding-based segmentation [21]. Kapur et al. [10] proposed a technique that uses the concept of entropy maximization to determine the homogeneousness between classes. A moment preservation principal-based image segmentation approach was developed by Tsai [44] in 1985. In 2015, Bhandari et al. [11] utilized Tsallis entropy, which reports that the information in the image can be treated as either additive or nonadditive. A maximum entropy method has been proposed on the basis of non-extensive Tsallis entropy [11] whose entropic parameter q enables the Tsallis entropy to handle the nonadditive information. However, this technique is analogous to maximum entropy method developed by Kapur et al. [10].

In 2006, Sahoo et al. [39] proposed a two-dimensional Tsallis–Havrda–Charvat entropy-based thresholding selection technique. Furthermore, Sahoo [40] has proposed a method for thresholding based on Renyi entropy and this entropy can handle the additive property using the tunable entropic parameter α [20, 37]. The value of α and q can be varied to maximize the Renyi’s and Tsallis entropies, respectively. The thresholding approaches have used optimum threshold values by using maximum values of the inter-class variance of gray levels, and based on moment preserving principle [11], cross entropy [23], fuzzy approach [26], and Renyi entropy [39] have also been successfully used in the segmentation of images. Masi et al. [27] have introduced a new entropic measure, which is based on the analysis of thermodynamic entropies that utilizes the complete probability distribution for image segmentation. Masi entropy has an entropic parameter r, when the value of r is taken to be 1, the Masi entropy [27, 29] reduces to the Shannon entropy [36] which is also known as Boltzmann–Gibbs entropy.

The entropy-based thresholding can be designed as a non-convex multifaceted optimization problem. If the multiple thresholds are treated as the spatial dimensions of the metaheuristics, their parallelism can efficiently address the issue of computational cost of segmented color images by using multilevel color image thresholding-based segmentation. The fitness function of the metaheuristics technique is a standard for choosing the optimum solution. In recent years, entropy is used as a fitness function for the optimization techniques which has drawn the attention of numerous researchers.

In this contexture, several optimization algorithm-based thresholding methods have been developed which use varieties of evolutionary techniques such as artificial bee colony (ABC) motivated from the searching behavior of swarm of honey bees [7, 10], differential evolution [43], genetic algorithm (GA) which is motivated from the notion of survival of the fittest given by Darwin [38], PSO inspired by the public behavior of fish schooling or bird flocking [13, 14], FA which is based on flashing phenomenon of fireflies of tropical areas during summer season [19], WDO other optimization methodology which is grounded on the atmospheric behavior of earth [4, 6], electromagnetism optimization (EMO) which has been inspired by the attraction–repulsion mechanism of the electromagnetism theory [30]. In the recent years, a modified PSO [25]-based multilevel thresholding is applied for the segmentation of medical image segmentation. Recently, a new color image segmentation method has been proposed using entropy thresholding and bat algorithm [28]. The bat algorithm is based on the echolocation of the bats.

In 2017, a new color image multilevel thresholding has been proposed by exploiting backtracking search algorithm (BSA) for satellite images [17]. In favor of color image multilevel thresholding, another new approach has been given [33] through the modification of fuzzy entropy, and further the proposed modified entropic parameters are optimized by Levy flight firefly algorithm to get more accurate results for satellite image segmentation. On the other hand, a new gray-level co-occurrence matrix has been introduced, first time as an objective function to get accurate multilevel thresholding for multiband remote sensing images as well as natural color images [31]. Cuckoo search (CS) [6, 8] and differential evolution (DE) [16] have been reported to solve many multilevel color image segmentation problems for the estimation of optimal threshold values.

Motivated by the successful results in the aforementioned literature, this paper applies different multilevel thresholding approaches for challenging real-life image segmentation problem by using water cycle algorithm (WCA) [18], grasshopper optimization technique (GOA) [41], monarch butterfly optimization (MBO) [46], bat algorithm (BAT) [47], particle swarm optimization (PSO) [24], and wind-driven optimization (WDO) and examines their feasibility for color image thresholding. The WCA, GOA, and MBO are the latest and unexploited optimization techniques for the color image segmentation; these optimization algorithms are inspired by nature. This paper has been exploited by two objective functions such as Tsallis and Masi entropy criterion for color image segmentation.

Rest of the paper is organized as follows: In Sect. 2, related works are presented through the formulation of Tsallis entropy and different optimization algorithms such as BAT, PSO, WDO, MBO, and GOA. Section 3 presents a detail description of the proposed Masi-WCA-based segmentation approach. Section 4 reports the visual and quantitative results of the proposed technique which are supported by ME, MSE, PSNR, SSIM, FSIM, and entropy. Finally, Sect. 5 concludes the paper by highlighting the main contribution and future scope of the proposed work.

2 Related Works

2.1 Thresholding Criterion for Multilevel Thresholding

Let I denote a test image with an extreme of L gray levels {0, 1…L − 1} and dimension of the image be M × N. Let G ={0, 1…L − 1} designates the set of intensity values of the image. The count of pixels with gray level i is denoted by ni, and the dimension of the image represents a total number of pixels. The pixels of a grayscale or colored image are classified into regions or sets on account of their intensity level (L). This system of arranging the pixels defines the thresholding. For the selection of fitting neighborhoods in a test image, the optimum threshold value (th) should be obtained in a routine, which obeys the simple law of following equations:

$$ \begin{array}{*{20}l} {C_{0} \leftarrow i} \hfill & \quad {{\text{if}}\;0 \le i \le {\text{th}}} \hfill \\ {C_{1} \leftarrow i} \hfill & \quad {{\text{if}}\;{\text{th}} + 1 \le i \le L - 1} \hfill \\ \end{array} $$
(1)

where i represents the intensity values of the grayscale image with L, which brings the maximum intensity level. C represents the class of the image.

$$ \begin{array}{*{20}l} {C_{0} \leftarrow i} \hfill & \quad {{\text{if}}\; \, 0 \le i < {\text{th}}_{1} } \hfill \\ {C_{1} \leftarrow i} \hfill & \quad {{\text{if}}\;{\text{th}}_{1} + 1 \le i < {\text{th}}_{2} } \hfill \\ {C_{2} \leftarrow i} \hfill & \quad {{\text{if}}\;{\text{th}}_{2} + 1 \le i < {\text{th}}_{3} } \hfill \\ {C_{n} \leftarrow i} \hfill & \quad {{\text{if}}\;{\text{th}}_{n} + 1 \le i < L - 1} \hfill \\ \end{array} $$
(2)

where {th1, th2, th3,…, thn} represents multiple thresholds.

Segmentation of pixels in their respective classes is done using Eqs. (1) and (2) for bi-level and multilevel thresholding, respectively. In the image, the probability of gray level i is estimated by the number of pixels representing the intensity level (frequency of gray level i) occurred in the image, given by Eq. (3):

$$ h_{i} = \frac{{n_{i} }}{M \times N}\quad {\text{where}},\quad h_{i} \ge \, 0\;{\text{and}}\;\mathop \sum \limits_{0}^{L - 1} h_{i} = 1. $$
(3)

The complete probabilistic distribution H of gray levels can be formulated as H ={ h0, h1, h2…hL−1}. The pixels in the image are separated into two classes (which is bi-level segmentation) as C0 and C1 given by Eq. (1), and the pixels in the image are divided into more than two classes (which is multilevel segmentation) as C0, C1,…, Cn is given by Eq. (2), Each of the C0, C1, C2, and Cn corresponds to the different object class and background class. Now, the probability of the classes defined for bi-level can be extended for multilevel thresholding, which is formulated by following the equations:

For bi-level thresholding,

$$ w_{0} = \sum\limits_{i = 0}^{\text{th}} {h_{i} } , \, w_{1} = \sum\limits_{{i = {\text{th}} + 1}}^{L - 1} {h_{i} } . $$
(4)

For multilevel thresholding,

$$ w_{0} = \sum\limits_{i = 0}^{{{\text{th}}_{1} }} {h_{i} } , \, w_{1} = \sum\limits_{{i = {\text{th}}_{1} + 1}}^{{{\text{th}}_{2} }} {h_{i} } , \, w_{2} = \sum\limits_{{i = {\text{th}}_{2} + 1}}^{{{\text{th}}_{3} }} {h_{i} } , \ldots , \, w_{n} = \sum\limits_{{i = {\text{th}}_{n} }}^{L - 1} {h_{i} } . $$
(5)

The above-defined probability distributions are further normalized. Consequently, a vector of optimal thresholds \( \{ T_{1}^{*} ,T_{2}^{*} , \ldots ,T_{n}^{*} \} \) is determined using:

$$\begin{aligned} & \{ T_{1}^{*} ,T_{2}^{*} , \ldots ,T_{n}^{*} \} = {\text{arg max}}\{ fit(T_{1} ,T_{2} , \ldots ,T{}_{n}){\text{\} }}\nonumber\\ &{\text{Subject}}\;{\text{to}}\;0 \le T_{0} < T_{1} < \cdots < T_{n} \le L - 1 .\\ \end{aligned} $$
(6)

where fit (T1, T2,…,Tn) represents the optimization criterion or objective function, which determines the optimum thresholds for performing multilevel thresholding. Two objective functions used in this paper to compute the optimum threshold values have been discussed in this section.

2.2 Tsallis Thresholding Method

Albuquerque et al. proposed a concept based on Tsallis entropy [11, 39]. The function of thresholding is represented by Eqs. (7) and (8), and the concept of Tsallis entropy has been proposed by Constantino Tsallis. Discrete probabilities make up the notion of Tsallis entropy where the sum of all discrete probabilities is 1. Tsallis entropy is capable of handling nonadditive or non-extensive information [2]. This degree of nonadditivity is represented by the variable q which behaves as an entropic parameter. When the value of q is taken to be 1, the Tsallis entropy reduces to the Shannon entropy which implies that the Tsallis entropy is derived from Shannon entropy. In this paper, the value of q is considered as 0.8 to maximize the Tsallis entropy.

$$ E_{q} \left( {I/{\text{th}}} \right) \, = \, E_{q} \left( {C_{0} /{\text{th}}} \right) \, + \, E_{q} \left( {C_{1} /{\text{th}}} \right) \, + \, \left( {1 - q} \right) \, E_{q} \left( {C_{0} /{\text{th}}} \right) \, E_{q} \left( {C_{1} /{\text{th}}} \right) $$
(7)

where

$$ \begin{aligned} E_{q} \left( {C_{0} /{\text{th}}} \right) & = \frac{1}{1 - q}\left[ {\sum\limits_{i = 0}^{\text{th}} {\left( {\frac{{h_{i} }}{{w_{o} }}} \right)^{q} - 1} } \right] \\ E_{q} \left( {C_{1} /{\text{th}}} \right) & = \frac{1}{1 - q}\left[ {\sum\limits_{{i = {\text{th}} + 1}}^{L - 1} {\left( {\frac{{h_{i} }}{{w_{1} }}} \right)^{q} - 1} } \right] \\ \end{aligned} $$
(8)

The maximized Tsallis entropy can be achieved by using Eq. (9) which can be presented as

$$ E_{T} \, = \, E_{{T_{0} }} + E_{{T_{1} }} + E_{{T_{2} }} + \cdots + E_{{T_{n} }} + \left( {1 - q} \right) \, E_{{T_{n} }} E_{{T_{1} }} E_{{T_{3} }} \ldots E_{{T_{n} }} $$
(9)

where

$$ \begin{aligned} E_{{T_{0} }} & = \frac{1}{1 - q}\left[ {\sum\limits_{i = 0}^{{{\text{th}}_{1} }} {\left( {\frac{{h_{i} }}{{w_{0} }}} \right)^{q} - 1} } \right], \, \quad w_{0} = \sum\limits_{i = 0}^{{{\text{th}}_{1} }} {h_{i} } \\ E_{{T_{1} }} & = \frac{1}{1 - q}\left[ {\sum\limits_{{i = {\text{th}}_{1} + 1}}^{{{\text{th}}_{2} }} {\left( {\frac{{h_{i} }}{{w_{1} }}} \right)^{q} - 1} } \right],\quad \, w_{1} = \sum\limits_{{i = {\text{th}}_{1} + 1}}^{{{\text{th}}_{2} }} {h_{i} } \\ E_{{T_{2} }} & = \frac{1}{1 - q}\left[ {\sum\limits_{{i = {\text{th}}_{2} + 1}}^{{{\text{th}}_{3} }} {\left( {\frac{{h_{i} }}{{w_{2} }}} \right)^{q} - 1} } \right], \, \quad w_{2} = \sum\limits_{{i = {\text{th}}_{2} + 1}}^{{{\text{th}}_{3} }} {h_{i} } \\ E_{{T_{n} }} & = \frac{1}{1 - q}\left[ {\sum\limits_{{i = {\text{th}}_{n} + 1}}^{L - 1} {\left( {\frac{{h_{i} }}{{w_{n} }}} \right)^{q} - 1} } \right], \, \quad w_{n} = \sum\limits_{{i = {\text{th}}_{n} + 1}}^{L - 1} {h_{i} } \\ \end{aligned} $$
(10)

where \( E_{{T_{i} }} \) represents the Tsallis entropy of ith class and the optimal multilevel segmentation problem is solved by assuming n-dimensional problem of optimization. The values of Eq. (10) give the Tsallis entropy of each region (or class), and these values are used in Eq. (9) to get the maximum entropic value. Now, to solve multilevel thresholding problem, n-dimensional optimal thresholds are obtained by Eq. (11), which is used for the maximization of objective function:

$$ (T*) = \arg \, \hbox{max} \left( {\sum\limits_{i = 0}^{n} {E_{{T_{i} }} } } \right) $$
(11)

2.3 Bat Algorithm

Xin-She Yang proposed the bat algorithm which is used as a metaheuristic approach for optimization at a global scale. This optimization method is stimulated from the echolocation of micro-bats. The bats use the notion of SONAR echoes to detect their prey and avoid obstacles. The bats transmit the sound waves in the presence of an object; these waves are reflected back. The time period between the reflection and transmission of the wave impacts the movement of the bats. After the reception of reflected wave, bats use their own pulse to determine the space between them and the prey. The pulse rate ranges from 0 till 1, where 1 represents emission at maximum level and 0 indicates no emission. The loudness of the sound wave and the distance of bat from prey are proportional to each other. In other words, the loudness and pulse rate are inversely proportional to one another [47].

2.4 Particle Swarm Optimization

Particle swarm optimization (PSO) improves the candidate solutions iteratively to get the optimized solution for a problem. It has a population of dubbed particles (or candidate solutions) where these particles are moved in and around in the search space in accordance with few simple formulae which includes the position of the particle and particle’s velocity. The movement of each particle is judged by its best-known localized position which is updated when other particles find better positions. This gives high expectation that the swarm is moving toward the optimum solutions. In PSO, search space (possible set of solutions) and possible solution are called as particle position and swarm, respectively. The position representing the best fitness is given as ‘Pbest,’ and ‘Gbest’ defines the best solution of all the particles [24].

2.5 Wind-Driven Optimization

WDO is motivated from the atmosphere of earth, where blowing wind attempts to balance the horizontal air pressure. It is a nature-inspired global optimization method that is created on the ideology of atmospheric motion [4]. It has been shown that wind-driven optimization can be executed easily and is effective in solving the optimization problems. In general terms, WDO has an ability to put in effect the constraints in the search domain. This method is operational on the population-based recursive heuristic global optimization algorithm for multimodal along with multidimensional challenges.

2.6 Monarch Butterfly Optimization

Monarch butterfly optimization (MBO) is a new type of metaheuristic algorithm and inspired from nature; all these butterflies individually are placed in two distinct lands (areas). In the paper [46], the locations of the monarch butterflies are modernized in two techniques. Initially, the offsprings are produced or position-modernized by migration operator and it is adjusted by the migration ratio. This migration behavior of monarch butterflies addresses numerous optimization problems, and it is monitored by some rules. Subsequently, the location of the butterflies is changed by the worth of butterfly adjusting operation [46].

2.7 Grasshopper Optimization Algorithm

Saremi proposed grasshopper optimization algorithm in 2016 which imitates the swarming behavior of grasshoppers. Three components affect the flying route of grasshopper in a swarm. They are a social relationship, gravity, and the horizontal movement of wind. In the GOA algorithm, the most important searching mechanism is a social relationship and the swarming behavior changes significantly when the parameters are changed. The authors have proposed the mathematical model search for grasshopper’s interaction and move the swarm closer to the target. In the GOA algorithm, it is estimated that the target is the best solution. While the grasshoppers interact and chase the target, the best solution gets updated if a better solution is found [41].

3 The Proposed Method

In this section, the proposed Masi-WCA approach is demonstrated. Alfred Renyi proposed a definition for the measure of information that preserves expansively for independent events which later termed as Renyi entropy. This entropy quantifies the randomness, uncertainty, or diversity of a system. Renyi entropy is used as a diversity index in statistics and ecology and also essential in quantum information where it is used to measure entanglement [20, 40]. The entropic parameter α defines the amount of extensive information that is present in the image. In a system, the value of α determines which events contribute in the calculation of Renyi entropy. For example, if the value of α tends to 0, almost all the events are weighted equally by Renyi entropy and if a value of α tends to infinity, Renyi entropy is evaluated using the events that have the highest probability. Similarly, in the case of image processing, the events represent the classes of the image whose probabilities are used to determine Renyi entropy. When the value of α is closer to zero, regardless of the probability of each class, Renyi entropy weighs all possible events more equally and when α is one, Renyi entropy reduces to Shannon entropy. This entropy yields maximum result when the value of α is taken to be 0.8.

The property of Tsallis entropy is examined when considering two systems with different temperatures to be in contact with each other and to reach the thermal equilibrium. It is verified that the total Tsallis entropy of the two systems cannot decrease after the contact of the systems. It leads to a generalization of the principle of entropy increase in the framework of non-extensive statistical mechanics. Therefore, a maximum entropy method was proposed based on non-extensive Tsallis entropy [11]. Tsallis entropy is the generalization of Shannon entropy. The pseudo-additivity property of Tsallis entropy with entropic parameter q can handle the non-extensive information for statistically independent subsystems. Sahoo et al. [40] has proposed a method for thresholding based on Renyi entropy. Renyi entropy can handle the additive property using the tunable entropic parameter α [20, 40]. However, Renyi’s and Tsallis entropies cannot handle the additive and nonadditive information simultaneously. In the subsequent part, the illustration of the proposed scheme’s concept is done using flowchart in Fig. 1. A complete explanation of each step is presented thereafter.

Fig. 1
figure 1

Flowchart of the Masi-WCA approach for the multilevel (thresholding) segmentation

3.1 Masi’s Thresholding Method

Masi entropy combines the additivity of Renyi entropy and the non-extensivity of Tsallis entropy. The main argument which deviates Renyi and Tsallis entropies from the Masi entropy is the concordant parameter r. Unlike probability functions of Renyi entropy and Tsallis entropy, where each state probability is raised to the power of their entropic parameters α and q, respectively, in case of Masi, the entire probability function is raised to the power r [27, 29, 36]. The parameter r represents the measure of the degree of extensivity/non-extensivity that might be existent in the system. The entropy-based thresholding methodology is developed on the entropic measure, which is further presented by Masi [27] for gray-level images [29]. Successively, all the entropies directly or indirectly are the generalization of well-established Shannon entropy. The entropic parameter gives the flexibility to achieve different results as the demand entertains. According to the concept of Masi entropy, to obtain an optimal threshold value th, for the bi-level thresholding-based image segmentation is expressed by Eqs. (12) and (13):

$$ E_{r} \left( {I/{\text{th}}} \right) \, = \, E_{r} \left( {C_{0} /{\text{th}}} \right) \, + \, E_{r} \left( {C_{1} /{\text{th}}} \right) $$
(12)

where

$$ \begin{aligned} E_{r} \left( {C_{0} /{\text{th}}} \right) &= \frac{1}{1 - r}\log \left[ {1 - (1 - r)\sum\limits_{i = 0}^{\text{th}} {\left( {\frac{{h_{i} }}{{w_{0} }}} \right)\log \left( {\frac{{h_{i} }}{{w_{0} }}} \right)} } \right],\\ E_{r} \left( {C_{1} /{\text{th}}} \right) &= \frac{1}{1 - r}\log \left[ {1 - (1 - r)\sum\limits_{{i = {\text{th}} + 1}}^{L - 1} {\left( {\frac{{h_{i} }}{{w_{1} }}} \right)\log \left( {\frac{{h_{i} }}{{w_{1} }}} \right)} } \right]\end{aligned} $$
(13)

The entropy between the two classes C0 and C1 is maximized, and the gray level at which this holds true is treated to be the optimal threshold. The complete procedure of the optimal multilevel color image thresholding task is addressed. Basically, entropy is defined as a measurement of randomness, which follows the concept that homogeneous regions will have minimal unpredictability and the non-homogeneous regions will have maximum unpredictability. The higher the value of entropy, the better is the separation between objects and background. The information which exists in pixels of an image has either the additive property or the nonadditive property. In this paper, the value of r is considered as 1.18 to maximize the Masi entropy.

The Masi entropy algorithm is selected for several thresholds that are multilevel thresholding (MT) by maximizing the Masi entropy, and the maximized Masi entropy can be achieved by using Eq. (14) which can be presented as

$$ E_{rT} \, = \, E_{{rT_{0} }} + E_{{rT_{1} }} + E_{{rT_{2} }} + \cdots + E_{{rT_{n} }} , $$
(14)

where

$$ \begin{aligned} E_{{rT_{0} }} & = \frac{1}{1 - r}\log \left[ {1 - (1 - r)\sum\limits_{i = 0}^{{{\text{th}}_{1} }} {\left( {\frac{{h_{i} }}{{w_{0} }}} \right)\log \left( {\frac{{h_{i} }}{{w_{0} }}} \right)} } \right], \, w_{0} = \sum\limits_{i = 0}^{{{\text{th}}_{1} }} {h_{i} } \\ E_{{rT_{1} }} & = \frac{1}{1 - r}\log \left[ {1 - (1 - r)\sum\limits_{{i = {\text{th}}_{1} + 1}}^{{{\text{th}}_{2} }} {\left( {\frac{{h_{i} }}{{w_{1} }}} \right)\log \left( {\frac{{h_{i} }}{{w_{1} }}} \right)} } \right], \, w_{1} = \sum\limits_{{i = {\text{th}}_{1} + 1}}^{{{\text{th}}_{2} }} {h_{i} } \\ E_{{rT_{2} }} & = \frac{1}{1 - r}\log \left[ {1 - (1 - r)\sum\limits_{{i = {\text{th}}_{2} + 1}}^{{{\text{th}}_{3} }} {\left( {\frac{{h_{i} }}{{w_{2} }}} \right)\log \left( {\frac{{h_{i} }}{{w_{2} }}} \right)} } \right], \, w_{2} = \sum\limits_{{i = {\text{th}}_{2} + 1}}^{{{\text{th}}_{3} }} {h_{i} } \\ E_{{rT_{n} }} & = \frac{1}{1 - r}\log \left[ {1 - (1 - r)\sum\limits_{{i = {\text{th}}_{n} + 1}}^{L - 1} {\left( {\frac{{h_{i} }}{{w_{n} }}} \right)\log \left( {\frac{{h_{i} }}{{w_{n} }}} \right)} } \right], \, w_{n} = \sum\limits_{{i = {\text{th}}_{n} + 1}}^{L - 1} {h_{i} } \\ \end{aligned} $$
(15)

where \( E_{{rT_{i} }} \) represents the Tsallis entropy of ith class and the optimal multilevel segmentation problem is solved by assuming n-dimensional problem of optimization. The values of Eq. (15) give the Masi entropy of each region (or class), and these values are used in Eq. (14) to get the maximum entropic value. Now, to solve multilevel thresholding problem, n-dimensional optimal thresholds are obtained by Eq. (16), which is used for the maximization of objective function:

$$ (T*) = \arg \, \hbox{max} \left( {\sum\limits_{i = 0}^{n} {E_{{rT_{i} }} } } \right). $$
(16)

3.2 Water Cycle Algorithm

Water cycle algorithm (WCA) [18] is a recently proposed metaheuristic technique for optimizing constrained functions and is used for engineering problems. The key objective of WCA is to introduce a new global optimization approach for finding the constrained optimization complications. Hence, a new population-based algorithm is proposed named as the water cycle algorithm (WCA) method and the idea behind the WCA is grounded on a thought of water cycle and how streams and rivers flow downward toward the sea in the real world. WCA is motivated by nature, and it includes four important sub-parts, e.g., create the initial population, a stream flow to the rivers or sea, evaporation condition, and raining process.

3.2.1 Create the Initial Population

For solving an optimization problem via population-based metaheuristic techniques, the values of problem variables are designed as an array. This array is known as ‘Raindrop’ for a single solution. For a Mvar dimensional optimization problem, the values are represented as an array for a raindrop of 1 × Mvar. This array is expressed in Eq. (17).

$$ {\text{Raindrop}} = [y_{1} ,y_{2} ,y_{3} , \ldots ,y_{M} ]. $$
(17)

For the optimization approach, a matrix of raindrops of size Mpop × Mvar is created that is represented as the population of raindrops. Therefore, the matrix Y  is produced randomly, where rows and column are given as the population size (Mpop) and the design variable size (Mvar), respectively.

$$ {\text{Population}}\;{\text{of}}\;{\text{raindrops}} = \left[ {\begin{array}{*{20}c} {{\text{raindrop}}_{1} } \\ {{\text{raindrop}}_{2} } \\ \vdots \\ {{\text{raindrop}}_{{M_{\text{pop}} }} } \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} {y_{1}^{1} } & {y_{2}^{1} } & \ldots & {y_{{M_{\text{var}} }}^{1} } \\ {y_{1}^{2} } & {y_{2}^{2} } & \ldots & {y_{{M_{\text{var}} }}^{2} } \\ \vdots & \vdots & \vdots & \vdots \\ {y_{1}^{{M_{\text{pop}} }} } & {y_{2}^{{M_{\text{pop}} }} } & \ldots & {y_{{M_{\text{var}} }}^{{M_{\text{pop}} }} } \\ \end{array} } \right]. $$
(18)

The values of each decision variable \( (y_{1} ,y_{2} , \ldots ,y_{{M_{\text{var}} }} ) \) are signified as floating point number, that is, real values or a predefined set for discrete and continuous problems, respectively. A raindrop cost is achieved by the calculation of cost function (C) expressed in Eq. (19).

$$ C_{j} = {\text{Cost}}_{j} = f\left( {x_{1}^{j} ,x_{2}^{j} ,\ldots ,x_{{N_{\text{var}} }}^{j} } \right)\;\;\;{\kern 1pt} j = 1 ,2 ,3 ,\ldots , {\text{M}}_{\text{pop}} . $$
(19)

The best individuals are chosen from rivers and sea that gives a number of Msr, and the raindrops contained minimum value among others that is considered as a sea, where Msr is the summation of user parameter, that is, the number of rivers and a single sea. The remaining population, that is, raindrops from the streams which flow to the rivers or may directly flow to the sea, is obtained and represented in Eq. (21).

$$ M_{\text{sr}} = {\text{Number of Rivers}} + \underbrace {1}_{\text{Sea}} $$
(20)
$$ M_{\text{Raindrops}} = M_{\text{pop}} - M_{\text{sr}} . $$
(21)

The assigned raindrops to the sea and rivers depend on the flow intensity and are expressed in Eq. (22).

$$ {\text{NS}}_{n} = {\text{round}}\;\left\{ {\left| {\frac{{{\text{Cost}}_{m} }}{{\mathop \sum \nolimits_{j = 1}^{{M_{\text{sr}} }} {\text{Cost}}_{j} }}} \right| \times M_{\text{Raindrops}} } \right\} ,\;\;\;{\kern 1pt} m = 1 ,2 ,\ldots , {\text{M}}_{\text{sr}} , $$
(22)

where NSn represents the number of streams which flow to the specific rivers or sea.

3.2.2 A Stream Flow to the Rivers or Sea

The streams are formed by the raindrops, and these streams are connected to each other to form new rivers. Some of the streams may also flow directly to the sea, and all streams and rivers finish in a sea that gives best optimal solution (point). The connecting line of a stream flows to river and uses randomly chosen distance, which is defined as follows in Eq. (23).

$$ Y \in (0 ,C \times d) ,\;\;\;{\kern 1pt} C > 1, $$
(23)

where d is represented as the current distance between stream and river. The value of Y in Eq. (23) corresponds to a distributed random number between 0 and (C × d). A value of C is between 1 and 2; for the best solution, it should be 2 or near to 2. The C value greater than 1 enables streams to flow in altered directions toward the rivers. Hence, the new position for rivers and streams is defined as:

$$ Y_{\text{Stream}}^{j + 1} = Y_{\text{Stream}}^{j} + {\text{rand}} \times C \times \left( {Y_{\text{River}}^{j} - Y_{\text{Stream}}^{j} } \right) $$
(24)
$$ Y_{\text{River}}^{j + 1} = Y_{\text{River}}^{j} + {\text{rand}} \times C \times \left( {Y_{\text{Sea}}^{j} - Y_{\text{River}}^{j} } \right), $$
(25)

where the value of the function rand is a generated random number between 0 and 1 that is uniformly distributed. The solution of the stream is better than its connecting river, the locations of stream and river are swapped, and this criterion is also applied for rivers and sea.

3.2.3 Evaporation Condition

The most important factor of the WCA is evaporation that prevents the method from rapid convergence or the immature convergence. The evaporated (vaporized) water is carried into the atmosphere to produce clouds and then condenses in the colder atmosphere, liberating the water back to earth in the form of rain. This rain generates the new streams and follows the conditions which have been mentioned above. The complete process or cycle is called water cycle. The pseudocode gives an idea about how to define whether or not river flows to the sea.

$$ \begin{aligned} & {\text{if}}\;\left| {Y_{{{\text{Sea}}}}^{j} - Y_{{{\text{River}}}}^{j} } \right| < d_{{\max }} \;\; \\ & \quad \;j = 1{\text{,}}2{\text{,}}3{\text{,}} \ldots {\text{,M}}_{{{\text{sr}}}} - 1{\text{ }} \\ & \quad \quad \quad {\text{Evaporation}}\;{\text{and}}\;{\text{raining}}\;{\text{process}} \\ & {\text{end}} \\ \end{aligned} $$

where the value of dmax is close to zero (small number). The distance between sea and a river is less than dmax. This condition specifies that the river has linked the sea, and the evaporation and raining process are applied. Otherwise, it reduces the search and a small value inspires the search intensity near the sea. The value of dmax adaptively decreases as:

$$ d_{\hbox{max} }^{j + 1} = d_{\hbox{max} }^{j} - \frac{{d_{\hbox{max} }^{j} }}{{{ \hbox{max} }\;{\text{iteration}}}}. $$
(26)

3.2.4 Raining Process

In this part, the new raindrops formed streams in the different positions or location. The new positions of the recently formed streams can be found exactly and clearly with the help of the following equation.

$$ Y_{\text{Stream}}^{\text{new}} = {\text{LB}} + {\text{rand}} \times ({\text{UB}} - {\text{LB}}), $$
(27)

where LB and UB are represented as lower and upper bounds, respectively. Equation (29) is described only for streams which directly flow to the sea, and the core idea of this equation is to inspire the generation of the stream to improve the exploration near the sea in the possible state for difficulties.

$$ Y_{\text{stream}}^{\text{new}} = Y_{\text{sea}} + \sqrt \mu \times {\text{rand}}n(1,M_{\text{var}} ), $$
(28)

where μ represents a coefficient which gives the range of searching states (region) near the sea, randn defines a random number which is normally distributed, and the value for μ is set to 0.1. From this equation, the created individuals with variance μ are distributed around the best-obtained optimum point.

The detailed steps of the proposed Masi-based color image multilevel thresholding operation are described, and the flowchart of the pseudocode of Masi-WCA method is shown in Fig. 1.

Step 1 An input image I is taken, if I is a color image then it is separated into three bands (Red–Green–Blue) and grayscale image is directly used.

Step 2 Compute the histogram of each band of the color image.

Step 3 Allocate the control parameters of WCA such as population size (Mpop), number of design variable (Mvar), number of iterations (stopping criterion), objective function, threshold levels.

Step 4 Generate the optimum thresholds by maximizing an objective function (or minimizing the negative of the entropy value) following the below pseudocode of WCA:

figure a

Step 5 The search intensity near the sea (the optimum solution) is used. The current best solution (optimum solution) for each of the color channels represents the set of optimal threshold values (TR, TG, and TB,) with best maximum objective function value.

Step 6 Each color channel is segmented individually using the corresponding threshold values. The segmented color channels are then concatenated to form the segmented color image.

4 Experimental Results and Discussion

In this section, experiment results have been discussed to evaluate the performance of the proposed Masi-WCA method over other methods for multilevel thresholding of the color images. The segmented results have been evaluated over 10 daily-life color images, and each color image is a multidimensional image with multimodal nature due to the presence of different bands (RGB). Input images and histogram plots of each band are shown in Fig. 2. Moreover, the presence of dense and complex features requires a sophisticated and accurate multilevel thresholding algorithm for the detection and identification of the region of interest. Each of the test images is segmented into four different thresholding levels: 3-level, 5-level, 8-level, and 12-level thresholding to achieve segmentation. All the algorithms are implemented using MATLAB R2017a on a personal computer with 3.4 GHz Intel Core-i7 CPU, 8 GB RAM running on Windows 10 system. Each of the test images is independently run 50 times using all algorithms to avoid any stochastic discrepancy due to the random nature of the optimization algorithm. For all the optimization algorithms, the population size and the number of iterations are set as 15 and 200 to provide fairness and convenience for performance comparison between WCA and other compared optimization algorithms.

Fig. 2
figure 2

Test color images (IMG1, IMG2, IMG3, IMG4, IMG5, IMG6, IMG7 IMG8, IMG9, and IMG10) and corresponding histogram plot of each frame (R–G–B) of the color images (Color figure online)

4.1 Image Quality Measures

The objective function value depends on the mathematical modeling of the objective function and the architecture and search strategy of the optimization algorithms. The objective function value indicates toward the best or worst segmentation quality of the algorithm. The computation time of an algorithm depends on the complexity of the method. The complexity of the method depends upon the mathematical structure of its objective function and the structure of the optimization algorithm. Therefore, to test the efficiency of any algorithm, computation time is an important parameter to be computed. The time taken by any technique to perform the segmented output is directly proportional to the complexity of that algorithm. The computation time also increases as the number of thresholding level increases.

To provide a comprehensive performance assessment of each algorithm, different fidelity parameters such as best objective function values, computation time (in seconds), misclassification error (ME), peak signal-to-noise ratio (PSNR), mean square error (MSE), feature similarity index (FSIM), structural similarity index (SSIM), and entropy are included in Table 1. A comprehensive discussion of the experimental results has been presented in this section. Therefore, the computed segmented results for each test image using Tsallis and Masi entropies as fitness function have been evaluated using BAT, PSO, WDO, MBO, GOA, and WCA. Keeping the view of Tables 2, 3, 4, 5, 6, 7, 8, and 9, Masi-WCA has outperformed in comparison with other optimization techniques (BAT, PSO, WDO, MBO, and GOA) as well as Tsallis entropy-based fitness function.

Table 1 Fidelity parameters considered to test the efficiency of the proposed method with other algorithms
Table 2 Comparison of best objective values (entropy) and ME computed by different algorithms using Tsalli entropy
Table 3 Comparison of best objective values (entropy) and ME computed by different algorithms using Masi entropy
Table 4 Comparison of MSE and PSNR computed by different algorithms using Tsallis entropy
Table 5 Comparison of MSE and PSNR computed by different algorithms using Masi entropy
Table 6 Comparison of SSIM and FSIM computed by different algorithms using Tsallis entropy
Table 7 Comparison of SSIM and FSIM computed by different algorithms using Masi method
Table 8 Comparison of entropy obtained by using different algorithms for each sample image
Table 9 Comparison of CPU timing (seconds) obtained by using different algorithms for each sample image

4.2 Experiment 1: Tsallis Entropy

The results achieved for each test image by using Tsallis entropy as an objective (or fitness) function are discussed and evaluated in this section. In the case of Tsallis entropy, it is easy to confirm which optimization technique has produced superior performance due to an optimal value of ME, MSE, PSNR, SSIM, FSIM, and entropy for the maximum number of cases. The metaheuristic methods are stochastic in behaviors or nature; the best solution or result created at each run may not be same or identical. The complete analysis of the Tsallis-based optimization techniques has revealed that the WCA technique produces optimal value for a maximum number of fidelity parameters among all the techniques for almost every image. The objective function of Tsallis method is maximized to determine the thresholding results. The performance of different objective functions has been compared by using the quantitative results such as best objective function and ME values obtained by Tsallis which is reported in Table 2. Tables 4, 6, 8, and 9 depict the statistical evaluation of the quality parameters such as MSE, PSNR, SSIM, FSIM, entropy, and computational time, respectively. Figure 3 depicts the segmented results for all the images obtained at 3-level, 5-level, 8-level, and 12-level thresholding for each optimization algorithm (BAT, PSO, WDO, MBO, GOA, and WCA) (Fig. 4). Figures 5, 6, 7, 8, 9, and 10 show the plots of ME, MSE, PSNR, SSIM, FSIM, and entropy of 8-level MT using Tsallis entropy correspondingly, and it can be clearly noticed from the plots that the Tsallis-WCA method outperforms all other optimization (BAT, PSO, WDO, MBO, and GOA) techniques.

Fig. 3
figure 3figure 3figure 3

Results showing 3-level, 5-level, 8-level, and 12-level segmented images using Tsalli-based multilevel thresholding approaches

Fig. 4
figure 4figure 4figure 4

Results showing 3-level, 5-level, 8-level, and 12-level segmented images using Masi-based multilevel thresholding approaches

Fig. 5
figure 5

Plots of 8-level ME using Tsallis

Fig. 6
figure 6

Plots of 8-level MSE using Tsallis

Fig. 7
figure 7

Plots of 8-level PSNR using Tsallis

Fig. 8
figure 8

Plots of 8-level SSIM using Tsallis

Fig. 9
figure 9

Plots of 8-level FSIM using Tsallis

Fig. 10
figure 10

Plots of 8-level entropy using Tsallis

4.3 Experiment 2: Masi Entropy

In this section, several experimental results are reported using WCA, BAT, PSO, WDO, MBO, and GOA based on Masi entropy for multilevel color image thresholding segmentation. The ME and fitness function values using Masi entropy scheme are presented in Table 3. It has been tested that the misclassification error evaluated by the WCA coupled with Masi entropy harvests the lowest value among all the techniques for the maximum number of cases. The architecture of the algorithm explores the search space more efficiently and locates the thresholding values accurately, and fitness function value is influenced by the architecture and complexity of the methods. The proposed Masi-WCA method has generated optimum value and the second best value with a very small margin for the fitness function as shown in Table 3. Comparison of PSNR and MSE values obtained by BAT, PSO, WDO, MBO, GOA, and WCA with Masi entropy is depicted in Table 5. Masi entropy-based method has reported best performance in comparison with Tsallis entropy, whereas WCA has found best among BAT, PSO, WDO, MBO, and GOA. Table 7 compares the similarity in features of the original image and segmented image from the results obtained by using BAT, PSO, WDO, MBO, GOA, and WCA with Masi entropy, respectively. Tables 8 and 9 compare the entropy and computational time (seconds) for the Tsallis entropy and Masi entropy coupled with optimization techniques. Figure 4 depicts the segmented results of each image at threshold level L = 3, 5, 8, and 12 acquired for Masi-BAT, Masi-PSO, Masi-WDO, Masi-MBO, Masi-GOA, and Masi-WCA. The main limitation of the proposed Masi-WCA method is that it takes more processing time for segmentation as compared to Masi-MBO methods, but Masi entropy coupled with different optimization techniques (Masi-BAT, Masi-PSO, Masi-WDO, Masi-MBO, Masi-GOA, and Masi-WCA) is always faster than Tsallis entropy-based optimization techniques (Tsallis-BAT, Tsallis-PSO, Tsallis-WDO, Tsallis-MBO, Tsallis-GOA, and Tsallis-WCA) which is reported in Table 9. However, Masi-WCA computes the best quality of segmented images over Masi-MBO. In some cases, the proposed Masi-WCA method is not produced best or optimal values, but it has maintained the second best value of those cases. The entropy value of the segmented image of the proposed Masi-WCA method is a maximum value for 5-level, 8-level, and 12-level thresholding, whereas it holds the best and the second best value for 2-level thresholding for almost all cases.

Figures 11, 12, 13, 14, 15, and 16 depict the plots of the ME, MSE, PSNR, SSIM, FSIM and entropy of 8-level MT using Masi entropy, respectively, from which it can confirm that the performance of the proposed Masi-WCA approach is superior among BAT, PSO, WDO, MBO, GOA when coupled with Masi entropy. Figures 3 and 4 show the segmented results of each test image at 3-level, 5-level, 8-level, and 12-level of thresholding from which it can be visually investigated that proposed Masi-WCA method surpasses the Tsallis-WCA-based results. From Tables 2, 3, 4, 5, 6, 7, 8, and 9, it can be clearly identified that Masi entropy overcomes the Tsallis entropy-based methods and the statistical analysis of the proposed algorithm outclasses with respect to all methods.

Fig. 11
figure 11

Plots of 8-level ME using Masi

Fig. 12
figure 12

Plots of 8-level MSE using Masi

Fig. 13
figure 13

Plots of 8-level PSNR using Masi

Fig. 14
figure 14

Plots of 8-level SSIM using Masi

Fig. 15
figure 15

Plots of 8-level FSIM using Masi

Fig. 16
figure 16

Plots of 8-level entropy using Masi

4.4 Comparison of WCA-Masi with Other Algorithms

The accuracy of the proposed Masi-WCA multilevel thresholding algorithm is the highest among all other compared algorithms in terms of image segmentation process. Moreover, compared methods are not very effective to perform the optimal thresholds. The Masi-MBO method is an average method where the accuracy is a major concern, but Masi-GOA method is the second best approach for the multilevel thresholding of the color image segmentation. WCA, MBO, and GOA are the recently introduced optimization techniques which are not exploited for the image segmentation purpose.

However, Tsallis entropy is a very efficient algorithm but has slightly lower performance than Masi entropy (objective function). Since the objective function holds the major importance in determining the threshold values, the mathematical model of Masi entropy is able to provide better thresholded results because of the non-extensive or additive information properties. WDO has fairly better results than PSO and BAT. This is due to the poor capability of these algorithms in searching the accurate thresholding levels to separate the image pixels into homogenous regions. BAT has generated poorly segmented outputs at the lower and higher thresholding levels; GOA produces better outputs but not as better than WCA. In few cases, the GOA gives similar results as the WCA. In some cases, WDO, PSO, and MBO optimization techniques have achieved better segmentation. But, the BAT and MBO are not very efficient in determining the threshold values accurately. The results of Masi-GOA have followed the performance of Masi-WCA, and Masi-GOA approach is fair at classifying pixels at high thresholding levels.

The results presented in this paper by proposed algorithm are superior in almost all the cases followed by some of the other recently developed metaheuristics algorithm. This action occurs because each image contains diverse features that characterize a particular optimization problem. Besides, the randomness of metaheuristic algorithms (ECA) produces some fluctuations in the results. For instance, if a threshold value is chosen through the metaheuristic that is not suitable, the segmented image probably will be not the best. Such condition merely can be identified by PSNR, MSE, SSIM, FSIM, and entropy because the objective function (Tsallis and Masi entropies) only offer information about how the intensities values are distributed in different regions. The analysis of convergence rate of IMG1 and IMG7 images using BAT, PSO, WDO, MBO, GOA, and WCA based on Tsallis and Masi entropies is shown in Figs. 17, 18, 19, and 20 for each R-G-B color channel individually. It is concluded that WCA convergence is faster as compared to other algorithms with respect to maximum objective values.

Fig. 17
figure 17

Convergence plots of 12-level MT using Tsallis entropy for each R-G-B channel of the color IMG1

Fig. 18
figure 18

Convergence plots of 12-level MT using Masi entropy for each R-G-B channel of the color IMG1

Fig. 19
figure 19

Convergence plots of 5-level MT using Tsallis entropy for each R-G-B channel of the color IMG7

Fig. 20
figure 20

Convergence plots of 5-level MT using Masi entropy for each R-G-B channel of the color IMG7

One of the advantages of the proposed Masi-WCA method is that the function values are reduced to near-optimum point in the early iterations. This may be due to the searching criteria and constraint handling approach of WCA where it initially searches a wide region of problem domain and rapidly focuses on the optimum solution. In general, the WCA offers competitive solutions compared with other metaheuristic optimizers. However, the computational efficiency and quality of solutions given by the WCA depend on the nature and complexity of the underlined problem. This applies to the efficiency and performance of numerous metaheuristic methods. The WCA is used for solving the real-world optimization problems, in terms of the optimum solution; it provides better or close to the best value compared with BAT, PSO, WDO, MBO, and GOA. In terms of the convergence function evaluations, the WCA reached the best solution faster than other algorithms. Therefore, the use of WCA in multilevel thresholding adds more accuracy and flexibility in determining the optimal threshold values that can vibrantly distinguish different objects present in the image and produces high-quality segmented color images. The proposed algorithm effectively deals with the uncertainties in color images with high randomness and multiple small targets with full of inherent uncertainty.

5 Conclusion

In this paper, a new color image multilevel thresholding method based on water cycle algorithm is proposed for segmentation. In this work, recently proposed optimization algorithms such as BAT, PSO, WDO, MBO, GOA, and WCA have been employed to maximize Tsallis and Masi entropies to solve the problem of image segmentation by determining the optimum multilevel threshold values. From the results, it can be concluded that the proposed Masi-WCA method can be efficiently and effectively be used in color image thresholding operation. The qualitative and quantitative illustrations for almost all test images exhibit that the WCA outperforms the BAT, PSO, WDO, MBO, and GOA. The study also reports about the performance of the two entropy-based objective functions with each optimization technique, which confirms the superiority of the Masi over Tsallis entropy. In order to measure the performance of the proposed approach, entropy, MSE, ME, SSIM, FSIM, and PSNR have been utilized to assess the quality of segmentation by considering the coincidences among the original images and respective segmented images. Even if individual entropies are considered, WCA outperforms all other optimization techniques considered in this paper. Hence, WCA has been proven to be superior to the rest of algorithms and also the Masi-WCA beats Tsallis-WCA in terms of efficiency and robustness. The experimental outcomes are encouraging and motivate futuristic research areas to apply WCA to other image processing applications such as image enhancement, image denoising, image classification, and various computer-related problems. Furthermore, the performance of other traditional entropies can be estimated using WCA concept for multilevel color image segmentation.