1 Introduction

Image segmentation refers to dividing an image into object and background which is widely used in image processing and computer vision (Chen et al. 2017). In the past few decades, many image segmentation approaches have been proposed and applied in various fields (Zeng et al. 2016; Badrinarayanan et al. 2017). Thresholding often provides an easy and convenient way to isolate objects of interest from the background which becomes a popular image segmentation technique (Cheriet et al. 1998). At present, thresholding segmentation contains bi-level and multi-level (El Aziz et al. 2017). Bi-level thresholding segments an image into two different parts. However, if an image is composed of several distinct objects, multilevel thresholds may obtain the desirable result. In generally, thresholding segmentation methods are almost based on one-dimensional histograms (Li and Tan 2019), but the spatial correlation among pixels is not taken into account, the performance of the method in noisy images is not satisfactory (Sha et al. 2016), for this reason, the 2D histogram is conceived (Abdel-Khalek et al. 2017). Subsequently, 2D multilevel thresholding image segmentation method is proposed (Ishak 2017b, a). However, the computation time is expensive when exhaustively searching multilevel thresholds. Hence, finding the optimal 2D multilevel thresholding is a challenging task (Ishak 2017b, a). The multilevel thresholding is difficult to get satisfying answer in reasonable time by conventional mathematical deterministic methods. This is an NP-hard combinational optimization problem (Khairuzzaman and Chaudhury 2017). In such case, meta-heuristic methods attracted much attention in recent years (Zeng et al. 2018). Most of the related works are based on swarm-intelligence, such as particle swarm optimization (PSO) (Xiong et al. 2019a) and the extraction algorithm of color disease (Xiong et al. 2019b), differential evolution (DE) (Sarkar et al. 2015), artificial bee colony (ABC) (Horng 2011), harmony search algorithm (HSA) (Erwin and Saputri 2018), firefly algorithm (FA) (Pare et al. 2018), cuckoo search (CS) (Bhandari et al. 2014), gravitational search algorithm (GSA) (Rashedi et al. 2009), bat algorithm (BA) (Gandomi et al. 2013), flower pollination algorithm (FPA) (Bhandari et al. 2016). Moreover, amount of modified and improved meta-heuristic algorithms are applied to multilevel thresholding (He and Huang 2017; Bhandari et al. 2015).

GSA is an optimization method inspired by the theory of Newtonian gravity in physics (Duman et al. 2012). Recently, GSA has been applied to several areas with promising performances feature selection (Nagpal et al. 2017), numerical optimization (Sarafrazi et al. 2015), power systems (Beigvand et al. 2016), multi-objective optimization and so on (Sun et al. 2016). The studies show that the GSA is remarkably promising and could outperform the other well known algorithms. The success recorded by the GSA is attributed to its striking balance between local and global searching. In addition, the fewer number of parameters required by the GSA for execution (Yazdani et al. 2014). However, although the GSA have been well-applied for solving many problems, but when dealing with different optimization problems, the GSA need to adjust the control parameters, and adopt new operators to enhance the performance (Kumar and Sahoo 2014). Nobahari et al. (2012) modeled two mutation operators in GSA, called sign and reordering, to improve the diversity of the population. Han and Chang (2012) applied a novel chaotic operator in GSA to overcome premature convergence and to avoid falling into local minima Rashedi et al. (2009). presented a clustering algorithm for image segmentation motivated by GSA equipped with a new operator, called escape. Doraghinejad and Nezamabadi-pour (2014) proposed a black hole operator strategy, which provoked by some characteristics of the black hole phenomenon in astronomy. The original GSA can be divided into two categories according to kinds of parameter control and hybridization. Parameters can be controlled, deterministic, adaptive and self-adaptive. Hybridization means incorporating the problem-specific knowledge into the original optimization algorithm (Kang et al. 2018; Sun et al. 2018). In summary, all the operations are utilized to balance the exploration and exploitation (Rashedi et al. 2018).

In order to enhance the stability and robustness of the GSA, a new approach FAGSA has been proposed for selecting the 2D multilevel thresholds. In our work, we took the Tsallis entropy as the measure. Our objective is to segment the image by maximizing the 2D Tsallis entropy. The optimization task will be accomplished using FAGSA. Indeed, the main object of this study is to demonstrate the effectiveness of the proposed algorithm, especially on multimodal images and noisy images.

