Improved Degraded Document Image Binarization Using Median Filter for Background Estimation

In this paper, we propose a new binarization method suitable for images having a variety of sizes and degradation levels. It is mainly based on the idea of estimating a document background surface by new smoothing approach through a median filter and compute-Sharp-Peak to replace iterative polynomial. The resulting document image is then segmented by a global threshold binarization. The simulation results confirm that the performance of the proposed method is generally competitive to that of the existing methods. For highly degraded document images, specifically the documents in the BICKLEY DIARY data-base, the performance of the former is substantially better than that of the latter. We show how this approach outperforms the existing and widely used binarization methods in terms of accuracy, F-measure, PSNR, NRM, MPM, DRD, recall and precision. DOI: http://dx.doi.org/10.5755/j01.eie.24.3.20982


I. INTRODUCTION
Image binarization process is required as a preprocessing step in several image processing and analysis applications such as finding the region of interest (ROI) from an image, searching for image document in optical character recognition (OCR) operations and detecting moving objects in human gait recognition or target tracking.One of the advantages of using the binary images is to decrease the overall computational load in a specific application.The useful way to binarize an image is through thresholding and separating the background and foreground according to the pixel intensities.Precious historical documents, old manuscripts that are accumulated over time are generally stored in libraries and archives.However, the quality of these documents is significantly degraded due to many environmental factors such as warmth, humidity, dust, mishandling and poor paper quality.Today, the development in the field of digital processing specifically document image binarization, which is the most efficient operation to Manuscript received 22 July, 2017; accepted 14 January, 2018.eliminate the effects of the environmental factors on old document images.Some of these effects are faded ink, bleed-through, show-through, uneven illumination, variations in image contrast [1], [2].A large number of document image binarization techniques [3] based on different approaches have been proposed in the literature to solve the old document image binarization problems mentioned above.Almost all the existing binarization techniques are complex and compounded from filters and signal processing operations [4].Sezgin and Sankur [5] classified the image binarization methods in six categories.The image thresholding is one of the most popular approaches.It is usually performed in two ways: the global and local thresholding algorithms [6], one optimal threshold value is computed to segment the entire image into two classes background and foreground using a global measurement, whereas those the local thresholding is to localize the study around the pixel or on the block after dividing the image into sub-blocks to determine the threshold values, which are then used to separate the image into foreground and background.Some adaptive thresholding methods have been reported in [7], [8] that make use of the document-specific domain knowledge.The methods proposed by Gatos et al. [9], Moghaddam et al. [10], and Shijian et al. [11] are based on the estimation of the background of the document image using a binary image generated by Sauvola method [12], an adaptive and iterative image averaging procedure, and an iterative polynomial smoothing, respectively.
All the above methods have similar binarization results in the case of noiseless document images.The problem arises in the case of noisy document images, specifically when the noise sources are not of the same type.In these circumstances, most of the existing techniques do not give acceptable binarization results.In this paper, we develop a new binarization method, which is efficient for different images having a variety of sizes and degradation levels.The proposed method is based firstly on detection of the type of old document image, secondary estimation and compensation of background.Finally, the document image is segmented by a global threshold.The rest of this paper is organized as follows: first presents the proposed document binarization method in detail in Section II.Secondary Experimental results and discussed in Section III.Finally, a conclusion is given in the last section.

II. PROPOSED METHOD
The methods reported in [13]- [17] use the median filter with small windows (3 × 3 or 5 × 5) for the post treatment to improve the results of old document image binarization.In the proposed method, we use the median filter for the treatment, where its window size is chosen intelligently according to the type of noisy or noiseless old document image.The proposed method can be considered as a new smoothing approach for the estimation and compensation of the old document image background according to the following steps:  Processing window size adjustment for the background area estimation. Background estimation by an iterative calculation of the median neighbours. Contrast compensation. Global threshold estimation. Post treatment for removing isolated pixels.
The above steps are detailed in the following:

A. Decision by Sharp-Peak
In this step, we use the sharp-peak algorithm to calculate the number of peaks "Nbr_Peak" in the histogram of the image in order to define the type of the image to be processed and therefore, set the dimensions of the processing window.If the number of peaks is less than or equal to 2, then the image is considered noiseless, otherwise it is noisy.This decision is inspired from the work in [3].

