an adaptive logical method for binarization of degraded document images · bal [1}4] and local...

21
* Corresponding author. Tel.: #61-2-9351-6210; fax: #61- 2-9351-3847. E-mail address: ybyang@ee.usyd.edu.au (Y. Yang) Pattern Recognition 33 (2000) 787}807 An adaptive logical method for binarization of degraded document images Yibing Yang*, Hong Yan School of Electrical and Information Engineering, University of Sydney, NSW 2006, Australia Received 29 October 1998; accepted 29 March 1999 Abstract This paper describes a modi"ed logical thresholding method for binarization of seriously degraded and very poor quality gray-scale document images. This method can deal with complex signal-dependent noise, variable background intensity caused by nonuniform illumination, shadow, smear or smudge and very low contrast. The output image has no obvious loss of useful information. Firstly, we analyse the clustering and connection characteristics of the character stroke from the run-length histogram for selected image regions and various inhomogeneous gray-scale backgrounds. Then, we propose a modi"ed logical thresholding method to extract the binary image adaptively from the degraded gray-scale document image with complex and inhomogeneous background. It can adjust the size of the local area and logical thresholding level adaptively according to the local run-length histogram and the local gray-scale inhomogeneity. Our method can threshold various poor quality gray-scale document images automatically without need of any prior knowledge of the document image and manual "ne-tuning of parameters. It keeps useful information more accurately without overconnected and broken strokes of the characters, and thus, has a wider range of applications compared with other methods. ( 2000 Pattern Recognition Society. Published by Elsevier Science Ltd. All rights reserved. Keywords: Document images; Image thresholding; Image segmentation; Image binarization; Adaptive logical thresholding 1. Introduction Document images, as a substitute of paper documents, mainly consist of common symbols such as handwritten or machine-printed characters, symbols and graphics. In many practical applications, we only need to keep the content of the document, so it is su$cient to represent text and diagrams in binary format which will be more e$cient to transmit and process instead of the original gray-scale image. It is essential to threshold the docu- ment image reliably in order to extract useful informa- tion and make further processing such as character rec- ognition and feature extraction, especially for those poor quality document images with shadows, nonuniform illumination, low contrast, large signal-dependent noise, smear and smudge. Therefore, thresholding a scanned gray-scale image into two levels is the "rst step and also a critical part in most document image analysis systems since any error in this stage will propagate to all later phases. Although many thresholding techniques, such as glo- bal [1}4] and local thresholding [5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding techniques [12,13] have been developed in the past, it is still di$cult to deal with images with very low quality. Most common problems in poor quality document images are: (1) variable background intensity due to nonuniform illumination and un"t storage, (2) very low local contrast due to smear or smudge and shadows in the capturing process of the document image, (3) poor writing or printing quality, (4) serious signal-dependent noise, and (5) gray-scale changes in highlight and color areas. It is essential to "nd thresholding methods which can correctly keep all useful information and remove noise and background. Meanwhile, most document 0031-3203/00/$20.00 ( 2000 Pattern Recognition Society. Published by Elsevier Science Ltd. All rights reserved. PII: S 0 0 3 1 - 3 2 0 3 ( 9 9 ) 0 0 0 9 4 - 1

Upload: hoanghanh

Post on 21-Jul-2019

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

*Corresponding author. Tel.: #61-2-9351-6210; fax: #61-2-9351-3847.

E-mail address: [email protected] (Y. Yang)

Pattern Recognition 33 (2000) 787}807

An adaptive logical method for binarization of degradeddocument images

Yibing Yang*, Hong Yan

School of Electrical and Information Engineering, University of Sydney, NSW 2006, Australia

Received 29 October 1998; accepted 29 March 1999

Abstract

This paper describes a modi"ed logical thresholding method for binarization of seriously degraded and very poorquality gray-scale document images. This method can deal with complex signal-dependent noise, variable backgroundintensity caused by nonuniform illumination, shadow, smear or smudge and very low contrast. The output image has noobvious loss of useful information. Firstly, we analyse the clustering and connection characteristics of the characterstroke from the run-length histogram for selected image regions and various inhomogeneous gray-scale backgrounds.Then, we propose a modi"ed logical thresholding method to extract the binary image adaptively from the degradedgray-scale document image with complex and inhomogeneous background. It can adjust the size of the local area andlogical thresholding level adaptively according to the local run-length histogram and the local gray-scale inhomogeneity.Our method can threshold various poor quality gray-scale document images automatically without need of any priorknowledge of the document image and manual "ne-tuning of parameters. It keeps useful information more accuratelywithout overconnected and broken strokes of the characters, and thus, has a wider range of applications compared withother methods. ( 2000 Pattern Recognition Society. Published by Elsevier Science Ltd. All rights reserved.

Keywords: Document images; Image thresholding; Image segmentation; Image binarization; Adaptive logical thresholding

1. Introduction

Document images, as a substitute of paper documents,mainly consist of common symbols such as handwrittenor machine-printed characters, symbols and graphics. Inmany practical applications, we only need to keep thecontent of the document, so it is su$cient to representtext and diagrams in binary format which will be moree$cient to transmit and process instead of the originalgray-scale image. It is essential to threshold the docu-ment image reliably in order to extract useful informa-tion and make further processing such as character rec-ognition and feature extraction, especially for those poorquality document images with shadows, nonuniformillumination, low contrast, large signal-dependent noise,

smear and smudge. Therefore, thresholding a scannedgray-scale image into two levels is the "rst step and alsoa critical part in most document image analysis systemssince any error in this stage will propagate to all laterphases.

