Adaptive Binarization Method for Enhancing Ancient Malay Manuscript ...

6 downloads 176 Views 950KB Size Report
Abstract. In order to transform ancient Malay manuscript images to be cleaner and more readable, enhancement must be performed as the images have differ-.
Adaptive Binarization Method for Enhancing Ancient Malay Manuscript Images Sitti Rachmawati Yahya1, Siti Norul Huda Sheikh Abdullah1, Khairuddin Omar1, and Choong-Yeun Liong2 1

Center for Artificial Intelligence Technology, Faculty of Information Science and Technology, Universiti Kebangsaan Malaysia, 43600 UKM Bangi, Selangor, Malaysia [email protected], {mimi,ko}@ftsm.ukm.my 2 School of Mathematical Sciences, Faculty of Science and Technology, Universiti Kebangsaan Malaysia, 43600 UKM Bangi, Selangor, Malaysia [email protected]

Abstract. In order to transform ancient Malay manuscript images to be cleaner and more readable, enhancement must be performed as the images have different qualities due to uneven background, ink bleed, or ink bleed and expansion of spots. The proposed method for image improvement in this experiment consists of several stages, which are Local Adaptive Equalization, Image Intensity Values, K-Means Clustering, Adaptive Thresholding, and Median Filtering. The proposed method produces an adaptive binarization image. We tested the proposed method on eleven ancient Malay manuscript images. The proposed method has the smallest average value of Relative Foreground Area Error compared to the other state of the art methods. At the same time, the proposed method have produced the better results and better readability compared to the other methods. Keywords: Local Adaptive Equalization, Image Intensity Values, K-Means Clustering, Automatic Threshold, Median Filtering.

1

Introduction

Many researchers have successfully implemented image enhancement techniques for cleaning and separating background from the foreground in manuscripts or documents with a history of degraded or poor quality. A combination method is proposed to improve degraded images of the documents involving direct information of the detected edge images [1]. In line with that, a general threshold value can also separate the background and foreground on a shadow image [2, 3]. On the other hand, separation between foreground and background on carbon copied medical forms is done using the wave trajectory method [4]. Later, multiple threshold levels have been introduced to separate the text from the background by [5]. Besides that, an adaptive thresholding method based on adaptive window generation is used to separate textual content from the background in old Arabic documents [6]. This method begins with D. Wang and M. Reynolds (Eds.): AI 2011, LNAI 7106, pp. 619–627, 2011. © Springer-Verlag Berlin Heidelberg 2011

620

S.R. Yahya et al.

text normalization and then separates the background using a 3 × 3 kernel which is used in the reading of the text block. They use edge direction matrixes and combination of projection profile to perform binarization of images. Objective of this paper is to propose enhancement steps to overcome extreme major ink bleed surrounding textual manuscript images. This paper is divided into five sections. Section 1 introduces the background of the proposed method, including the researchers who had previously studied the expansion of the image, amendment of the threshold value, and adjustment in the binary image of the manuscript. Section 2 deals with the current methods which are the basis to this new proposed method. Section 3 explains the proposed method. Section 4 presents the results and discussion on the proposed research, while the last section presents the conclusions of this research.

2

State of the Art

Several methods proposed by previous researchers have been used as the basis of this experiment, which are: - Niblack’s Method [7]: The Niblack’s Method is a simple and efficient method for adaptive thresholding. Niblack’s Method can read the region of the image on a field that has less quality level. The local threshold used on the Niblack’s method is set as follows: (1) where is local threshold, calculated over a local

and are a local mean and standard deviation which window, w is the parameter to kernel window size.

– Nick’s Method [8]: This method is proposed by Khurshid et al. [8]. The Nick’s method was developed from the Niblack’s method. It tried to solve low contrast problem by shifting down the thresholding value. The thresholding formula is as following: ∑

,

(2)

where k is a control factor in the range of [–0.1, –0.2], Pi = the image pixel grey-scale value and NP = the total number of pixels in the image. The author suggested the k = –0.1 [7]. Kefali et al. [9] claimed that Nick’s method gave the best performance compared to previous methods. However, problems of low contrast images still remained unsolved. - Bataineh’s Method [6]: This method suggests an adaptive threshold for lowcontrast images and thin pen stroke problems. At first, the method only includes adaptive thresholding equation [10], then they extend the method [6] uses adaptive window generation and adaptive thresholding value towards repairing the image contrast based on global and local image information.

Adaptive Binarization Method for Enhancing Ancient Malay Manuscript Images

621

(3) (4) where, T is the thresholding value, mW is the mean value of the window’s pixels, σW is the standard deviation of the window’s pixels, mg is the mean value of all pixels in the image and σAdaptive is the adaptive standard deviation of the window. Based on this values, the binarization process is defined as follows: , ,

