Multi-Level Image Thresholding Based on Modified Spherical Search Optimizer and Fuzzy Entropy

Multi-level thresholding is one of the effective segmentation methods that have been applied in many applications. Traditional methods face challenges in determining the suitable threshold values; therefore, metaheuristic (MH) methods have been adopted to solve these challenges. In general, MH methods had been proposed by simulating natural behaviors of swarm ecosystems, such as birds, animals, and others. The current study proposes an alternative multi-level thresholding method based on a new MH method, a modified spherical search optimizer (SSO). This was performed by using the operators of the sine cosine algorithm (SCA) to enhance the exploitation ability of the SSO. Moreover, Fuzzy entropy is applied as the main fitness function to evaluate the quality of each solution inside the population of the proposed SSOSCA since Fuzzy entropy has established its performance in literature. Several images from the well-known Berkeley dataset were used to test and evaluate the proposed method. The evaluation outcomes approved that SSOSCA showed better performance than several existing methods according to different image segmentation measures.


Introduction
Image segmentation is a critical process in image processing technology which has been applied in various fields and applications, for example, in remote sensing [1], medical image [2], and others [3,4]. Image segmentation splits a given image into several classes that have similar properties, including color, brightness, gray level, contrast, and texture. There are different types of image segmentation techniques, including region extraction [5], clustering algorithms [6], edge detection [7], and thresholding [8]. Thresholding is an efficient segmentation method that asserts its efficiency in many applications. It is of two kinds, called bi-level (BLT) and multi-level thresholding (MLT). The BLT divides the objects of an image into two classes; therefore, if a given image has more classes, bi-level thresholding is not appropriate. MLT can solve this problem because it can divide the tested image into more classes. Previously, many multi-level thresholding methods had been applied using image histograms to get the best threshold values by maximizing or minimizing fitness functions (i.e., Otsu, and entropy).
However, traditional models face some limitations, such as computational time. Recently, metaheuristic (MH) methods have been widely applied to solve various optimization problems, including image segmentation. For example, Qi [8] presented a multi-level thresholding method based on particle swarm optimization (PSO) and maximum entropy. Different images, including remote sensing images, were utilized to test the improved PSO performance. In Reference [9], the authors proposed a segmentation method using multi-level thresholding. The galaxy-based search algorithm (GbSA) is applied to search for the optimal thresholding value, which is determined by maximizing Otsu's criterion. The GbSA showed good performance in determining the optimal thresholding value. Mostafa et al. [10] used the whale optimization algorithm (WOA) to segment MRI images. WOA had been evaluated with various MRI images and asserts its efficiency in segmentation accuracy. In Reference [11], the authors presented a multi-level thresholding method based on moth-flame optimization (MFO). Both Otsu's and Kapur's entropy were used as the fitness function to evaluate the proposed method. Compared to PSO and bacterial foraging optimization (BFO), the MFO showed better performance. Social group optimization (SGO) [12] was applied for skin melanoma image segmentation. The firefly algorithm (FA) was applied for multi-level thresholding in Reference [13]. It applied Otsu as the objective function; also, the evolution results showed that FA had better performance compared to several existing methods. The FA also had been adopted in several multi-level thresholding [14][15][16]. Moreover, in Reference [17], both MFO and WOA were applied for multi-level thresholding. The evaluation experiments showed that MFO outperformed WOA. In Reference [18], the cuckoo search (CS) was applied for multi-level thresholding for gray-scale images. Also, in Reference [19], CS was applied for color images multi-level thresholding. Satapathy et al. [20] presented a multi-level thresholding approach based on the chaotic bat algorithm (CBA) and Otsu as a fitness function. CBA showed good performance compared to several methods. Also, Ant colony optimizer (ACO) was used for document image segmentation [21].
However, individual MH algorithms may be stuck at the local optima or may show slow convergence because some MH algorithms show good exploitation ability and some of them show good exploration ability [22]. To overcome these limitations, several hybrid metaheuristics have been proposed. For example, in Reference [23], a multi-level threshold method based on a hybrid of social spider optimization (SSO) and FA is presented. The developed FASSO method uses the power of both FA and SSO to avoid individual MH limitations. Mudhsh et al. [24] presented a hybrid of artificial bee colony (ABC) and FA to select the optimal threshold value by maximizing the Otsu function. This method was applied to enhance document image binarization and showed good performance. A hybrid approach of PSO and bacterial foraging optimization (BFO) for multi-level segmentation is presented in Reference [25]. This approach had been evaluated with eight images and reached good segmentation accuracy for both multi-level and bi-level thresholding. Another hybrid approach for multi-level thresholding is proposed by Reference [26] using the entropy function. The hybrid method is based on the gravitational search algorithm and genetic algorithm. In Reference [27], a hybrid multi-level thresholding method is proposed based on an improved salp swarm optimizer and Fuzzy entropy. The MFO is used to overcome the limitation of the salp swarm algorithm.
However, in such hybrid methods, one MH algorithm is needed to improve the local search for the other MH algorithm, such as, in Reference [27], the MFO is used as a local search for SSA. These hybrid MH methods can solve optimization problems efficiently. In the same context, we improved a new MH algorithm, called spherical search optimizer (SSO) [28], using the sine cosine algorithm (SCA), and applied the modified version, called SSOSCA, as an MLT image segmentation technique. In general, the SSO is based on the spherical search style, which is in contrast to the basic search style of previous MH algorithms. The SSO uses a combination of search styles to avoid the limitation of previous MH algorithms [28]. However, the exploitation ability of the SSO is less than its exploration ability. Therefore, we use the SCA to enhance it, since the SCA has the ability to exploit the search space and it has established its performance in different fields. The SCA is an efficient MH algorithm proposed by Reference [29]. In recent years, SCA has been applied in various optimization problems, such as in Reference [30], the SCA is employed to improve the adaptive neuro-fuzzy system (ANFIS) to forecast oil consumption in several countries. The SCA is employed to optimize the parameters of the ANFIS. In Reference [31], the authors applied SCA to enhance simulated annealing (SA) algorithm to build an efficient model for scheduling jobs in unrelated parallel machines that can be employed in manufacturing scheduling applications. In Reference [32], the SCA is applied to enhance the artificial bee colony (ABC) that applied for image segmentation. It is used to update individual solutions to find the optimal solution. In Reference [33], an improved SCA is proposed to solve global optimization problems. The improved SCA was evaluated using two popular benchmarks (CEC 2014 and CEC 2017) for various engineering problems, and it showed good performance. Also, in Reference [34], an improved SCA is proposed for solving global optimization problems. The opposition-based learning (OBL) is considered as a mechanism that improves the exploration of the search space to generate accurate solutions. A hybrid of SCA and genetic algorithm (GA) was proposed by Reference [35] for feature selection. Eight UCI datasets were used to evaluate the hybrid SCA and showed good performance. In Reference [36], a hybrid of atom search optimization and SCA is proposed for automatic data clustering. The SCA is employed as a local search method to enhance the performance of the atom search optimization.
In general, the proposed SSOSCA starts by setting the initial value for a set of agents depending on the computed histogram of the image of interest. Then, the Fuzzy entropy is employed to compute the quality of each agent since the Fuzzy entropy has a set of variant characteristics that made it suitable for the image segmentation problem. The next step is to search the agent which has the best fitness value, followed by updating the agents using the operators of SSO or SCA according to the probability of each solution that was computed depending on the fitness value of each agent. The process of searching for a suitable threshold is performed until the stopping conditions are met, and the best agent is considered as the output of the proposed SSOSCA.
Our main contributions are listed as follows: 1.
We present an alternative multilevel thresholding technique based on modified MH algorithm, called spherical search optimizer (SSO). To the best of the authors' knowledge, this is the first study that adopted SSO for image processing.