Although many thresholding techniques, such as glo-bal [1}4] and local thresholding [5}7] algorithms, multithresholding methods [8}11] and adaptive thresholdingtechniques [12,13] have been developed in the past, it isstill di$cult to deal with images with very low quality.Most common problems in poor quality documentimages are: (1) variable background intensity due tononuniform illumination and un"t storage, (2) very lowlocal contrast due to smear or smudge and shadows inthe capturing process of the document image, (3) poorwriting or printing quality, (4) serious signal-dependentnoise, and (5) gray-scale changes in highlight and colorareas. It is essential to "nd thresholding methods whichcan correctly keep all useful information and removenoise and background. Meanwhile, most document

0031-3203/00/$20.00 ( 2000 Pattern Recognition Society. Published by Elsevier Science Ltd. All rights reserved.PII: S 0 0 3 1 - 3 2 0 3 ( 9 9 ) 0 0 0 9 4 - 1

Page 2: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 1. A 768]576]8 original document image under badilluminating condition.

Fig. 2. A 768]576]8 original document image under badilluminating condition and signal-dependent noise.

processing systems need to process a large number ofdocuments with di!erent styles and layouts every day,thus, they require that whole processing procedure isachieved automatically and adaptively without priorknowledge and pre-speci"ed parameters. Global thre-sholding methods cannot meet these requirements, andlocal, or adaptive thresholding methods, which need tobe tuned with di!erent parameters according to di!erentimage classes, cannot be used for automated processeither.

In this paper, we propose a thresholding method basedon adaptive logical level technique to binarize seriouslydegraded and very poor quality gray-scale documentimages. Our method can deal with complex signal-depen-dent noise, variable background intensity caused by non-uniform illumination, shadow, smear or smudge and verylow contrast without obvious loss of useful information.

The paper is organized as follows. Section 2 brie#yreviews related works on image thresholding techniqueswith an emphasis on the document image binarizationbased on local analysis and adaptive thresholding. Sec-tion 3 analyses various factors which can cause poorquality and inhomogeneous gray-level background in animage and propose a rule to select the local area foranalysis and to produce run-length histograms and toextract stroke width information of a document image.Section 4 describes the principle and implementationprocess of our modi"ed adaptive logical level techniqueto threshold various degraded and poor quality docu-ment images, and a simple and e!ective method forpost processing of binary image. Section 5 discusses andevaluates the experimental results of the proposedmethod by comparison with some related thresholdingtechniques according to implementation complexity,character size and stroke width restriction, the number ofpre-speci"ed parameters and their meanings and setting,and human subjective evaluation of thresholded images,with experiments on some typical poor quality documentimages with bad illuminating condition (Fig. 1), and withshadows and signal-dependent noise (Figs. 2 and 3). Thelast section includes the summary and conclusion of ourwork.

2. Related work

We brie#y review some related works on image thre-sholding, particularly for poor quality document imagebinarization, which will be evaluated and compared withour thresholding method later. More complete reviewsof image thresholding techniques can be found in[2,4,14}16].

Image binarization methods can be divided into twoclasses: global and local thresholding techniques. Thesimplest and earliest method is the global thresholdingtechnique. The most commonly used global thresholding

techniques are based on histogram analysis [1,3,4]. Thre-shold is determined from the measure that best separatesthe levels corresponding to the peaks of the histogram,each of which corresponds to image pixels of a di!erentpart like background or objects in the image. Someglobal multi-threshold techniques are based on edgeanalysis [9,10] and histogram distribution function[8,11]. Sahoo et al. [2] analysed and evaluated the per-formance of over 20 popular global thresholding algo-rithms. All these algorithms need to have a prioriknowledge of the image processed about the number ofpeaks in the gray-level histogram. The modality of thedocument image histogram, however, may change fromimage to image. Thus, an obvious drawback of these globaltechniques is that it cannot separate those areas which

788 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 3: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 3. A 768]576]8 original document image under badilluminating condition and noise and shadow.

have the same gray level but do not belong to the samepart. These methods do not work well for the documentimages with shadows, inhomogeneous backgrounds,complex background patterns and di!erent types of fontsand typesettings, which may have a histograms thatcontains a single peak (Fig. 4). In this case, a single thre-shold or some multilevel thresholds could not result in anaccurate binary document image as shown in Figs. 5}7no matter how to tune the threshold parameters.

In local and adaptive thresholding techniques, localthreshold levels are determined by optimizing some localstatistical measures of separation. The criterion functionmay include the local intensity change (max/min andcontrast) [13], stroke width of the characters [17],spacial measures like connectivity and clustering [18,19]and some gradient and edge information [12,20,21]. Forcomplex document image analysis, Kamel and Zhao [22]compared four local adaptive thresholding algorithmsfor document images with shadows and complex back-ground patterns and proposed two new thresholdingtechniques } logical level technique and mask-basedsubtraction technique. Trier and Jain [14,15] evaluated11 popular local thresholding methods and four globalthresholding techniques. For all local thresholding tech-niques, it appears that none could threshold all imageswell with a set of operating parameters. In the following,we review a few related local thresholding algorithmsparticularly for poor quality document image withshadow, signal-dependent noise and inhomogeneousbackground and their results, which will be comparedwith our method later.

2.1. Connectivity-based thresholding algorithm

This algorithm was proposed in Ref. [18]. It uses thelocal connectivity as an information measure. The objec-

tive of thresholding is to preserve connectivity withinlocal regions. This algorithm is implemented in threesteps.

(1) Determine a histogram of the number of horizontaland vertical runs that result from thresholding theoriginal image at each intensity level. It is equivalentto count all black and white runs along all rows andcolumns for all binary images corresponding to eachintensity level.