The remainder of this paper is organized as follows. First, Sect. 2 exposes the employed Tsallis entropy and the two dimensional multilevel thresholding in details. The FAGSA will be described in Sect. 3. In Sect. 4, the performance of the proposed algorithm is evaluated by performing a series of test images. Section 5, some conclusions are drawn.

2 Two-dimensional multilevel thresholding model

In this section, the two-dimensional multilevel thresholding method for image segmentation is proposed. We introduce the concept of the Tsallis entropy and two-dimensional histogram computation and the two dimensional Tsallis entropy.

2.1 Tsallis entropy

Entropy is basically a thermodynamic concept associated with the order of irreversible processes from a traditional point of view. The seminal work of Shannon initiated the area of research now known as information theory. Shannon states that the great deal of information S (A) contained in a system A of N events with probabilities Pi = P1, P2,…, PN,\(\sum\nolimits_{i = 1}^{N} {P_{i} } = 1\), can be measured by:

$$S\left( A \right) = - \sum\limits_{i = 1}^{N} {P_{i} \ln P_{i} }$$
(1)

This quantity has since become known as the Shannon entropy which has been widely used in different fields. Extensions of Shannon’s original work have resulted in many alternative measures of information. Tsallis proposed a non-extensive entropy based on the Shannon entropy which can be defined as (Raja et al. 2018):

$$T_{q} \left( A \right) = \frac{{1 - \sum\nolimits_{i = 1}^{N} {P_{i}^{q} } }}{q - 1}$$
(2)

where q is an entropic index, generally q = 0.8. For two independent subsystems A1 and A2, on account of pseudo additive rule, the total Tsallis entropy of the system satisfies the following equation:

$$T_{q} \left( {A_{1} + A_{2} } \right) = T_{q} \left( {A_{1} } \right) + T_{q} \left( {A_{2} } \right) + \left( {1 - q} \right) \cdot T_{q} \left( {A_{1} } \right) \cdot T_{q} \left( {A_{2} } \right)$$
(3)

Based on multi-fractal theory, the generalization of the pseudo additive rule can be extend to m + 1 independent subsystems A1, A2,…, Ak+1 takes the following form:

$$\begin{gathered} T_{q} \left( {A_{1} + A_{2} + \; \cdot \cdot \cdot + A_{m + 1} } \right) = \sum\limits_{i = 1}^{m + 1} {T_{q} \left( {A_{i} } \right)} + \left( {1 - q} \right)\sum\limits_{i \ne j} {T_{q} \left( {A_{i} } \right)} T_{q} \left( {A_{j} } \right) \hfill \\ \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; + \left( {1 - q} \right)^{2} \sum\limits_{i \ne j \ne r} {T_{q} \left( {A_{i} } \right)} T_{q} \left( {A_{j} } \right)T_{q} \left( {A_{r} } \right) \hfill \\ \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; + \cdot \cdot \cdot + \left( {1 - q} \right)^{m} \prod\limits_{i = 1}^{m + 1} {T_{q} \left( {A_{i} } \right)} \hfill \\ \end{gathered}$$
(4)

2.2 2D histogram computations

For an image with L gray-levels, {L|L = 1,2,…,256}, and let U = {u1,…,uL} be the ordered set of all the gray-levels (u1 and uL are respectively the minimum and maximum gray values). A digital image of size M × N is read as a matrix F. Let f (x, y) is the gray value of the pixel located at the position (x, y), where {x|x = 1,2,3,…,M} and {y|y = 1,2,3,…,N}. 2D multilevel thresholding image segmentation based on the 2D histogram. In order to construct the 2D histogram, the average gray value of the neighborhood of each pixel is calculated, which also be called neighborhood matrix G of the same size as F. Let g(x, y) is the average gray-level value of the 3*3 neighborhood around the pixels located at the point (x, y) and is calculated from F as follows (Ishak 2017a, b):

$$g\left( {x,y} \right) = \left[ {\frac{1}{9}\sum\limits_{i = - 1}^{1} {\sum\limits_{j = - 1}^{1} {f\left( {x + i,y + j} \right)} } } \right]$$
(5)