2.
We enhance the exploitation ability of the SSO using the SCA's operators.

3.
We evaluate the performance of the SSOSCA using different images.

4.
We compare the proposed SSOSCA with several existing methods.
The organization of this study is as follows: Section 2 presents the preliminaries of the problem definition, SSO and SCA. Section 3 presents a description of the proposed method. The evaluation and comparison experiment are presented in Section 4. We conclude this paper in Section 5.

Problem Definition
The problem formulation of MLT is presented in this section. Assume we have a gray-scale image I which has K + 1 classes. To divide a given image I into classes, the values of k thresholds {t k , k = 1, 2, K} are needed, which can be defined as follows: . . .
where L represents the maximum gray levels, C K is the kth class of the image, t k is the kth threshold, and I ij represents gray levels at the (i, j)th pixel and where the problem of the MLT can be defined as a maximization problem which is applied to find an optimal threshold value as follows: where Fit is the objective function. Here, the Fuzzy entropy [37] is applied as an objective function. Fuzzy entropy is a popular technology [38][39][40], which has been applied in many multi-level threshold segmentation applications, such as color images [41], brain tumor images [42], MRI images [43], and others [44,45]. It can be defined as follows: a 1 , c 1 , ...., a k−1 , c k−1 are the Fuzzy parameters, where 0 ≤ a 1 ≤ c 1 ≤ ... ≤ a K−1 ≤ c K−1 . Then t 1 = a 1 +c 1 2 , t 2 = a 2 +c 2 2 , ..., t K−1 = a K−1 +c K−1 2 .