(2) Calculate the `sliding pro"lea from the runs histo-gram to "nd plateaus or lack of variation of runs,some ranges around each intensity level can be deter-mined.

(3) Determine the number of thresholds as the numberof peaks on the sliding pro"le. The thresholds arechosen at the peaks that the sliding pro"le have localmaximum values. The image are thresholded inton#1 intensity levels by the n thresholds.

This algorithm produces global thresholds, but useslocal connectivity information. It can be used for localthresholding if multi-thresholds are used in di!erentareas of the image. It could not segment the documentimages well which are badly illuminated, especially whenthey contain both shadows and noise, as the shadow itselfcan be regarded as a connected part and the noise cana!ect the run histogram. We tested this algorithm forsome poor quality document images. Some results areshown in Section 5 (from Figs. 19}21).

2.2. Local intensity gradient method (LIG)

This method as presented in Ref. [20] and evaluatedand slightly modi"ed in Ref. [21] is based on the prin-ciple that objects in an image provide high spatial fre-quency components and illumination consists mainly oflower spatial frequencies. It "rst detects edges, and thenthe interior of objects between edges is "lled. First, foreach pixel (x, y) in the input image f (x, y), calculate

d(x, y)" mini/1,2,8

[f (x, y)!f (xi, y

i)],

where (xi, y

i), i"1,2, 8 are the 8-connected neighbours

of (x, y). Then the image d(x, y) of minimum local di!er-ence is broken up into the regions of size N]N. For eachregion, the mean m and standard deviations p are com-puted. Both values are smoothed by weighted mean andthen bilinearly interpolated to produce two new imagesM and S from m and p, respectively. Then for all pixels(x, y), if M(x, y)*m

0or S(x, y)(p

0, the pixel is regarded

as part of a #at region and remains unlabeled, else, ifd(x, y)(M(x, y)#k(x, y), then (x, y) is labeled as print;else (x, y) remains unlabeled. The resulted binary imagehighlights the edges. This is followed by pixel aggregationand region growing steps to locate the remaining parts ofthe print objects. This method needs three predetermined

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 789

Page 4: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig

.4.

Som

elo

calhisto

gram

s.(a

),(b

)an

d(c

)co

rres

pond

toth

elo

calhi

stogr

ams

ofF

igs.

1}3,

resp

ective

ly.

790 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 5: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 5. Binary document image extracted using the globalmethod from the original image of Fig. 1.

Fig. 6. Binary document image extracted using the globalmethod from the original image of Fig. 2.

Fig. 7. Binary document image extracted using the globalmethod from the original image of Fig. 3.

Fig. 8. Binary document image extracted using local intensitygradient method with N"16, m

0"!1.0, p

0"1.0 and

k"!1.0 from the original image in Fig. 1.

parameters m0, p

0and k and block size N. We tested this

method for several images with N"16, m0"!1.0,

p0"1.0 and k"!1.0. The results are shown in

Figs. 8}10. It can deal with slowly changing backgroundwith bad illumination. It will, however, intensify somenoise e!ects and could not work well for fast changingbackground with bad illumination due to gradient-basedanalysis.

2.3. Intergrated function algorithm and its improvement

This technique as described in Ref. [12] and as im-proved and evaluated in Refs. [14,21] applies a gradient-like operator, de"ned as the activity A(x, y), which is theabsolute sum of approximated derivatives for both scan

and raster directions taken over a small area, on theimage. Pixels with activity below a predetermined thre-shold ¹

aare labelled &0'. The other pixels are further

tested by the Laplacian edge operator ddxy

(x, y). The pixelis labelled &#' if dd

xy(x, y)'0; otherwise &!'. Thus,

a three-level label-image with pixel levels &#', &0' and&!' is produced. In a sequence of labels along with somestraight line passing through the currently processedpoints (x, y), edges are identi"ed as &!#' or &#!'

transitions. Object pixels are assumed to be &#' and &0'labelled pixels between a &!#' and &#!' pair. Thedistance between this pair can be regarded as the`strokewidtha along this line for document images. Back-ground pixels tend not to be included between this pair.

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 791

Page 6: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 9. Binary document image extracted using local intensitygradient method with N"16, m

0"!1.0, p

0"1.0 and

k"!1.0 from the original image in Fig. 2.

Fig. 10. Binary document image extracted using local intensitygradient method with N"16, m

0"!1.0, p

0"1.0 and

k"!1.0 from the original image in Fig. 3.

Fig. 11. Neighbour analysis in the local contrast technique.

According to this analysis, a 2]2 region is classi"ed ata time, it is needed that all the four pixels are insideeither horizontal or vertical object pixel sequences. Trier[21] improved this algorithm mainly in that all &#'marked regions are labelled print, and &!' marked re-gions are labeled background; a &0' marked region islabeled print if a majority of the pixels with 4-connectedare &#' marked, otherwise it is labelled background.It is sensitive to noises and fast changing backgrounddue to the Laplacian edge operator. Some thresh-olding results using this algorithm are shown in latersection on the experiment results of this paper (fromFigs. 22}24).

2.4. Local contrast technique

Giuliano et al. [23] presented the local contrast tech-nique to extract binary image in their patent for a charac-ter recognition system. This technique is implemented ina 9]9 window for an input image f (x, y). Each pixelin the output binary image b(x, y) is determined on the3]3]5 local pixels within a 9]9 window as shown inFig. 11. We use gray level 1 to represent foreground(print) and 0 to represent background (no print) in anoutput binary image. This method can be implementedas follows:

if f (x, y)(¹1, then, b(x, y)"1;

otherwise, A2t"M(x, y)D(x, y)3A

2and f (x, y)'¹

2N;

a1" mean of 9 pixels in area A

1; a

2" mean of the

pixels in area A2t;

if ¹3a2#¹

5'¹

4a1, then, b(x, y)"1;

otherwise, b(x, y)"0.

where, ¹1}¹

5are "ve predetermined parameters, ¹

1is

equivalent to the threshold in the global technique, ¹2

isused to detect all pixels in A

2with gray levels over

¹2

itself, other parameters are used to compare the meana1

of the central region A1

of processed pixel with themean a

2of the pixels over ¹

2in the four corner regions.

The biggest di$culty of this method is how to choosepredetermined parameters. Di!erent parameter settingcould produce quite di!erent results. This method issensitive to inhomogeneous background, large shadowsand noise. Figs. 25}27 in Section 5 show some testedresults produced by this method.

The above four methods will be compared with ourthresholding method.

792 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 7: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 12. Examples of gray-scale distribution of document image backgrounds with bad illuminated condition and signal-dependentnoise. (a), (b) and (c) correspond to the backgrounds of the document images in Figs. 1}3, respectively.

3. Document image background and stroke width analysis

For some poor quality document images with variableor inhomogeneous background intensity like shadows,smear or smudge, complex background patterns andsignal-dependent noise, a practical problem is that nothresholding algorithm could work well for all kinds ofdocument images. Most commonly, some methods orsome parameters for the document image with variableor inhomogeneous background intensity and noises willresult in a thresholded image in which printed charactershave nonuniform stroke width and possibly even loststrokes or false character and connection caused bybackground noise as shown in Figs. 8 and 9, 28(a) and29(a) in Section 5. This will result in low character recog-nition rate and document image compression rate in laterprocessing. Background and stroke width analysis of thecharacters for the document image can overcome orreduce this problem and improve thresholding accuracy

and robustness. Here, we present a simple and e$cientmethod for the backgroundand character stroke widthanalysis.

3.1. Background analysis

When an image consists of only objects and the back-ground, the best way to pick up a threshold is to searcha histogram, assuming it is bimodal, and "nd a gray levelwhich separates the two peaks. However, problems arisewhen the object area is small compared to the back-ground area or when both the object and the backgroundassume some broad range of gray levels as the back-ground gray-level distributions and character gray-leveldistributions. Two examples are shown in Figs. 12 and13. In these cases, the histogram is no longer bimodal asshown in Fig. 4. But, in some local areas, the bimodalityof the local histogram could be more obvious if this area

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 793

Page 8: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 13. Examples of gray-scale distribution of document image foregrounds with bad illuminated condition and signal-dependentnoises. (a), (b) and (c) correspond to the gray-scale distribution for the character line of the document images in Figs. 1}3, respectively.

contains separatable background and objects/characters.We divide an image into N]N, (N"4,2, 8) regions inorder to "nd some local areawith quasi-bimodal localhistogram or higher local contrast, and then make localhistogram analysis for the regions in the two diagonaldirections in Fig. 14(a) if N is even and for the regions inthe two diagonal, horizontal and vertical directions inFig. 14(b) if N is odd. We can gradually increase the localregions or the directions of analysis until N"8 if noquasi-bimodal local histogram is found in the case forN(8. In smaller regions, those regions with the samepatterns in Fig. 14 are simultaneously analysed in eachanalysis. From the local region analysis, some local re-gion histograms with quasi-bimodal property are shownin Fig. 15. With local quasi-bimodal histogram, the char-acter stroke widths and background changes can beanalysed using run-length histograms from these areas.

3.2. Stroke width and noise analysis

The document image can be accurately thresholded ifthe average or maximum stroke width of the charactersin the document image may be determined, becausehighly structured-stroke units frequently appear in mostdocument images. We have found some regions withquasi-bimodal local histograms in the poor quality docu-ment images by using local region analysis, then, localrun-length information can be extracted to form a run-length histogram from those selected local regions withquasi-bimodal local histograms. The stroke width in-formation and background noise can be achieved byanalysing run-length histogram. Here, we only analysethose selected image regions and only consider blackruns related to the characters or other objects. We denotea run-length histogram as a one-dimensional array

794 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 9: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 14. Local region histogram analysis to "nd some regions with quasi-bimodal local histogram or higher local contrast. (a) localregion analysis in the two diagonal directions; (b) "ne local region analysis in the two diagonal, horizontal and vertical directions.

R(i), i3I, I"M1, 2,2, ¸N, where ¸ is the longest run tobe counted. R(i) is frequency of the run of length i. Blackrun-length can be counted from the one-dimensionalgray level distributions across the selected local regionsas shown in Fig. 16 in horizontal and vertical directions.The number of the directions, which are across the char-acter/object region in the selected image regions withquasi-bimodal local histograms, can be increased to fourdirections, including horizontal, vertical and two diag-onal directions if the document image contains complexsymbol patterns.

The stroke width (SW) is de"ned as the run-lengthwith the highest frequency in the run-length histogramexcluding the unit run-length. That is, SW"i, ifR

.!9(i)"max

i|IR(i), iO1. It actually re#ects the aver-

age width of strokes in a document image. Fig. 17 illus-trates the run-length histograms, from which, strokewidth can be easily determined. If an image containssome complex background patterns or noises, the highestpeak may be formed by these factors instead of thecharacters. In this case, selected region analysis and onlyblack run-length analysis become necessary to preventproducing wrong stroke width. Statistical study showsthat the mean stroke width is usually over one pixel,accordingly, all unit-runs should be removed as back-ground in resulting binary image no matter how it isproduced by noise or other background changes. We canuse the unit-run noise (URN) [17] to measure back-ground noise and changes.

URN"

R(1)

maxi|I

R(i), iO1.

A high number of unit runs means that a documentimage contains high noise background and/or fastchanging background.

4. Adaptive logical level thresholding technique

4.1. Logical level technique

Logical level technique proposed by Kamel and Zhao[22] is developed on the basis of analysing integratedfunction algorithm [12]. It is based on the idea of com-paring the gray level of the processed pixel or itssmoothed gray level with some local averages in theneighborhoods about a few other neighbouring pixels.More than once the comparison results are regarded asderivatives. Therefore, pixel labeling, detection and ex-traction using the derivatives, the logical bound on theordered sequences and the stroke width range can beadopted. This technique processes each pixel by simulta-neously comparing its gray level or its smoothed graylevel with four local averages in the (2SW#1)](2SW#1) window centered at the four points P

i,

P@i, P

i`1, P@

i`1shown in Fig. 18. We use 1 to represent

character/object and 0 to represent background in theresulting binary image. Mathematically, this techniquecan be described as follows:

b(x, y)

"G1 ifS3

i/0[¸(P

i)'¸(P@

i)'¸(P

i`1)'¸(P@

i`1)] is true,

