# From Classic to Cutting-Edge: A Near-Perfect Global Thresholding Approach with Machine Learning
## 2 Materials and Methods
### Proposed Solution
Three feature subsets were found to impact the results the most: 1--the 15 thresholds, 2--the moments (average, standard deviation, standardized moments from the third to the eighth), and 3--the BCs ([PERSON]'s bimodality coefficient and the next two generalized bimodality coefficients). Table 2 shows how these subsets were combined, and Table 3 compares the NCV results obtained with each subset and with the full set. The results found for the fourth, fifth, and seventh feature subsets are the best out of the seven and in line with the results of the experiments using all features, showing that the discarded features' contributions are insignificant. Subset 1 seems to be the most relevant, followed closely by subset 2; however, their combinations yield significantly better results. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \(\widehat{FM_{\mathbf{\gamma}}}\)(\%) & \(\widehat{MSE_{\text{FM}}}\)(\%) & \(\widehat{PSNR_{\mathbf{\gamma}}}\)(\%) & \(\widehat{MSE_{\text{PSNR}}}\)(\%) & \(\widehat{MSE_{\text{r}}}\)(\%) & \(\widehat{MSE_{\text{MSE}}}\)(\%) \\ \hline
90.86 & 7.99 & 81.64 & 11.08 & 62.32 & 22.01 \\ \hline
90.46 & 8.08 & 81.16 & 11.72 & 61.81 & 23.69 \\ \hline
90.56 & 8.43 & 81.11 & 11.18 & 61.70 & 23.86 \\ \hline
90.80 & 8.06 & 81.40 & 11.60 & 61.97 & 23.97 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: NCV results with full feature set. Table 4 compares the \(\overline{FM}\) and \(\overline{FM_{r}}\) for each thresholding algorithm and for the ideal threshold, with the results obtained by refitting the models obtained through NCV to the entire dataset. It should be noted that

\[\frac{\overline{FM}}{\overline{FM_{max}}}\
eq\overline{FM_{r}} \tag{36}\]

because even though

\[FM_{r}=\frac{FM}{FM_{max}} \tag{37}\]

averaging \(FM_{r}\) produces

\[\overline{FM_{r}}=\text{n}^{-1}{\sum FM_{r}}=\text{n}^{-1}{\sum\frac{FM}{FM_{ max}}} \tag{38}\]

and this is different from the average value of \(FM\)

\[\overline{FM}=\text{n}^{-1}{\sum FM} \tag{39}\]

because \(FM_{max}\) is not constant across different images. This is why, in Table 4,

\[\overline{FM_{r}}\
eq\frac{\overline{FM}}{\overline{FM_{1 deallT}}} \tag{40}\]

for any thresholding method other than the ideal one. The observation holds true for PSNR and MSE as well. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Feature Set** & **Thresholds** & **Moments** & **BCs** \\ \hline
1 & + & – & – \\ \hline
2 & – & + & – \\ \hline
3 & – & – & + \\ \hline
4 & + & + & – \\ \hline
5 & + & – & + \\ \hline
6 & – & + & + \\ \hline
7 & + & + & + \\ \hline \end{tabular} \(+\) indicates the presence of a subset and – indicates the absence of a subset.

\end{table} 
Table 2: Feature subsets. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Feature** & \(\widehat{FM_{r}}\) **(\%)** & \(\widehat{MSE_{FM}}\) **(\%)** & \(\widehat{PSNR_{r}}\) **(\%)** & \(\widehat{MSE_{PSNR}}\) **(\%)** & \(\widehat{MSE_{r}}\) **(\%)** & \(\widehat{MSE_{MSE}}\) **(\%)** \\ \hline
1 & 89.59 & 8.64 & 82.38 & 7.23 & 63.05 & 15.37 \\ \hline
2 & 84.15 & 8.00 & 74.79 & 12.52 & 50.50 & 24.45 \\ \hline
3 & 66.88 & 56.19 & 66.81 & 15.50 & 42.98 & 25.73 \\ \hline
4 & 90.31 & 6.93 & 81.58 & 10.35 & 62.28 & 21.18 \\ \hline
5 & 90.29 & 8.92 & 82.97 & 7.43 & 64.18 & 15.59 \\ \hline
6 & 86.42 & 8.13 & 77.71 & 15.28 & 54.90 & 27.43 \\ \hline
7 & 90.39 & 7.96 & 81.75 & 10.15 & 62.52 & 19.89 \\ \hline Full & 90.86 & 7.99 & 81.64 & 11.08 & 62.32 & 22.01 \\ \hline \end{tabular}
\end{table} 
Table 3: NCV result comparison. Table 5 shows the average processing time for an image with a known histogram expressed in milliseconds. The images have an average resolution of 3.31 megapixels. Image resolution does not affect processing times because the proposed solution operates linearly on the image histogram. It should be noted that all the times displayed in this paper were obtained on a machine with an Intel 14600 K processor running at up to 5.3 GHz. The application was built on Windows 11 targeting.NET 6.0.