where [g(x, y)] denotes the integer part of the g(x, y). We denote V = {v1,…,vR}, {R|R = 1,2,…,256} the ordered set of all average gray-levels in G (v1 and vR are respectively the minimum and maximum gray values). The matrix G represents the spatial correlation between the pixels in the image. The gray-level distribution and spatial gray-level distribution represented by matrices F and G, respectively are jointly used in defining the 2D histogram. To do this, the joint probability mass function matrix P of size L × R is calculated using the set U of gray values and the set V of average gray values. Theoretically, the joint probabilities P(i, j) are defined as follows:

$$\begin{gathered} P\left( {i,j} \right) = {\text{prob}}\left( {f\left( {x,y} \right) = u_{i} \;{\text{and}}\;g\left( {x,y} \right) = v_{j} } \right), \hfill \\ \forall i = 1,...,L\;{\text{and}}\;\forall j = 1,...,R\; \hfill \\ \end{gathered}$$
(6)

In practice, P(i, j) is approximated by the proportion of the image pixels with gray value ui and average gray value vj. Thus, the probabilities P(i, j) defining the image 2D histogram can be calculated by:

$$P\left( {i,j} \right) = \frac{{q\left( {u_{i} ,v_{j} } \right)}}{M \times N}$$
(7)

where q(ui, vj) is the number of the image pixels with gray value ui and average gray value vj. M × N is the total number of pixels in the image.

2.3 Two-dimensional Tsallis entropy

The thresholding based on the 2D histogram performed better than that based on the 1D histogram. Especially, images are corrupted with noise while use of 2D histogram results in much better segmentation (Ishak 2017a, b). In the 1D multilevel thresholding method, we have only to determine m thresholds that maximize the Tsallis entropy on the 1D histogram, while 2 m values are required in the 2D multilevel thresholding approach. Indeed, we have to find m pairs of thresholding. It gives rise to the exponential increasingly when deal with more than one thresolding for the 2D multilevel thresholds. Despite this drawback, the 2D multilevel thresholding method might be effective to segment the images.

The 2D histogram plane is shown in Fig. 1. The histogram plane is divided into four regions by a threshold vector (s, t), where s is a threshold for original pixel and t is another threshold for the average pixel.

Fig. 1
figure 1

2D histogram for bi-level segmentation

Regions 1 and 3 represent the object(s) and the background. Regions 2 and 4 can be ignored as the information of these two regions mostly about the edges and noises. The joint probabilities of regions 1 and 3 can be calculated by:

$$P_{1} \left( {s,t} \right) = \sum\limits_{i = 1}^{t} {\sum\limits_{j = 1}^{s} {P\left( {i,j} \right)\;} } ,\;\;P_{3} \left( {s,t} \right) = \sum\limits_{i = s + 1}^{L} {\sum\limits_{j = t + 1}^{R} {P\left( {i,j} \right)} }$$
(8)

The 2D histogram plane can be divided into n*n regions by the multilevel thresholds. A histogram plane with n2 divisions is created as illustrated in Fig. 2.

Fig. 2
figure 2

2D histogram for multilevel thresholding segmentation

The diagonal rectangles represent the object(s), intermediate region and backgrounds. Other regions are ignored which are regarded as edges and noises. Posteriori probabilities P1(s1, t1), P3(s2, t2) and P2n+1(sn, tn) can be calculated by:

$$\begin{gathered} P_{1} \left( {s_{1} ,t_{1} } \right) = \sum\limits_{i = 1}^{{t_{1} }} {\sum\limits_{j = 1}^{{s_{1} }} {P\left( {i,j} \right)\;} } ,\;\; \hfill \\ P_{3} \left( {s_{{2}} ,t_{{2}} } \right) = \sum\limits_{{i = s_{1} + 1}}^{{s_{2} }} {\sum\limits_{{j = t_{1} + 1}}^{{t_{2} }} {P\left( {i,j} \right)} } \hfill \\ ... \hfill \\ P_{2n + 1} \left( {s_{{\text{n}}} ,t_{{\text{n}}} } \right) = \sum\limits_{{i = s_{n} + 1}}^{L} {\sum\limits_{{j = t_{n} + 1}}^{R} {P\left( {i,j} \right)} } \hfill \\ \end{gathered}$$
(9)