, where I (x, y) is the binary image and

,

,

,

(5)

is the input pixel value of the image.

Alternatively, Bousellaa et al. [11] use iterative segmentation estimation approach to enhance Tunisian degraded manuscript images in Y channel. They perform iterative estimation by using Expectation Maximum (EM). They have also extended the EM by introducing maximum likelihood to approximate the probability that falls into either text or background classes. Niblack’s method produces images with characters of better shape but the thresholding value is not appropriate because the image is darker. The Nick’s method almost produces good image, but the shape for images with ink-bleed expands-spots images is not so obvious and several results has lots of black regions. Bataineh’s image is almost the same as the Nick's method, but Bataineh’s method could further boost the image for more obvious characters shape for the low quality image. However, the results is also not clear for image that has damage around the characters. All the methods above have been tested on different types of document image quality such multi-color image consisting different size fonts, spotted, low and very low-quality image, non-uniform illumination including thin pen stroke problems based on the DIBCO 2009 and 2011 benchmark image datasets. However, this dataset neglect document image that contains extremely major ink bleed around the textual information. This problem is found to be a major issue in preserving ancient Jawi-Malay handwritten manuscript in the Malaysian National Library. Figure 1 shows some examples of images of old Jawi-Malay Manuscript which have different levels of image quality. In respond to the vital need from the Jawi manuscript reader community, we explore methods to overcome the above mentioned problems.

Fig. 1. Several examples of images of old Jawi-Malay manuscripts that have phases of different qualities that were used in this experiment. From the left: uneven background, ink bleed and ink bleed-expands spots images.

622

3

S.R. Yahya et al.

The Proposed Method

The Jawi-Malay manuscript images used in this research focus on the problem of ink bleed around the Jawi handwriting although there are some dirt or stain outside the Jawi handwriting. To solve these problems, we propose a method of binary adaptation to improve and enhance the quality of old Jawi Manuscript images. The method is illustrated in Figure 2 below: Local Adaptive E qualization

Image C aptur ed

Ancient Malay M anuscr ipt Images

Image I ntensity Values

Grayscale Image

K--Means C luster ing

Median F ilter ing

Result

Adaptive T hr esholding

Automatic Threshold

B/W Image

Fig. 2. The proposed flowcharts of adaptive binarization of ancient Malay manuscript images

Our proposed method are made up of the following steps: Local Adaptive Equalization (LAE) and image intensity values (IIV) process, K-Means Clustering to determine the automatic threshold, Adaptive Thresholding, and finally Median Filtering. Firstly, we improve and enhance the quality of the ancient images of Jawi-Malay Manuscripts using the LAE as follows: ,

=

,

,

(6) (7)

where is the result of image transformation while is the input image, , , R is the coefficient as defined in Equation (7) with k = 0.8, m and σ are the mean and are the mean and standard deviation values of a fixed window subsequently, M is the average of the original image, and c is a constant. In this experiment, we apply 31 31 window size as proposed by Niblack [7]. Next, we perform Image Intensity Values (IIV) process as below: ,

,

(8)

where the value of α = 0.1, and are the maximum and minimum values of , which are the resulting images of the LAE process. Consequently, pixels in , the IIV process helps to reduce apparent background noise. However, this step is still insufficient for smaller noise or shadow noise.

Adaptive Binarization Method for Enhancing Ancient Malay Manuscript Images

623

In order to decide either a pixel belongs to the foreground or the background, we use K-Means Clustering technique as one of the steps. Then, we separate the shadow around the characters by proposing an adaptive threshold process to all clustering pixels. This proposed method, an extension to [12] and [13], searches for the adaptive threshold value based on a bi-level histogram. In [12], the threshold value searching is carried out by determining the balance point of the uncertain threshold value, then balancing it with weights closes to the uncertain threshold point until the actual threshold value is found. We apply histogram graph by using Gaussian Windows to obtain smoother line graph before calculating the two highest peak values. We summarize the proposed automatic thresholding process as Algorithm 1 and the process is illustrated in Figure 3: Algorithm 1. Proposed automatic thresholding process. BEGIN Let f = Image histogram , P = First highest peak (background image), P = Second highest peak (foreground image), C = The cluster of i, _ = Minimum grey level of I, = Number of pixel of i, and = The step to next grey level; DIVIDE grey level to 5 clusters (C );{Each cluster = 50 pixels number} DETECT which cluster belongs to P ; IF P C max THEN r = IF P THEN

r r =

C

C

; C

;

W = [P : r ]; Val_t = minimal grey level value in W ; IF W Val_t ELSE W = Val_t ENDIF ENDIF ENDIF