0 otherwise,

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 795

Page 10: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 15. Some local region histograms with quasi-bimodal property or the regions with larger contrast in the document images with badilluminated condition and signal-dependent noise. (a) and (b) correspond to some local region histograms of Fig. 1, (c) and (d)correspond to some local region histograms of Fig. 2.

where SW is the predetermined maximal stroke width,P@i"P

(i`4).0$ 8, for i"0,2,7, (̧P)"ave(P)!g(x, y)'

¹, ¹ is a predetermined parameter,

ave(P)" +~SWx*xSW

+~SWx+xSW

f (Px!i, P

y!j)

/(2]SW#1)2,

Px, P

yare the coordinates of P and g(x, y)"f (x, y) or its

smoothed value.In order to reduce the computation, fast algorithms are

used to calculate the local averages and logical levels.

4.2. Adaptive improvement of logical level technique

We propose some improvements for the original logi-cal level technique in order to achieve automatic and

adaptive thresholding and accurate binary images forvarious poor quality document images. Our modi"cationis made in two aspects. The "rst one is to determineaverage maximal stroke width SW automatically byrun-length histograms in the selected local regions of theimage as described in the preceding section. This strokewidth can be tuned automatically for di!erent documentimages. As usual, we use the run-length with highest peakof the run-length histogram in the selected regions of thedocument image, SW"i, if R

.!9(i)"max

i|IR(i), iO1,

as stroke width. In some cases, we may also use therun-length SW

2nd"j of the second highest peak

R2nd~right~peak

( j) right to the highest peak, which is thesecond high peak on the right of the highest peak in therun-length histogram as the stroke width, if 1)( j!i))2, i, jO1 and R

2nd~right~peak( j)/R

.!9(i)*0.8.

796 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 11: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig

.16.

Som

egr

ay-s

cale

dist

ribut

ions

acro

ssth

ech

arac

ters

inth

ese

lect

edre

gion

sof

the

docu

men

tim

ages

.We

can

getth

eav

erag

est

roke

wid

thin

form

atio

nfrom

the

run-

lengt

hof

gray

-lev

elch

ange

.(a

)co

rres

ponds

togr

ay-s

cale

distr

ibutions

acro

ssth

ese

lect

edre

gion

ofFig

.1,

(b)

corr

espon

dsto

gray

-sca

ledistr

ibutions

acro

ssth

ese

lect

edre

gion

ofFig

.2.

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 797

Page 12: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 17. Local run-length histograms, (a), (b) and (c) correspond to the run-length histograms of the selected regions from the documentimages in Figs. 1}3, respectively.

The other improvement is to automatically and adap-tively produce local parameter ¹ instead of using prede-termined global parameter. It can overcome the uneventhresholding e!ect and false thresholding result for thedocument images with bad illumination, inhomogeneousand fast changing background and big noise by theoriginal logical level technique. Parameter ¹ is adaptive-ly and automatically produced as follows:

1. Calculate fSW~.!9

(x, y)"maxxi, yi|(2SW`1) window

f (xi, y

i)

and fSW~.*/

(x, y)"minxi, yi|(2SW`1) window

f (xi, y

i) in