Therefore, the optimal 2D multilevel thresholds vector s* and t*, s* = (s1,s2,…,sn), t* = (t1,t2,…,tn) are obtained by maximizing the Tsallis entropy, that is:

$$T_{q}^{opt} \left( {s^{ * } ,t^{ * } } \right) = \arg \max \left( {T_{q} \left( {s_{1} ,t_{1} } \right) + T_{q} \left( {s_{2} ,t_{2} } \right) + \cdot \cdot \cdot + T_{q} \left( {s_{n} ,t_{n} } \right)} \right)$$
(10)

where

$$\begin{gathered} T_{q} \left( {s_{1} ,t_{1} } \right) = \frac{{1 - \sum\nolimits_{i = 1}^{{s_{1} }} {\sum\nolimits_{j = 1}^{{t_{1} }} {\left( {{{P\left( {i,j} \right)} \mathord{\left/ {\vphantom {{P\left( {i,j} \right)} {P_{1} \left( {s_{1} ,t_{1} } \right)}}} \right. \kern-\nulldelimiterspace} {P_{1} \left( {s_{1} ,t_{1} } \right)}}} \right)^{q} } } }}{q - 1}\;, \hfill \\ \;T_{q} \left( {s_{{2}} ,t_{{2}} } \right) = \frac{{1 - \sum\nolimits_{{i = s_{1} + 1}}^{{s_{2} }} {\sum\nolimits_{{j = t_{1} + 1}}^{{t_{2} }} {\left( {{{P\left( {i,j} \right)} \mathord{\left/ {\vphantom {{P\left( {i,j} \right)} {P_{3} \left( {s_{{2}} ,t_{{2}} } \right)}}} \right. \kern-\nulldelimiterspace} {P_{3} \left( {s_{{2}} ,t_{{2}} } \right)}}} \right)^{q} } } }}{q - 1}\;, \hfill \\ ... \hfill \\ T_{q} \left( {s_{n} ,t_{n} } \right) = \frac{{1 - \sum\nolimits_{{i = s_{n} + 1}}^{L} {\sum\nolimits_{{j = t_{n} + 1}}^{R} {\left( {{{P\left( {i,j} \right)} \mathord{\left/ {\vphantom {{P\left( {i,j} \right)} {P_{n} \left( {s_{n} ,t_{n} } \right)}}} \right. \kern-\nulldelimiterspace} {P_{n} \left( {s_{n} ,t_{n} } \right)}}} \right)^{q} } } }}{q - 1}\; \hfill \\ \end{gathered}$$
(11)

3 Image segmentation based on FAGSA

3.1 Original GSA

GSA is a population-based evolutionary algorithm inspired by the concept of gravity (Rashedi et al. 2009). The GSA is based on the law of universal gravitation that all the objects in the universe are attracted to each other by the gravity force, this force causes a global movement of all objects, and small mass objects are approaching to big mass objects. The mass and distance affects the gravitational force. Therefore, there is a great potential in this field to adopt the gravity concept in producing effective search operators. The detail process of the GSA is described as follows. Now, consider a system with N agents (masses), the position of the ith agent is defined by:

$$X_{i} = \left( {x_{i}^{1} ,...,x_{i}^{d} ,...,x_{i}^{n} } \right)\;,\;\;\;i = 1,\;2,\;...,N$$
(12)

where \(x_i^d\) is the position of the ith agent in the dth dimension and n is the dimension of the population.

Mass of each agent i is calculated according to its current objective function as follows:

$$m_{i} \left( t \right) = \frac{{fit_{i} \left( t \right) - worst\left( t \right)}}{best\left( t \right) - worst\left( t \right)}$$
(13)
$$M_{i} \left( t \right) = \frac{{m_{i} \left( t \right)}}{{\sum\nolimits_{j = 1}^{N} {m_{j} \left( t \right)} }}$$
(14)

where Mi(t) and fiti(t) represent the mass and the fitness value of the agent i at generation t, respectively. For a maximization problem, worst(t) and best(t) are defined as follows:

$$\begin{gathered} best\left( t \right) = \max fit_{i} \left( t \right) \hfill \\ worst\left( t \right) = \min \;fit_{i} \left( t \right) \hfill \\ \end{gathered}$$
(15)

