# Gaslike Social Motility: Optimization Algorithm with Application in Image Thresholding Segmentation
## 4 GSM Algorithm Application to Threshold Segmentation  
This section introduces the concepts of image segmentation and minimum cross entropy (MCE). In computer vision and pattern recognition, image segmentation is a critical preprocessing step that plays a vital role in obtaining a clear representation of an image and extracting essential information for subsequent analysis [17]. Image segmentation involves dividing a digital image into meaningful regions based on specific characteristics, such as gray values, texture, or edge details. Numerous algorithms and methods have been developed for image segmentation, which can be broadly classified into four categories: clustering-based methods, histogram thresholding-based methods, and region splitting and merging-based methods. Among these, histogram thresholding is widely used due to its efficiency and adaptability across various scenarios. Histogram thresholding utilizes the gray-level histogram of an image to determine threshold values that separate the image into distinct classes. For example, to divide an image into two classes, a single threshold value is required, a process known as bilevel thresholding (BTH). When more than two  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline
**GSM vs** & **PSO** & **DE** & **BA** & **ABC** & **AHA** & **CBO** & **ECBO** & **AHA-AO** & **SNS** \\ \hline \(\alpha\) & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 & 0.05 \\ \hline \(T+\) & 253 & 235 & 246 & 253 & 199 & 229 & 253 & 205 & 229 \\ \hline \(T-\) & 0 & 18 & 7 & 0 & 54 & 24 & 0 & 48 & 24 \\ \hline \(H_{0}\) & rejected & rejected & rejected & rejected & rejected & rejected & rejected & rejected \\ \hline \end{tabular}
\end{table}
Table 8: Wilcoxon signed-rank test results.  
classes are needed, multilevel thresholding (MTH) is employed. In BTH, the threshold value is selected based on the following rule:  
\[\begin{split} C_{1}\gets if\,0\,\leq\,p<th\\ C_{2}\gets if\,th\,\leq\,p<L-1\end{split} \tag{5}\]  
where, \(p\) represents a pixel in grayscale from the matrix \(I_{g}\), which has dimensions \(m\times n\). The grayscale levels are defined as \(L=\{0,1,2,\ldots,L-1\}\). The pixel \(p\) can be classified into one of two classes, \(C_{1}\) or \(C_{2}\), based on the threshold value \(th\). Equation (5) can be extended to multilevel thresholding, as shown in Equation (6).  
\[\begin{split} C_{1}\leftarrow if\,0\,\leq\,p<th\\ C_{2}\gets if\,th1\,\leq p<th2\\ C_{i}\gets if\,th2\,\leq p<thi+1\\ C_{n}\gets if\,thn\,\leq p<L-1\end{split} \tag{6}\]  
Consider Equation (6), where \(\{th_{1},th_{2},\ldots,th_{i+1},\ldots,th_{n}\}\) represents the set of thresholds. Threshold-based segmentation methods can be categorized into two types: parametric and nonparametric. Nonparametric methods determine thresholds using discriminators such as entropy, interclass variance, or error rate. In contrast, parametric methods estimate thresholds by modeling the gray-level distribution of each category using a probability density function (PDF). This paper adopts entropy as the discriminator criterion for identifying optimal thresholds.