= [1: r ]; = minimum grey level value in W ; [C max: r ]; = minimum grey level value in W ;

_ < 100 THEN = tmp -1; _ ( ) = ( ELSE thresh = _ ; ENDIF

IF

IF

_

(

) -

_

;

) < 100

= tmp -1; THEN _ ( ) = _ ELSE thresh = _ ; ENDIF

(

) -

_

;

624

S.R. Yahya et al.

where r dan r are the range for the first and second cluster subsequently, C _max and C _max are the maximum gray level values of the first and second cluster in order, W2 , W3, W4 are the range limit set for r and r , p and p are the first and second peak values in the histogram bi level correspondingly, and f is the histogram of the relevant image. Lastly, Val_t, Val_t1, Val_t2 are minimum limit values surrounding to a maximum value of the second peak.

P1

th r esh = 16

Foreground Pixel

th r esh = 16

np (tmp)

P2

Va l_ti

Fig. 3. The graph shows the distribution of the existing 5 groups (clusters) and the table on the right is to clarify the limits of pixel gray level to obtain the automatic threshold. Number 16 is an automatic threshold (thresh) value and it was taken from the total number of pixel-based gray level value of the second peak.

Next, we accomplish final step in adaptive threshold process as below: 1, 0,

,

,

(9)

is an output image after performing adaptive binarization, is an where , , image result after applying K-Means clustering, and thresh is automatic threshold value based on bi-level histogram. ,

,

2

,

(10)

where M is an average value of the variable . ,

,

(11)

,

where is an output image of after applying median filter with a 20 20 , , 20 20 window size, and is a constant with value of 0.03. In order to remove unwanted noise, we reapply median filtering with a 3 3 kernel size onto image. ,

where

,

,

,

,

is a sum product image of Median filtering process of image, g

(12) ,

.

Adaptive Binarization Method M for Enhancing Ancient Malay Manuscript Images

4

625

The Experimenttal Results and Discussion

In this experiment, eleven ancient Hang Tuah Malay Manuscript images which w were N Library [14] have been used. The images weree ditaken from the Malaysian National vided into three levels of quaality of uneven background, ink bleed and ink bleed-expaands spots images (the first row of o Figure 4). We used 640 512 image size in graysccale format. Additionally, we com mpared our proposed method with other state of the art m methods namely Niblack’s [7 7], Nick’s [8] and Bataineh’s method [6]. The resultting images after applying the pro oposed and the other methods are given in Figure 4.

Fig. 4. Several images of the Hang H Tuah Malay Manuscript which are divided into 3 levells of quality. From the left: uneven background, ink bleed, and ink bleed-expands spots images. The ng images after applying the proposed method, Niblack’s Metthod following rows are the resultin [7], Nick’s Method [8] and Baataineh’s Method [6], respectively.

We measure performance of o our proposed method based on the Relative Foregrouund Area Error (RAE) criterion n proposed by Sezgin and Sankur [15]. This criterion ccalculates the expected valuess within [0, 1]. In all cases, the measure that is closerr to zero corresponds to the bestt binarization result [10]. It can be expressed as below:

626

S.R. Yahya et al.

, (13)

,

and are the foreground areas in the reference image and the test data where, image. The analytical score values for each of the three types of degraded document images after binarization by the various methods are shown in Table 1. Table 1. The RAE values and their averages for images of different quality levels taken from Hang Tuah Malay Manuscript after using the proposed, Niblack’s [7], Bataineh’s [6] and Nick’s [8] methods Proposed Method

Niblack’s Method [7]

Bataineh’s Method [6]

Nick’s Method [8]

RAE Value

RAE Value

RAE Value

RAE Value

Im63

0.0769

0.3258

0.1600

0.1311

Im65

0.0787

0.3377

0.1748

0.1347

Im67

0.0769

0.2965

0.1497

0.1360

Im69

0.0782

0.1931

0.1570

0.1428

Im77

0.0815

0.1356

0.1480

0.1331

Im99

0.0764

0.3429

0.1855

0.1620

Im101

0.0649

0.3905

0.1712

0.1766

Im107

0.0678

0.3812

0.1553

0.1421

Ink-Bleed and Im61 Expansion Im109 Spot Images Im111 AVERAGE

0.0248

0.4025

0.1294

0.1177

0.0467

0.4509

0.1432

0.1122

Image Quality Levels

Uneven Background Images

Ink-Bleed Images

0.0342

0.4117

0.1412

0.1224

0.0642

0.3335

0.1559

0.1373

