# From Classic to Cutting-Edge: A Near-Perfect Global Thresholding Approach with Machine Learning
## 1 Introduction  
Image binarization is the process of converting an image with varying pixel intensities into one with only two: black and white. The simplest way of doing this is by choosing a threshold intensity and converting every pixel with a lower intensity to a black pixel in the binarized image and every pixel with a higher intensity to a white pixel. This is called global threshold image binarization. Choosing different thresholds for different pixels based on their neighborhoods is called local threshold image binarization.  
A popular use case for image binarization is the preprocessing of document scans in preparation for digitization. For this use case, several datasets are available, containing low-quality images of documents and corresponding ground-truth images that have black pixels where there was text in the original image and white pixels everywhere else. The quality of the binarized image can be measured using objective metrics by comparing the binarized image to the ground-truth image.  
Global algorithms operate in the image histogram domain, resulting in a complexity based on the number of pixel intensities in the image, whereas local algorithms operate on each pixel for a complexity based on the number of pixels in the image, which is always much larger than the number of pixel intensities. Generally, global algorithms are much faster than local ones but yield lower-quality results on low-quality images owing to uneven lighting, noise, etc. The faster processing time and lower complexity are ideal for real-time or resource-constrained applications, such as embedded systems. For any given image, the maximum possible binarization quality achievable through global thresholding is not necessarily the highest possible binarization quality. Local thresholding algorithms have no such limitations; however, their computational cost is higher, and they only consider features from surrounding pixels, making them prone to specific failures.  
Global thresholding algorithms provide varying results based on the type of noise and lighting in an image. Non-uniform lighting can be mitigated by applying global algorithms to image patches, such as the patch-based methods presented by [PERSON] et al. [1], resulting in a mixed global-local approach.  
We propose a machine learning model whose novelty lies in employing various thresholds produced by classical global thresholding algorithms as input features alongside other global image features to produce results as close as possible to the highest possible quality achievable through global thresholding.  
The proposed solution is described in detail in Section 2. Evaluation metrics that allow comparison of the performance of global thresholding on different images are defined, and the methodology for evaluating the tested algorithms and employed datasets is laid out.  
Section 3 presents the results of the proposed solution and compares them with the classic global thresholding algorithms used as features and the best possible global threshold. The proposed solution outperformed the other algorithms and achieved results very close to the ideal threshold, with a promising confidence interval.  
Section 4 presents a discussion based on the presented results and visual examples, followed by conclusions and possible avenues for future work in Section 5.  
In the Following Subsections, Previous Works Are Presented and Divided into Classical and Deep-Learning-Based Approaches.