In order to calculate the acceleration of an agent, the total forces from a set of heavier masses that apply on an agent based on the modified law of gravity, which is measured by follow formulas:

$$F_{i}^{d} \left( t \right) = \sum\limits_{j \in kbest,i \ne j} {rand_{j} F_{ij}^{d} \left( t \right)}$$
(16)
$$F_{ij}^{d} \left( t \right) = G\left( t \right)\frac{{M_{pi} \left( t \right)M_{aj} \left( t \right)}}{{R_{ij} + \varepsilon }}\left( {x_{j}^{d} \left( t \right) - x_{i}^{d} \left( t \right)} \right)$$
(17)

where Mai(t) is the active gravitational mass related to agent j, Mpi(t) is the passive gravitational mass related to agent i which can calculate by Eqs. (13) and  (14), randj is uniform random values in the interval [0,1], ɛ is a small value, and Rijis the distance between the two agents i and j. kbest is the set of first k agents with the best fitness values and biggest masses. Especially, G(t) is gravitational constant which will decrease with time, the corresponding equation is given by:

$$G\left( t \right) = G_{0} * e^{{\frac{ - \alpha t}{T}}}$$
(18)

where G0 are the constant and α is the damping factor. The acceleration now can be expressed as:

$$a_{i}^{d} \left( t \right) = \frac{{F_{i}^{d} \left( t \right)}}{{M_{ii} \left( t \right)}}$$
(19)

where Mii(t) is the inertia mass of ith agent, which also can compute by Eqs. (13) and (14). Then the next velocity of an agent i satisfies the follow expression:

$$v_{i}^{d} \left( {t + 1} \right) = rand_{i} * v_{i}^{d} \left( t \right) + a_{i}^{d} \left( t \right)$$
(20)

where randi is uniform random values in the interval [0,1]. In order to better control the next velocity, an inertia weight is taken into account, therefore the Eq. (20) can be modified by

$$v_{i}^{d} \left( {t + 1} \right) = \omega \left( {t + 1} \right) * rand_{i} * v_{i}^{d} \left( t \right) + a_{i}^{d} \left( t \right)$$
(21)

Then, the agent’s next position can be updated by follow equation:

$$x_{i}^{d} \left( {t + 1} \right) = x_{i}^{d} \left( t \right) + v_{i}^{d} \left( {t + 1} \right)$$
(22)

A better representation of the GSA process is shown in Fig. 3.

Fig. 3
figure 3

General principle of the GSA

3.2 FAGSA

In generally, it is probably impossible to define a unique set of parameters that work well in all cases. However, the following FAGSA has been useful to work in practice. According to the analysis, it is known that.

  1. 1.

    When searching the best fitness at the end of run, low inertia weight and low gravitational constant are often preferred.

  2. 2.

    When the best fitness has been stayed at one value for a long time, simply increasing the number of iterations does not work. The inertia weight and gravitational constant should be increased.

Therefore, a fuzzy system is utilized to adaptive control the inertia weight and gravitational constant with the best fitness (BF) and the number of iteration which the best fitness value is unchanged (NU) as the input variables, and the inertia weight (ω) and control parameter (α) as the output variables. The normalized best fitness (NBF) in the range of [0, 1] can be calculated by follow:

$$NBF = \frac{{BF - BF_{{\min}} }}{{BF_{\max } - BF_{\min } }}$$
(23)

where BFmin and BFmax are the estimated minimum and maximum values of best fitness. NU values are normalized in a similar way. The bound values for ω and α are 0.2 ≤ ω ≤ 1.2, 10 ≤ α ≤ 50.

The membership functions of every input and output are shown in Fig. 4. The fuzzy important rules of the inertia weight (ω) and control parameter (α) were shown in Table 1. According to Table 1, PS (positive small), PM (positive medium) and PB (positive big) are the linguistic values for all of the input and output variables. According to the above description, the flow chart of the proposed FAGSA is shown in Fig. 5.

Fig. 4
figure 4

Membership functions of inputs and outputs. a NBF or NU, b ω, and α

Table 1 Fuzzy rules for the inertia weight ω and the control parameter α
Fig. 5
figure 5

General principle of the FAGSA