the (2SW#1)](2SW#1) window centered at theprocessed point P.

2. Calculate D fSW~.!9

(x, y)!ave(P)D and D fSW~.*/

(x, y)!ave(P)D;

3. If D fSW~.!9

(x, y)!ave(P)D'D fSW~.*/

(x, y)!ave(P)D,the local (2SW#1)](2SW#1) window region tendsto contain more local low gray levels, then, ¹"

a(23

fSW~.*/

(x, y)#13ave(P)). Here, a can be a "xed

value between 0.3 and 0.8. It can be taken as 13

for verypoor quality images with high noise and low contrastlike in our examples. In most cases, it can be taken as 2

3.

4. If D fSW~.!9

(x, y)!ave(P)D(D fSW~.*/

(x, y)!ave(P)D,the local (2SW#1)](2SW#1) window region tendsto contain more local high graylevels, then,¹"a(1

3fSW~.*/

(x, y)#23ave(P)).

5. If D fSW~.!9

(x, y)!ave(P)D"D fSW~.*/

(x, y)!ave(P)D;

1. C If fSW~.!9

(x, y)"fSW~.*/

(x, y), expand the windowsize to (2SW#3)](2SW#3), then, repeat from

798 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 13: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 18. Processing neighbourhood of logical level thresholdingtechnique.

Fig. 19. Binary document image extracted using connectivity-based thresholding algorithm from the original document imagein Fig. 1.

step 1 but using new widow size. If stillfSW~.!9

(x, y)"fSW~.*/

(x, y) in the new window,then, P is regarded as background pixel (or¹"a ) ave(P)).

1. C If fSW~.!9

(x, y)OfSW~.*/

(x, y), the local (2SW#

1)](2SW#1) window region tends to contain thesame quota of low and high gray levels, expandthe window size to (2SW#3)](2SW#3), then,repeat from step 1 but using new window size.If D f

SW~.!9(x, y)!ave(P)D"D f

SW~.*/(x, y)!ave(P)D

and fSW~.!9

(x, y)OfSW~.*/

(x, y) in the newwindow, then, ¹"a ) ave(P).

4.3. Postprocessing of binary image

The aim of postprocessing for binary image is to re-move binary noise and false print information to improvebinary quality. In our method, we use run-length in-formation to decide false information. First, the run-length histograms only for print information of the bi-nary image in horizontal and vertical directions areextracted, we compare them with the local run-lengthhistograms from the original document image, the unit-run parts in both horizontal and vertical directions areremoved. Then, those runs only with unit and two pixelwidth combined in both horizontal and vertical direc-tions are removed. Furthermore, we analyse possibly bigfalse print information caused by fast changing back-grounds, which we call long-run noise. A run is con-sidered to be long if it is substantially longer thanthe maximum run-length of the characters. The numberof long runs should be quite small even if underlines,tables and graphics exist in document images. Here, weuse a long-run noise (¸RN) feature [17] to describe ifthere are some long-run noises in the resulting binaryimage.

LRN"

+i;L0

R(i)

maxi|I

R(i), iO1,

where ¸0

is a constant, it may be determined larger thanaverage character size. We use LRN to measure if thebinary image contains more long-run noise. If it is largerthan 1 or close to 1, we will revise the width parameter tosmaller in thresholding so that the resulting binary imagemay be more clear. This process is automatic.

5. Experimental results and evaluation

We have tested six local adaptive thresholding algo-rithms including the logical level technique and ourmodi"ed logical technique for a number of documentimages with poor quality such as with bad illumination,shadow, signal-dependent noise and various variablebackgrounds in di!erent parameters. All algorithms wereimplemented and tested through software written inC programming language in the UNIX on a Sun SparcStation IPX. Figs. 8}10 and 19}38 illuminate the experi-ment results respectively using Local Intensity GradientMethod, Connectivity-Based Thresholding Algorithm,Intergrated Function Algorithm, Local Contrast Tech-nique, Logical Level Technique and our Adaptive Logi-cal Thresholding Algorithm. Table 1 gives the averagecomputation time (CPU time in seconds) for the algo-rithms mentioned above. All images tested are with widthof 768, height of 576 and gray-level range of [0,255].

Connectivity-Based Thresholding Algorithm couldnot segment badly illuminated document images well,especially when they contain both shadows and noises asin Figs. 19}21, since the shadow itself can be regarded asa connected part and the noise could give a big e!ect forthe run histogram. Moreover, its e$ciency of implemen-tation is limited by a large number of calculationsand decisions, since it needs to calculate the run-length

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 799

Page 14: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 20. Binary document image extracted using connectivity-based thresholding algorithm from the original document imagein Fig. 2.

Fig. 21. Binary document image extracted using connectivity-based thresholding algorithm from the original document imagein Fig. 3.

Fig. 22. Binary document image extracted using intergratedfunction algorithm from the image in Fig. 1.

Fig. 23. Binary document image extracted using intergratedfunction algorithm from the image in Fig. 2.

Fig. 24. Binary document image extracted using intergratedfunction algorithm from the image in Fig. 3.

histograms for two directions (horizontal and vertical) ateach intensity level. Local Intensity Gradient Methodcan work well with slowly changing background and badillumination. It will, however, intensify some noise e!ectsand could not work well for fast changing backgroundwith bad illumination as shown in Figs. 8}10 due togradient-based analysis. Besides, the calculation of localminimum di!erence image (for each pixel) and localmean m and standard deviation p particularly with theincrease of the blocked region size N are quite time-consuming. The selection of pre-speci"ed parameters areimage-directed and region-directed. Di!erent pre-speci-"ed parameters and region size could result in quitedi!erent result images.

800 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 15: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 27. Binary document image extracted using local contrastanalysis from the image in Fig. 3.

c

Fig. 28. Binary document image extracted using original logicallevel technique from the document image in Fig. 1. The results in(a) and (b) are quite di!erent due to di!erent predeterminedparameters.

Fig. 26. Binary document image extracted using local contrastanalysis from the image in Fig. 2.

Fig. 25. Binary document image extracted using local contrastanalysis from the image in Fig. 1.

Intergrated Function Algorithm has fully consideredthe stroke width information so that it can remove all thelarge dark areas completely. The labeling and logicaldetecting assure that every large dark area is a connectedblack blob which is removed from the image in the "nalextraction phase. Therefore, the resulting images have nounwanted edges of large dark areas, but it is sensitive tonoises and fast changing background due to using Lap-lacian edge operator. It could produce some small noise

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 801

Page 16: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Table 1Implementation results and evaluation. Execution time is theaverage processing time for several images of size 768]576 ona Sun Sparc Station IPX

Method Average CUPtime (s)

Subjective evaluation

Connectivity-based 46.583 ShadowsLocal intensity

gradient (post-processing)

51.166 Noise, unwanted edges

Integrated function 18.743 NoiseLocal contrast 35.383 Noise, over-removal of

shadow areaLogical level (fast

algorithm [22])12.166 Good, a little bit over-

removal of shadow areaAdaptive logical level

(fast algorithm [22]and postproc.)

15.533 Best

Fig. 29. Binary document image extracted using original logicallevel technique from the document image in Fig. 2. The results in(a) and (b) are quite di!erent due to di!erent predeterminedparameters.

Fig. 30. Binary document image extracted using modi"ed logicallevel thresholding method from the original Fig. 1. SW is taken asthe run-length of the highest peak in the run-length histogram.

Fig. 31. Binary document image extracted using modi"ed logicallevel thresholding method from the original in Fig. 2. SW is takenas the run-length of the highest peak in the run-length histogram.

Fig. 32. Binary document image extracted using modi"ed logicallevel thresholding method from the original in Fig. 3. SW is takenas the run-length of the highest peak in the run-length histogram.

802 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 17: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 33. Binary document image extracted using modi"ed logi-cal level thresholding method from the original in Fig. 1. SW istaken as the run-length of the second highest peak right to thehighest peak in the run-length histogram.

Fig. 34. Binary document image extracted using our modi"edlogical level thresholding method from the original in Fig. 2. SWis taken as the run-length of the second highest peak right to thehighest peak in the run-length histogram.

Fig. 35. An original gray-scale document image with a few of line graphics and shadows.

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 803

Page 18: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 36. Binary document image extracted using our modi"ed logical level thresholding method from the original in Fig. 35.

prints for noisy images and complex background imagesas shown in Figs. 20}24. The biggest di$culty for LocalContrast Technique is how to choose predeterminedparameters, because it needs to set "ve parameters man-ually. Since only two out of three parameters ¹

3, ¹

4and

¹5

are independent, only ¹1

and ¹2

have clear physicalmeaning like in global thresholding or multi-thresholdtechniques and can be easily set. For a given image, itappears not to have some rules to set other parameters¹

3, ¹

4and ¹

5, and di!erent parameters could produce

quite di!erent results. This method is also sensitive toinhomogeneous background and large shadows asshown in Figs. 25}27.

Logical Level Technique appears to work well fora wide range of document images, even though it alsouses some derivatives in comparisons, its comparison ismade for the local average and is not sensitive to noise.The result, however, could be changed from image toimage as shown in Figs. 28 and 29 when the imagecontains some complex background or large change inillumination, because it uses a global predeterminedparameter ¹. Our method improves its adaptivity androbustness from a predetermined global parameter toa local one. It can be implemented and tuned automati-

cally from image to image, and is more insensitive to thelocal noises in images. The stroke width can be selectedand adjusted automatically according to di!erent docu-ment images and later pattern recognition requirements,that is, we can select the highest or second highest peakright to the highest peak of the run-length as stroke widthunder some conditions, therefore, it has a wider range ofapplications. Figs. 30}34 show the experimental resultsobtained using our method.

6. Conclusions

In this paper, we have presented a modi"ed logicalthresholding method based on adaptive logical leveltechnique to binarize seriously degraded and very poorquality gray-scale document image. Our method canthreshold gray-scale document images with complexsignal-dependent noise, variable background intensitycaused by nonuniform illumination, shadow, smear orsmudge and very low contrast without obvious loss ofuseful information. It can adaptively tune the size of localanalysing area and logical thresholding level accordingto the local run-length histogram for the selected regions

804 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 19: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 37. An original gray-scale document image with normal quality.

with quasi-bimodal local histograms and the analysis ofgrayscale inhomogeneity of the background. For di!er-ent test images with various noises and di!erent inhomo-geneous backgrounds, experiments and evaluations haveshown that our method can automatically thresholdvarious poor quality gray-scale document images with-out need of any prior knowledge of the document imageand manual "ne-tuning of parameters. It is nonparamet-ric and automatic. It keeps useful information more accu-rately without overconnected and broken stroke of thecharacters, thus, it has the wider range of applicationsand is more robust for document images comparing withother thresholding methods based on connectivity andbackground analysis.

It is worth noting that our method is based on strokewidth analysis, thus it can be used to process the docu-ment images with tables and line or block graphics andworks well. Figs. 35 and 36 show an example of thre-sholding the document image with line graphics usingour method. It may, however, not be suitable to thresh-old such gray-level images as scanned human or scenic

photographies. Our method is a local adaptive technique,which is the modi"ed logical level method. Its computa-tion e$ciency is much higher than connectivity-basedthresholding method, as our method only needs tocalculate a run-length histogram directly of the graylevels in the selected regions, instead of thresholding thewhole original image at each intensity level to get itsrun-length histogram as in connectivity-based method.Experimental results show that user-de"ned parameterin our method is robust for various document images.Although our method is designed to process documentimages with very poor quality, it can perform equallywell and work more e$ciently on document imageswith good or normal quality because the backgroundanalysis of the document image, the run-length histo-gram construction and post-processing process aresimpler. The average processing time for document im-ages with good or normal quality can be reduced by20}30%. Figs. 37 and 38 give an example of thresholdingthe document image with normal quality using ourmethod.

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 805

