Abstract
In this paper we present a fully trainable binarization solution for degraded document images. Unlike previous attempts that often used simple features with a series of pre- and post-processing, our solution encodes all heuristics about whether or not a pixel is foreground text into a high-dimensional feature vector and learns a more complicated decision function. In particular, we prepare features of three types: 1) existing features for binarization such as intensity, contrast, and Laplacian; 2) reformulated features from existing binarization decision functions; and 3) our newly developed features, namely the Logarithm Intensity Percentile (LIP) and the Relative Darkness Index (RDI). Our initial experimental results show that using only selected samples (about 1.5% of all available training data), we can achieve a binarization performance comparable to those fine-tuned (typically by hand), state-of-the-art methods. Additionally, the trained document binarization classifier shows good generalization capabilities on out-of-domain data.
Introduction
Document binarization—the process of converting color or grayscale images into clean black-and-white representations—is a critical first step for Optical Character Recognition (OCR). While seemingly straightforward, historical documents often suffer from significant degradation, including ink blobs, fading text, bleed-through from the reverse side of the page, and uneven lighting. Traditional methods, such as the Otsu or Sauvola algorithms, rely on unsupervised local thresholding and often require manual parameter tuning to adapt to specific document types. This paper proposes a shift toward a fully trainable supervised learning framework that leverages high-dimensional features to automate and improve this process.
Methodology
The proposed solution utilizes an ExtraTrees (Extremely Randomized Trees) classifier, chosen for its ability to handle high-dimensional data and its robustness against overfitting. The methodology is built on three pillars:
- High-Dimensional Feature Engineering: The model utilizes a 142-dimensional feature vector for each pixel. This includes standard intensity and contrast features, reformulated versions of classic heuristics (like Niblack and Sauvola), and novel descriptors such as the Logarithm Intensity Percentile (LIP) and the Relative Darkness Index (RDI).
- Two-Pass Training Strategy: To manage the computational burden of processing millions of pixels, a two-pass approach is employed. A simple Naive Bayes classifier first filters 'easy' pixels, allowing the more complex ExtraTrees model to focus on 'hard' pixels near text boundaries or within degraded regions.
- Subclass Balancing: To address class imbalance (where background pixels vastly outnumber text pixels), the authors categorized pixels into 16 subclasses based on local properties. By training on a balanced subset of only 1.5% of the total available pixels (approximately 19,200 samples per image), the model achieves high efficiency without sacrificing accuracy.
Key Insights and Innovations
A central innovation of this work is the treatment of existing heuristics as features rather than standalone algorithms. By including reformulated versions of classic decision functions, the classifier learns the optimal conditions under which to apply specific heuristics. Furthermore, the introduction of the Relative Darkness Index (RDI), based on Local Ternary Patterns, provides a powerful tool for distinguishing text edges from homogeneous background noise or paper texture. This allows the model to maintain strong "out-of-domain" performance on modern documents it has never seen before, such as receipts or signs.
Experimental Results and Qualitative Analysis
The model was evaluated using the DIBCO (Document Image Binarization Contest) datasets from 2009 to 2014, comprising 76 challenging images. Performance was measured using standard metrics: F1-score, Peak Signal-to-Noise Ratio (PSNR), and Distance Reciprocal Distortion (DRD). The proposed method consistently ranked among the top performers, often exceeding the results of contest-winning, hand-tuned algorithms in DRD scores.
Qualitatively, the model excels at recovering faded text and ignoring 'ghost' artifacts caused by bleed-through or stains that typically cause traditional thresholding methods to fail.
As shown in the figures above, the model maintains high visual fidelity even in the presence of severe degradation. The DRD scores remained consistently low (below 3 pixels), indicating minimal distortion in the binarized output compared to the ground truth.
Conclusion and Future Work
This research demonstrates that a supervised learning approach, combined with sophisticated feature engineering and smart data sampling, can outperform traditional hand-tuned binarization methods. While the current implementation is computationally intensive—taking between 5 and 30 seconds per image due to the 142-dimensional feature calculation—future work will focus on optimizing speed and incorporating global context through image moments. Additionally, the authors aim to explore 'on-the-fly' adaptation, allowing the model to fine-tune its parameters for specific document collections during processing.
Summary updated