B. Background Estimation
The background estimation by the polynomial smoothing method has been used in several works for different applications.Krzysztof et al. [18] have used it for the processing of fingerprint images, whereas in the work of Seeger et al. [19], it has been used for the pre-detection of text regions.In the proposed method, we estimate the document background by introducing a new technique of smoothing based on an iterative calculation of the median.This new approach provides a good background estimation, which essentially depends on the choice of the processing window size.It should be noted that a similar method but not intelligent, using the same notions, has been used for filtering operations in the work [13]- [17].The median filter is a nonlinear method proceeds by moving through all the pixels of the image F characterized by a gray level f(x,y), where the neighbor V(x0,y0) of the pixel f(x,y) is called "window", which slides pixel by pixel the entire image.This window comprises N odd pixels with coordinates (x0-u, y0v).The median is calculated by first sorting all the grey level values of the pixels from the window centred in pixel f(x0,y0) into numerical order followed by a selection of the middle element of the sort.The ordered elements being denoted f(i) and the ascending sort is characterized by ... .
The filtering consists of replacing the value of the pixel f(x0,y0) by fmedian(x0,y0), which is the median value of its neighbour that is calculated by the following equation where N -the number of elements of the window " ", w fN - the intensity of a pixel of the window " ". w To justify the choice of the used processing window sizes, we refer to the work in [20]- [22] in which the used window size is between 10 pixels and 100 pixels.Gatos et al. [9] suggested a window size of 60 × 60 in order to cover 1-2 characters.However, detecting the size of a character usually requires image segmentation [23] and this is difficult for degraded documents.The window size value is a very important parameter [24], which has a strong influence on obtaining good binarization results.Moghaddam and Cheriet [1] proposed a method, which starts with a large window size and iteratively reduces it to a proper window size.Our method uses the information provided by the sharp-Peak algorithm reported in [3] to automatically decide on the type of the image and hence, based on the experimental observations, we fix the window size to 40 × 40 and 100 × 100 pixels for noisy and noiseless images, respectively.Figure 1(d) shows the effect resulting from the estimation of the background by the proposed method applied to the image in Fig. 1(a) that contains text transparency.Compared to the polynomial smoothing-based method of Shijian Lu et al. [11], we notice that the resulting image in Fig. 1(c) is uniform, contrary to the proposed method in which the resulting image is not uniform in textside area.Thus, the proposed method can directly provide a better estimation result of these areas.However, the polynomial smoothing-based method [11] is performed in several doubled iterations (line/line and column/column).

C. Contrast Compensation
When the image contains anchor spots or text areas with a dark background as shown in Fig. 2(a) in yellow squares, or even uneven lighting of the background that degrades the result of binarization, then the estimation of the background in Fig. 2(b) will be used for compensation of the document contrast.By applying (3), we note that the dark areas becomes clear and the text can be clearly distinguished from the background as highlighted by a red square in the result of Fig. 2(c

D. Binarization
In this step, the result of the background estimated by the proposed method contains most of the background pixels separated from the foreground.Therefore, we proceed to the binarization by a global thresholding method, because it can offer a good result in the case when the foreground of a document image can clearly be distinguished from the background.Global thresholding consists of computing an optimal threshold from a global measurement over the entire image.We adopt here Otsu's method [25].This method provides an optimal threshold calculated from maximizing the between-class variance uses it to separate the greylevel image two classes foreground and background.
Finally, the post-processing step is generally useful and consists of eliminating the separated and isolated black or white pixels by the expansion and erosion.

III. EXPERIMENTAL RESULTS AND DISCUSSION
To validate the effectiveness of the proposed method and especially its impact on highly degraded images that have suffered different types of degradation, we have not only experimented the method on two groups of images "Handwritten & Printed" belonging to different databases on DIBCO in [26]- [28], but also on the database BICKLEY DIARY [29] known for its highly deteriorating document images.We also compared the performance of the proposed method with that of the conventional binarization methods, recent methods of the state-of-the-art and the top ranking algorithms in each competition of DIBCO.The comparison and test are performed in terms of F-measure, PSNR, NRM, MPM, DRD and precision.

A. Test on DIBCO Datasetsries
In this experiment, we compare our method with existing methods such as Gatos et al.'s method [9], BE's method [11], Otsu's method [25], Sauvola's method [12], Niblack's method [30], Bernsen's method [31] and other methods ranked first in ICDAR [26]- [28].The corresponding DIBCO datasets of these conferences are DIBCO2009, DIBCO2011 and DIBCO2013, respectively.These three datasets contains 10, 16 and 16 degraded images, respectively.Each dataset is equally classified into two categories, handwritten and printed images.In addition to these 42 images, the datasets contains a reference image for each degraded image.Table I shows the experimental comparison of different methods for the case of the DIBCO2009 dataset [26].It is clear from this table that the proposed method outperforms all the existing methods in terms of F-measure and PSNR, and presents a performance very close to that of the exiting best methods in terms of NRP and MPM. Figure 3 shows the binarization results obtained by different methods for an image from the DIBCO2009 dataset [26].Otsu's method; c) Sauvola's method; d) Niblack's method; e) Bernsen's method; f) Gatos's method; g) BE's method; h) our proposed method; i) reference image.
Table II shows the experimental comparison of different methods for the case of the DIBCO2011 dataset [27].The comparison includes also the results of three other algorithms that have been ranked first in ICDAR2011 [27].The first presented by Lelore et al. [32], the second presented by B. Su et al. [33] and the third presented by Howe [34].It is clear from this table that the proposed method is the most effective in terms of DRD and MPM, which means that our method generates good text edges and provides better visual quality, and presents a performance very close to that of the exiting best methods in terms of Fmeasure and PSNR. Figure 4 shows the binarization results obtained by different methods for an image from the DIBCO2009 dataset [26].
Figure 5 and Fig. 6 show the binarization results obtained by different methods for two images from the DIBCO2013 dataset [28].We note that the methods of Otsu [25], Sauvola [12], Niblack [30] and Bernsen [32] fail to provide acceptable results.In addition, most of the methods, including 1 st and 2 nd rank methods in ICDAR2013 [28] induce noise in the final results as shown in Fig. 5.It is clear from Fig. 6 that the proposed method provides a binary result with better visual quality, which contains most of the text information.However, the methods of Otsu [25], Sauvola [12], Niblack [30] and Bernsen [31] and the first ranked five methods in ICDAR2013 [28] provide binary results with poor visual quality.4. Results of binarization by deferent methods: a) original image; b) Otsu's method; c) Sauvola's method; d) Niblack's method; e) Bernsen's method; f) Gatos's method; g) BE's method; h) Lelore's method; i) SNUS's method; j) Howe's method; k) our proposed method; l) reference image.
By performing a little analysis, we conclude that our method is more concurrent compared to recently proposed methods such as those of Bolan Su et al. [11] and [33], Howe [35] and Reza Farrahi Moghaddam et al. [36].In addition to its easy implementation, it has some parameters that can be estimated automatically from the statistics of the image, which makes the proposed method very useful for heavily degraded images.The advantages of our method can be explained through several factors.First of all, the proposed method estimates the background and then uses it for compensating the contrast of the image.This helps enormously the elimination of the background variations to avoid the recovery of noise in the image as it has been shown in the above results.Secondly, the proposed method can extract the text of the foreground from the document image with high precision even in the case of the degraded images.