Page 20: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

Fig. 38. Binary document image extracted using our modi"ed logical level thresholding method from the original in Fig. 37.

Acknowledgements

This work is supported by the Australian ResearchCouncil.

References

[1] N. Ostu, A thresholding selection method from gray-levelhistogram, IEEE Trans. Systems Man Cybernet. SMC-8(1978) 62}66.

[2] P.K. Sahoo, S. Soltani, A.K.C. Wong, A survey of thre-sholding technique, Comput. Vision Graphics ImageProcess. 41 (1988) 233}260.

[3] J.N. Kapur, P.K. Sahoo, A.K.C. Wong, A new method forgray-level picture thresholding using the entropy of thehistogram, Computer Vision Graphics Image Process. 29(1985) 273}285.

[4] S.U. Lee, S.Y. Chung, R.H. Park, A comparative perfor-mance study of several global thresholding techniques forsegmentation, CVGIP 52 (1990) 171}190.

[5] F. Deravi, S.K. Pal, Gray level thresholding using second-order statistics, Pattern Recognition Lett. 1 (1983) 417}422.

806 Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807

Page 21: An adaptive logical method for binarization of degraded document images · bal [1}4] and local thresholding[5}7] algorithms, multi thresholding methods [8}11] and adaptive thresholding

[6] J. Kittler, J. Illingworth, Threshold selection based ona simple image statistic, CVGIP 30 (1985) 125}147.