4 Experiments

In this section, the performance of the proposed algorithm was evaluated. Firstly, the test images and the algorithms used in the comparison were introduced in Sect. 4.1, followed by the detailed results on the objective function value shown in Sect. 4.2. Then, two popular measure metrics were used to verify the segmentation performance in Sect. 4.3. Finally, the application of the four algorithms was given in Sect. 4.4.

4.1 Experiment set up

The proposed algorithm used two-dimension Tsallis entropy as its objective function will be tested under a set of benchmark images. The test images named ‘Lena’, ‘Goldhill’, ‘Lake’ and ‘Butterfly’, and the size of the images are 512 × 512. The original images and corresponding histograms are shown in Fig. 6. We can find that the 2D histograms are multimodal. Therefore, the test images are suitable for multilevel thresholding image segmentation.

Fig. 6
figure 6

The test images and their histograms

The experiments were carried out on a PC with an Intel Corei7 processor and 8 GB memory. The global optimization toolbox of MATLAB R2018a runs on windows ten system. The DE, PSO and GSA are implemented under the same conditions. Generally, the experiments test thresholding are m = 2, 3, 4, 5. All population individuals were uniformly randomly initialized within [0, 255]. The number of iteration set to 300 in per experiment and the population size set to 30. Besides, all the experiments were repeated 30 times. The corresponding parameters used for the presented four algorithms are listed in Table 2.

Table 2 Parameters of the four algorithms

4.2 Results on the objective function

As the aim of the multilevel thresholding is to maximize the given objective function, the objective function value obtained by the involved algorithms directly shows the algorithm’s performance. In detail, the mean and standard deviation of objective function values are shown in Table 3.

Table 3 Comparison of the mean and standard deviation of objective function values

As shown in Table 3, it can be observed that all the test images with different algorithms show relatively high objective function values. Obviously, as the increase of the number of the threshold, the four algorithms can get high objective function values. Generally, the FAGSA outperform the other three algorithms, DE and PSO show similar objective functions, while GSA is a little inferior. Besides, from the perspective of standard deviation of the objective function values, the FAGSA shows obviously advantages over DE, PSO and GSA. The smaller the standard deviation is, the smaller the change of objective functions over the course of iterations will be, that is, the better stability of segmentation. Therefore, the results show that the FAGSA obtains exciting effect in stability.

4.3 Quality measure and time consumption of segmented image

To verify the performance of the proposed algorithm, the time consumption and appropriate performance indicator peak signal noise ratio (PSNR) were calculated to evaluate the corresponding image segmentation quality. Image quality measurement using peak signal to noise ratio (PSNR) is defined as (Horng 2011):

$$PSNR = 20\log_{10} \left( {\frac{255}{{RMSE}}} \right),{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} \left( {dB} \right)$$
(24)

where

$$RMSE = \sqrt {\frac{{\sum\limits_{i = 1}^{M} {\sum\limits_{j = 1}^{N} {\left( {I\left( {i,j} \right) - C\left( {i,j} \right)} \right)^{2} } } }}{M \times N}}$$
(25)

Table 4 displays the PSNR metric and time consumption of the test images segmented with different thresholds by the four algorithms. The results show FAGSA achieves the highest assessment, testifying to the superiority of FAGSA. However, PSNR values do not increase as the number of thresholds increases, when the number of the thresholding is three, the PSNR get the maximum values, expect the test image ‘Lake’. It demonstrates that the number of 2D multilevel thresholds is not the more the better. Therefore, the selection of appropriate thresholds number needs to be based on the 2D histogram. Compared to the computation time of the four algorithms, the FAGSA is better than the other algorithms. It can be observed that FAGSA demonstrates better time efficiency and excellent segmentation results and has obvious advantages, especially over GSA in computation time. Therefore, it can be safely assumed that FAGSA is a desirable image segmentation method with high efficiency and of high quality.

Table 4 Comparison of the mean PSNR and Time consumption

4.4 Comparing the performance in noisy image segmentation