The smaller the value of RAE for an image, the better the quality of the image. Also, this means that the error of the pixels in the foreground area of the images is little. From Table 1, the proposed method achieved better RAE results of 0.0643 compared to Niblack’s, Nick’s and Bataineh’s methods which achieved 0.3335, 0.1373, and 0.1559 respectively. Therefore the resulting images produced by our proposed method are better and more readable for all types of image studied, i.e. uneven background, ink bleed and ink bleed-expands spots images.

5

Conclusion

Most of the Hang Tuah Manuscript image datasets are suffering from extremely bad qualities that leads to inconvenience among readers. Therefore, the Pattern Recognition Research Group has been continuously put in effort to improve the existing image

Adaptive Binarization Method for Enhancing Ancient Malay Manuscript Images

627

processing methods in order to dig up invaluable information from our local ancient manuscripts. In summary, the proposed method shows a smaller value of average RAE for all the three levels of image qualities in comparison to the other state of the art methods which are Niblack’s [7], Nick’s [8] and Bataineh’s [6] methods. Acknowledgments. Thanks to the National Library of Malaysia (PNM). This research project was funded by the research grants UKM-TT-03-FRGS0130 and UKMTT-03-FRGS0129.

References 1. Gatos, B., Pratikakis, I., Perantonis, S.J.: Improved Document Image Binarization by Using a Combination of Multiple Binarization Techniques and Adapted Edge Information. In: 19th International Conference on Pattern Recognition (ICPR), Tampa, Florida, USA, pp. 1–4 (2008) ISBN: 978-1-4244-2175-6/08 2. Yosef, I.B., Beckman, I., Kedem, K., Dinstein, I.: Binarization, Character Extraction, and Writer Identification of Historical Hebrew Calligraphy Documents. IJDAR 9, 89–99 (2007) 3. Shafait, F., Keysers, D., Breuel, T.M.: Efficient Implementation of Local Adaptive Thresholding Techniques Using Integral Images. In: Proc. SPIE. Document Recognition and Retrieval XV (2008) 4. Milewski, R., Govindaraju, V.: Binarization and Cleanup of Handwritten Text from Carbon Copy Medical Form Images. Pattern Recognition 41, 1308–1315 (2008) 5. Arora, S., Acharya, J., Verma, A., Panigrahi, P.K.: Multilevel Thresholding for Image Segmentation through a Fast Statistical Recursive Algorithm. Pattern Recognition Letters 29, 119–125 (2008) 6. Bataineh, B., Abdullah, S.N.H.S., Omar, K.: An adaptive local binarization method for document images based on a novel thresholding method and dynamic windows. Journal of Pattern Recognition Letters 32, 1805–1813 (2011) 7. Niblack, W.: An Introduction to Digital Image Processing. Prentice Hall, Upper Saddle River (1985) 8. Khurshid, K., Siddiqi, I., Faure, C., Vincent, N.: Comparison of Niblack Inspired Binarization Methods for Ancient Documents. In: 16th International Conference on Document Recognition and Retrieval. SPIE, USA (2010) 9. Kefali, A., Sari, T., Sellami, M.: Evaluation of Several Binarization Techniques for Old Arabic Documents Images. In: The First International Symposium on Modeling and Implementing Complex Systems, MISC 2010, Constantine, Algeria, pp. 88–99 (2010) 10. Bataineh, B., Abdullah, S.N.H.S., Omar, K., Faidzul, M.: Adaptive Thresholding Methods for Documents Image Binarization. In: Martínez-Trinidad, J.F., Carrasco-Ochoa, J.A., Ben-Youssef Brants, C., Hancock, E.R. (eds.) MCPR 2011. LNCS, vol. 6718, pp. 230– 239. Springer, Heidelberg (2011) 11. Boussellaa, W., Bougacha, A., Zahour, A., El Abed, H., Alimi, A.: Enhanced Text Extraction from Arabic Degraded Document Images using EM Algorithm. In: 10th International Conference on Document Analysis and Recognition, pp. 743–747 (2009) 12. António, A., Leite, R., Cancela, M.L., Shahbazkia, H.R.: MAQ – A Bioinformatics Tool for Automatic Macroarray Analysis. International Journal of Computer Applications 4, 51–58 (2010) 13. Atae-Allah, Z., Aroza, J.M.: A Filter to Remove Gaussian Noise by Clustering the Gray Scale. Journal of Mathematical Imaging and Vision 17(1), 15–25 (2002) 14. Manuscripts, National Library of Malaysia (Perpustakaan Negara Malaysia, PNM) (April 27, 2009), http://www.pnm.gov.my/pnmv3/index.php?id=84 15. Sezgin, M., Sankur, B.: Survey Over Image Thresholding Techniques and Quantitative Performance Evaluation. J. Electron Imaging 13(1), 146–165 (2004)