B. Test on BICKLEY DIARY Dataset
To further promote our method and its effectiveness in highly degraded document images, we make the test on BICKLEY DIARY [29] dataset that contains a set of highly degraded document images suffering from different types of degradation, such as water stains and transparent ink.Hence, BICKLEY DIARY dataset [29] is more difficult than the DIBCO dataset from the binarization point of view.In order to compare our method with the methods recently reported in [8], [9], [11], [33], we take a set of seven degraded images and their corresponding reference images that are manually annotated using Pix Labeler [37].The results of the detailed assessments are shown in Table IV and Fig. 7.It is seen from this table that our method provides an Fmeasure higher than those of all the considered existing methods and a comparable performance in terms of PSNR, NRM and MPM.It can also be seen from Fig. 7 that the binarization result obtained by the proposed method is better than those obtained by most of the existing methods.

IV. CONCLUSIONS
In this paper, we have developed a new binarization method based on four consecutive steps: (i) proposition of a rapid method to determine the type of old document image been studied, (ii) estimation and compensation of the background by a new approach, which uses the median filter, (iii) segmentation of the resulting document image by a global threshold binarization and (iiii) post treatment for removing isolated pixels to improve the final image binarization.
We have shown that the proposed method is efficient for different images having a variety of sizes and degradation levels.It has been tested on various datasets covering numerous types of degradation, namely DIBCO2009, DIBCO2011, DIBCO2013 and BICKLEY DIARY.The experimental results confirm that the performance of the proposed method is generally competitive to that of the existing methods.For highly degraded document images, specifically when the document image contains anchor spots or text areas with a dark background and the documents image in the BICKLEY DIARY database, the performance of the former is substantially better than that of the latter.

1 .
Original image (a); the background estimation through the row-byrow polynomial smoothing[30] (b); the final background estimation through the column-by-column polynomial smoothing[30] (c); the background estimation through the proposed method (d).
a constant which controls the brightness of the compensated background document that will be calculated by the median of the original image, IbG -the image of estimation of the background, I the original image.So the variation of the original background image will be compensated by the factor , bG C I which will be higher in the darker area of the document (low value of IbG in this area) and conversely in bright area, it will be low (high value of IbG).

Fig. 2 .
Contrast compensation: a) original image; b) the background estimation through the proposed method; c) compensated image.

TABLE I .
EXPERIMENTAL RESULTS FOR THE CASE OF DIBCO2009.

TABLE II .
EXPERIMENTAL RESULTS FOR THE CASE OF DIBCO 2011.