Spherical Search Optimizer
In this section, the primary operators of the spherical search optimizer (SSO) are defined [28]. Two solutions X and Y are selected from the population X by the tournament selection method. Then, spherical search operators are used to update X using the following equations: where i, j, and k are random selected integers representing the dimensions. p represents a set of integers (i.e., p = i, j, k). ||.|| 2 refers to the l 2 norm (i.e., Euclidean distance). F ∈ [0, 1] represents a scaling factor, and θ ∈ [0, π] is the angle between X and Z-axis. ω ∈ [0, 2π] represents the angle in x˘y plane.

Sine Cosine Algorithm
Mirjalili [29] proposed the SCA as a population-based MH algorithm which uses sine and cosine functions to search for optimal solutions. The SCA begins by producing a group of N solutions represented as X i , i = 1, . . . , N in the following expression: where l i and u i are the lower and upper boundarues of the search domain, respectively. Thereafter, SCA computes its fitness function to evaluate each solution X i ∈ X. The SCA updates the solution using one of its two main functions (sine or cosine) depending on the r 1 ∈ [0, 1] probability random variable, as follows: In Equation (13), X b refers to the best solution, where r l ∈ [0, 1], l = 2, 3, 4 refers to a random number.
The goal of r 2 is to find the optimal area for updating X, which may be in the region between X i and X b or outside. Moreover, it is applied to balance exploitation and exploration by enhancing its values as follows [29]: where a is a constant value, t is the current iteration, and t max is the maximum number of iterations. Furthermore, the goal of r 3 is to detect if X i moves to best solution X b direction or outwardly, where the goal of r 4 is to provide X b with a random weight to stochastically assert (r 4 > 1) or to stochastically de-assert (r 4 < 1) the effect of desalination in defining the distance.

Proposed Image Segmentation Method
The steps of the proposed SSOSCA multilevel image segmentation technique are given in Figure 1. SSOSCA is an enhancement version of the traditional SSO algorithm based on the operators of SCA. This achieved by applying the SCA as a local search method for the SSO to improve its exploitation ability.
The steps of SSOSCA begin by setting the initial value randomly for a set of agents X, and this is performed using Equation (15).
where I max and I min represent the largest and smallest gray values of the histogram of I, respectively. After that, SSOSCA assesses the quality of each agent based on its fitness value as defined in Equation (3), followed by allocating the best agent (X b ), which has a higher fitness value (Fit b ). The next step is to compute the probability Pr i for each agent depending on its fitness value Fit i as follows: The operators of SSO are used to update the current agent X i (as defined in Equations (8)- (11)) in the case of Pr i < r s ; otherwise, the two functions of SCA are used (i.e., sine and cosine) as defined in Equations (13) and (14). In this study, the value of r s is updated during the optimization process as follows: This strategy avoids the problem of determining the suitable value of r s to switch between the operators of SCA and SSO. The previous steps are performed again in case of the terminal conditions not being satisfied; otherwise, the best solution is returned, and this represents the best threshold value at a given threshold level. The quality of the segmented image is computed using suitable measures.