In this Section, we present a comparative study with the other three multilevel thresholding segmentation algorithms. The objective is to highlight the effectiveness of the FAGSA. The images corrupted by Gaussian noise and salt and pepper noise are considered to perform the contrast experiment. In the experiment, the mean value and variance of the two noises are set to 0 and 0.02, respectively. Besides, we set the number of the thresholds to three for the 2D multilevel thresholding. Figures 7 and 8 illustrate the segmentation results obtained by the competitive approaches on the different noisy images. Visually, these experimental results show that the images segmented by the FAGSA are more clearly and with higher veracity. Indeed, we observe that the FAGSA for 2D multilevel thresholding achieves a good balance between smooth borders, preserving image details and robustness to different types and levels of noise. This effectiveness is much more remarkable on the multimodal images. To make the experimental results more convincing, we choose two popular measures SSIM and FSIM index to support our claim (Agrawal et al. 2013).

Fig. 7
figure 7

Segmentation results on test images corrupted by Gaussian noise

Fig. 8
figure 8

Segmentation results on test images corrupted by salt and pepper noise

The SSIM is used to access the similarity of the original and segmented image. The SSIM index is defined as:

$$SSIM\left( {C,I} \right) = \frac{{\left( {2\mu_{C} \mu_{I} + C_{1} } \right)\;\left( {2\delta_{CI} + C_{2} } \right)}}{{\left( {\mu_{C}^{2} + \mu_{I}^{2} + C_{1} } \right)\;\left( {\delta_{C}^{2} + \delta_{I}^{2} + C_{2} } \right)}}$$
(26)

where μC, δC respectively represent the pixel mean and variance of original image. μI, δI respectively represent the pixel mean and variance of segmented image. δCI is the co-variance of the original image and the segmented image. C1, C2 are the constant, here, C1 = C2 = 6.5025. The highest value of SSIM shows a better performance. In addition, the FSIM is employed to measure the feature similarity between two images. It is calculated between two images C and I as:

$$FSIM = \frac{{\sum\nolimits_{x \in \Omega } {S_{L} \left( x \right)PC_{m} \left( x \right)} }}{{\sum\nolimits_{x \in \Omega } {PC_{m} \left( x \right)} }}$$
(27)

where

$$\begin{gathered} S_{L} \left( x \right) = S_{PC} \left( x \right)S_{G} \left( x \right); \hfill \\ S_{PC} \left( x \right) = \frac{{2PC_{1} \left( x \right)PC_{2} \left( x \right) + T_{1} }}{{PC_{1}^{2} \left( x \right) + PC_{2}^{2} \left( x \right) + T_{1} }}; \hfill \\ S_{G} \left( x \right) = \frac{{2G_{1} \left( x \right)G_{2} \left( x \right) + T_{2} }}{{G_{1}^{2} \left( x \right) + G_{2}^{2} \left( x \right) + T_{2} }}; \hfill \\ PC_{m} \left( x \right) = \max \left\{ {PC_{1} \left( x \right),PC_{2} \left( x \right)} \right\}. \hfill \\ \end{gathered}$$
(28)

And, T1 and T2 are constants. Here, we choose T1 = 0.85 and T2 = 160 in the experiments, G(x) represents the gradient magnitude of an image, PC(x) is the phase congruence of an image. A higher value of FSIM indicates better performance. The experimental data are shown in Tables 5 and 6. The results indicate the FAGSA perform better than the other three algorithms, which are consistent with the visual analysis. In conclusion, the proposed algorithm achieved significant improvements based on the original GSA; and when compared with other meta-heuristic algorithms, the proposed algorithm offered stability in 2D multilevel image thresholding and better image segmentation quality.

Table 5 Comparison of the SSIM and FSIM with Gaussian noise
Table 6 Comparison of the SSIM and FSIM with salt and pepper noise

5 Conclusions

In this paper, we proposed an improved GSA, called the FAGSA, for 2D multilevel thresholds selection using Tsallis entropy. In the FAGSA, a fuzzy system is designed for intelligently updating the inertia weight (ω) and control parameter (α) to realize adaptive selection of parameters for different optimization problems. The experiments demonstrated the effectiveness of the FAGSA. In the experiments, the proposed algorithm in comparison with DE, PSO and GSA in 2D multilevel thresholds image segmentation. The experimental results demonstrate the superiority of our algorithm in terms of the objective function value, image quality measures and time consumption. Future works of this study will focus on studying the performance of the proposed algorithm on remote sensing images.