[7] Y. Nakagawa, A. Rosenfeld, Some experiments on variablethresholding, Pattern Recognition 11 (1979) 191}204.

[8] S. Boukharouba, J.M. Rebordao, P.L. Wendel, An ampli-tude segmentation method based on the distributionfunction of an image, Computer Vision Graphics ImageProcess. 29 (1985) 47}59.

[9] S. Wang, R.M. Haralick, Automatic multithreshold selec-tion, Computer Vision Graphics Image Process. 25 (1984)46}67.

[10] R. Kohler, A segmentation system based on thresholding,Computer Graphics Image Process. 15 (1981) 319}338.

[11] N. Papamarkos, B. Gatos, A new approach for multilevelthreshold selection, CVGIP: Graphical Models ImageProcess. 56 (5) (1994) 357}370.

[12] J.M. White, G.D. Rohrer, Imager segmentation for opticalcharacter recognition and other applications requiringcharacter image extraction, IBM J. Res. Dev. 27 (4) (1983)400}411.

[13] Y. Yasuda, M. Dubois, T.S. Huang, Data compression forcheck processing machine, Proc. IEEE 68 (7) (1980)874}885.

[14] O.D. Trier, A.K. Jain, Goal-directed evaluation of binariz-ation methods, IEEE Trans. Pattern Anal. Mach. Intell.17 (12) (1995) 1191}1201.

[15] O.D. Trier, T. Taxt, Evaluation of binarization methodsfor document images, IEEE Trans. Pattern Anal. Mach.Intell. 17 (3) (1995) 312}315.

[16] J.S. Weszka, A. Rosenfeld, Threshold evaluation tech-niques, IEEE Trans, System Man Cybernet. SMC-8 (8)(1978) 622}629.

[17] Y. Liu, S.N. Srihari, Document image binarization basedon texture features, IEEE Trans. Pattern Anal. Mach.Intell. 19 (5) (1997) 540}544.

[18] L. O'Gorman, Binarization and multithresholding ofdocument images using connectivity, CVGIP: GraphicalModels Image Process. 56 (6) (1994) 494}506.

[19] T. Taxt, P.J. Flynn, A.K. Jain, Segmentation of documentimage, IEEE Trans. Pattern Anal. Mach. Intell. 11 (12)(1989) 1322}1329.

[20] J.R. Parker, Gray level thresholding in badly illuminatedimages, IEEE Trans. Pattern Anal. Mach. Intell. 13 (8)(1991) 813}819.

[21] O.D. Trier, T. Taxt, Improvement of &intergrated functionalgorithm' for binarization of document images, PatternRecognition Lett. 16 (3) (1995) 277}283.

[22] M. Kamel, A. Zhao, Extraction of binary character/graphics images from grayscale document images, CVGIP:Graphical Models Image Process. 55 (3) (1993) 203}217.

[23] E. Giuliano, O. Paitra, L. Stringa, Electronic characterreading system, U. S. Patent 4, 047,15, 6 September, 1977.

About the Author*YIBING YANG received her B.S., M.S. and Ph.D. degrees from Nanjing University of Aeronautics andAstronautics, China, in 1983, 1986 and 1991 respectively, all in electrical engineering. From 1986 to 1988, she worked as an assistantprofessor in Nanjing University of Aeronautics and Astronautics, China. From 1992 to 1993 she was a postdoctor, and from 1994, shehas worked as an associate professor, both in the Department of Radio Engineering at Southeast University, China. Meanwhile, she wason leave and worked as a research associate in Electronics Department of The Chinese University of Hong Kong from 1995 to 1996. Sheis currently working as a visiting scholar in the Department of Electrical Engineering, The University of Sydney, Australia. Her researchinterests include image and signal analysis, processing and compression, pattern recognition, medical and optical image processing, andcomputer vision application.

About the Author*HONG YAN received his B.E. degree from Nanking Institute of Posts and Telecommunications in 1982, M.S.E.degree from the University of Michigan in 1984, and Ph.D. degree from Yale University in 1989, all in electrical engineering. From 1986to 1989 he was a research scientist at General Network Corporation, New Haven, CT, USA, where he worked on developing a CADsystem for optimizing telecommunication systems. Since 1989 he has been with the University of Sydney where he is currently aProfessor in Electrical Engineering. His research interests include medical imaging, signal and image processing, neural networks andpattern recognition. He is an author or co-author of one book, and more than 200 technical papers in these areas. Dr. Yan is a fellow ofthe Institution of Engineers, Australia (IEAust), a senior member of the IEEE, and a member of the SPIE, the International NeuralNetwork Society, the Pattern Recognition Society, and the International Society for Magnetic Resonance in Medicine.

Y. Yang, H. Yan / Pattern Recognition 33 (2000) 787}807 807