# From Classic to Cutting-Edge: A Near-Perfect Global Thresholding Approach with Machine Learning
## 1 Introduction
### Classical Approaches  
Classical approaches can be split into two categories, in terms of how they operate on the image histogram space, linear and non-linear solutions. While the linear methods are straightforward and efficient, they require further exploration in our context; thus, we have opted not to implement them yet. They could be added to the features in future work without changing the time complexity of the solution. On the other hand, non-linear approaches, while potentially more powerful in handling complex relationships, introduce significant complexity. Given this trade-off, we chose not to pursue these methods either, prioritizing simplicity and computation time in our current implementation.  
[PERSON] and [PERSON] [2] define the optimal threshold as the one that maximizes the objective function of the one-dimensional Tsallis entropy correlation single-threshold method:  
\[S_{q}(t)=\frac{1}{q-1}\bigg{(}2-\sum_{i=0}^{t}\bigg{(}\frac{h(i)}{c(t)}\bigg{)} ^{q}-\sum_{i=t+1}^{t}\bigg{(}\frac{h(i)}{1-c(t)}\bigg{)}^{q}, \tag{1}\]  
where \(q\) is a real number whose value can be experimented with.  
[PERSON] and [PERSON] [3] separate the image histogram into three regions: \(\alpha\) between \(\mu-\sigma\) and \(\mu+\sigma\), \(\beta_{L}\) between \(0\) and \(\mu-\sigma\), and \(\beta_{H}\) between \(\mu+\sigma\) and \(I_{max}\), where \(\mu\) is the average pixel value and \(\sigma\) is the standard deviation. Then, they compute \(\mu_{\alpha}=\sum_{x\in\alpha}ip(i)\) and \(\mu_{\beta}=\sum_{x\in\beta}ip(i)\) where \(\beta=\beta_{L}\cup\beta_{H}\). They define the optimum thresh old as \(T_{opt}=\left(\mu_{a}+\mu_{\beta}\right)/2\). They compared their algorithm to several PDE-based ones, such as [PERSON] and [PERSON] [4], [PERSON] et al. [5], and [PERSON] et al. [6].  
[PERSON] and [PERSON] [7] compute two threshold candidates using a fuzzy inclusion indicator based on [PERSON]'s fuzzy implication and the following fuzzy entropy formula:  
\[E_{1}=2\frac{\sum_{x\in X}\min\left(m_{A^{C}}(x),m_{A}(x)\right)}{\sum_{x\in X }\max\left(m_{A^{C}}(x),m_{A}(x)\right)}, \tag{2}\]  
where \(X\) is the set of pixels in the image; \(m_{A}(x)\) is the membership grade of \(x\) in the fuzzy subset \(A\); and \(A^{C}\) is the complementary subset of \(A\). Then, they compute a classification function and choose one of the two candidates based on a criterion.  
[PERSON] [8] proposed a multilevel thresholding algorithm that can be extended to implement image binarization. It is based on computing the mean pixel intensity for the entire image \(\mu\), generating a gradient image \(I_{g}\) by computing the intensity difference between the original image and \(\mu\), and computing the mean gradient pixel \(\mu_{g}\). They choose the following threshold:  
\[\mathrm{T}=\left\{\begin{aligned} \mu-\mu_{g},if\sum_{i=\mu-\mu_{g}}^{ \mu}h(i)<\sum_{i=\mu}^{\mu+\mu_{g}}h(i)\\ \mu+\mu_{g},\ \ \ otherwise\end{aligned}\right.. \tag{3}\]  
[PERSON] et al. [9] proposed a longer algorithm that starts by computing the Laplacian of the image and subtracting the Laplacian from the image. Then, they slide a \(5\times 5\) window on the image and compute its average value in each position, resulting in an average image \(I_{agg}\). The threshold \(T\) is selected as  
\[T=\max\left(I_{agg}\right)+\mathrm{median}\left(\min_{on\text{ }ach\text{ } column}\left(I_{agg}\right)\right). \tag{4}\]