Complexity of SSOSCA
The complexity of SSOSCA depends on the complexity of SSO and SCA. In general, the SSO has complexity O(t max × N × (4Dim)) while the SCA has complexity O(t max × N × (Dim)). Therefore, the complexity of SSOSCA is O(t max × N SSO × (4Dim)) + O(t max × N SCA × (Dim)), where N SSO and N SCA are the number of solutions which updated using SSO and SCA, respectively.

Experiments and Results
To investigate the quality of the threshold obtained by the SSOSCA, ten images are used. These images have variant properties that can be observed from their histogram, as given in Figure 2.

Performance Measures
In order to assess the quality of the segmented image, a set of performance metric are used which includes Peak Signal-to-Noise Ratio (PSNR) [46,47] and the Structural Similarity Index (SSIM) [48]. PSNR and SSIM can be defined as follows: where the RMSE is the root mean-squared error.
µ I (σ I ) and µ I S (σ I S ) refer to the images' mean intensity (standard deviation) of I and I S , respectively. σ I,I S is the covariance of I and I S , and c 1 = 6.5025 and c 2 = 58.52252. Furthermore, we use the fitness value to evaluate the quality of threshold values; also, we use the CPU time for each algorithm.

Algorithms Comparison and Parameters Setting
In this section, the proposed SSOSCA is compared with other six approaches, including cuckoo search (CS) [49], grey wolf optimization (GWO) [50], whale optimization (WOA) [51], salp swarm algorithm (SSA) [52], grasshopper optimization algorithm (GOA) [53], and spherical search optimization (SSO). During fair comparisons, we set the size of the population and the number of the iterations to 20 and 100, respectively. The parameters of each approach are set to the original implementation of each approach. In addition, the parameters of SCA used in the proposed method are set according to the try and error method. However, we found that the parameters used on the original SCA references are more suitable and stable.

Results and Discussion
We compare the SSOSCA approach to other approaches at different levels of the threshold, including 6, 8, 15, 17, 19, and 25. These values are considered higher with respect to other works, and they are used to assess the ability of the algorithms to determine the threshold values at these high levels. Since this is more suitable in real-world image processing applications, for example, remote sensing, medical images, and other cell images that have many objects. Tables 1-3 and Figures 3-6 show the results of each approach at different threshold levels. Table 1 illustrates the average of the PSNR at different threshold levels and among the ten tested images. From these results, we can see that the SSOSCA has a high ability to obtain the best threshold values that improve the segmentation of the given images. This is clear from the results where the SSOSCA has high PSNR values in forty-seven cases (as given in boldface) from the total sixty cases (ten image × six threshold levels). Followed by the SSA algorithm with eleven cases, while the WOA allocates the third rank with only two cases. Moreover, to study the performance of the algorithms at each threshold level, Figure 3 depicts the average of PSNR at each threshold level overall the ten images. From these average results, it can be noticed that SSA allocates the first rank at the two low threshold levels 6 and 8, followed by the proposed SSOSCA. Whereas at the higher threshold levels (i.e., 15, 17, 19, and 25) the proposed SSOSCA provides the best average, followed by SSA at levels 15, 17, and 19. At level 25, the WOA allocates the second rank. Moreover, Figure 4 shows the average of PSNR for each algorithm overall tested images and threshold levels, and we can see that the SSOSCA has the highest average of PSNR followed by SSA, while GOA, in this study, provides the worst PSNR value.  By analyzing the results of SSIM for each algorithm as given in Table 2, it can be observed that the segmented images using the obtained threshold values from the proposed SSOSCA are most similar to the original images. Therefore, the proposed SSOSCA has the highest SSIM at nearly forty-nine cases followed by WOA, SSA, and SSO in second, third, and fourth, respectively, with eight, two, and one case. The average of each algorithm at each threshold level is represented in Figure 5, and it can be seen that the SSOSCA provides the best average at all the tested threshold values. The WOA is the second best according to average of SSIM. Moreover, Figure 6 depicts the average overall the tested threshold and images; from this figure, we can conclude that the higher average of SSIM is achieved by the proposed SSOSCA followed by the WOA.
According to the fitness value obtained by each algorithm, as shown in Table 3, it can be seen that the proposed SSOSCA has higher Fuzzy entropy value in thirty-three cases, nearly 55% from the total cases. Where the GOA allocates the second rank in terms of the fitness value with twenty-seven cases (45% from the total cases). From Figure 7, we can notice the high performance of the SSOSCA reaches the high fitness value at each tested threshold level, while, from Figure 8, it can be seen that most of the algorithms are competitive according to the average of the fitness values overall tested images and threshold values; however, the proposed SSOSCA takes the first rank with nearly 28.94, followed by CS with 28.235.      To analyze the performance of the CPU time(s) according to the CPU time(s) as given in Table 4, one can observe that the proposed SSOSCA has the smallest CPU time(s) in twenty-one cases from the sixty cases, followed by GWO and WOA, which take the second and third ranks, while the SSO that achieves the fourth rank.  Figure 9 depicts the diversity of the proposed SSOSCA image segmentation approach at tested threshold levels for image I1. From this figure, it can be noticed that the SSOSCA maintains its diversity during the optimization while the diversity of other methods decreases with increasing iterations.

Statistical Analysis using Friedman's Test
In this section, we used the nonparameterize test, called Friedman test (FD), to study the robustness of the algorithms at the tested cases. The FD gives a statistical value that indicates the rank of the algorithm over all the tested algorithms, where a high rank refers to the best algorithm. The results of the obtained mean rank using FD is given in Table 5. It can be noticed that, in terms of PSNR, the SSOSCA has the highest mean rank among the three measures (i.e., fitness value, PSNR, and SSIM) while the SSA, CS, and GOA have the second best mean ranks in terms of PSNR, SSIM, and fitness value, respectively. Therefore, the threshold values obtained by SSOSSA is better than other algorithms, which enhances image segmentation. To sum up, the comparison results showed that the SSOSCA has a high ability to find the threshold value that will lead to improving the quality of the segmented images. This can be observed from the values of fitness value, PSNR, and SSIM of the proposed SSOSCA. The main reason for this high quality is that the SSOSCA combines the operators of SSO to exploration the search space as well as the operators of SCA, which have high exploitation ability. This can be shown from the diversity of the proposed SSOSCA. However, the proposed SSOSCA still needs some improvements since its computational time is larger than some other methods since the original SSO has high complexity.

Conclusions
This study proposes an alternative multi-level thresholding segmentation method using a new metaheuristic called spherical search optimizer (SSO) and Fuzzy entropy. The proposed method, called SSOSCA, depends on a modified SSO algorithm using the sine cosine algorithm (SCA). To test the performance of the SSO method, we implement two experiments. We used ten images from the Brekely benchmark. The evaluation outcomes assess the efficiency of the proposed SSOSCA for image segmentation. Moreover, we compared the proposed method to several metaheuristics, such as CS, GWO, WOA, SSA, GOA, and SSO. Overall, the results showed that the proposed SSO outperforms other methods in terms of fitness value, PSNR, and SSIM. Furthermore, by concluding the high performance of the SSO, in future work, it may be applied in several optimization problems, such as time series forecasting, cloud computing, feature selection, and others. However, the proposed SSOSCA has some shortcomings that result from the traditional SSO algorithm. For example, the CPU time(s) needs to be improved, and this can be improved by replacing some operators. Moreover, the diversity of the proposed SSOSCA at some images degrades when the algorithm approaches the end of the iterations. These limitations open new directions to improve the performance of the SSOSCA, and this can be achieved by using disrupt operators, which established its ability to balance between exploration and exploitation in search space. After fixing these shortcomings, the proposed model can be developed as a multi-objective method and can be applied to other applications.
Author Contributions: The authors contributed equally to this work. All authors have read and agreed to the published version of the manuscript.

Conflicts of Interest:
The authors declare no conflict of interest.