Efficient computation of adaptive threshold surfaces for image binarization

Similar documents
A Binarization Algorithm specialized on Document Images and Photos

Improvement of Spatial Resolution Using BlockMatching Based Motion Estimation and Frame. Integration

A Fast Visual Tracking Algorithm Based on Circle Pixels Matching

Parallelism for Nested Loops with Non-uniform and Flow Dependences

Edge Detection in Noisy Images Using the Support Vector Machines

Mathematics 256 a course in differential equations for engineering students

S1 Note. Basis functions.

Learning the Kernel Parameters in Kernel Minimum Distance Classifier

Content Based Image Retrieval Using 2-D Discrete Wavelet with Texture Feature with Different Classifiers

A PATTERN RECOGNITION APPROACH TO IMAGE SEGMENTATION

An Optimal Algorithm for Prufer Codes *

High-Boost Mesh Filtering for 3-D Shape Enhancement

A Fast Content-Based Multimedia Retrieval Technique Using Compressed Data

R s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes

Skew Angle Estimation and Correction of Hand Written, Textual and Large areas of Non-Textual Document Images: A Novel Approach

2x x l. Module 3: Element Properties Lecture 4: Lagrange and Serendipity Elements

Type-2 Fuzzy Non-uniform Rational B-spline Model with Type-2 Fuzzy Data

MULTISPECTRAL IMAGES CLASSIFICATION BASED ON KLT AND ATR AUTOMATIC TARGET RECOGNITION

Image Representation & Visualization Basic Imaging Algorithms Shape Representation and Analysis. outline

FEATURE EXTRACTION. Dr. K.Vijayarekha. Associate Dean School of Electrical and Electronics Engineering SASTRA University, Thanjavur

Problem Set 3 Solutions

Cluster Analysis of Electrical Behavior

Corner-Based Image Alignment using Pyramid Structure with Gradient Vector Similarity

The Research of Ellipse Parameter Fitting Algorithm of Ultrasonic Imaging Logging in the Casing Hole

Outline. Type of Machine Learning. Examples of Application. Unsupervised Learning

A Novel Adaptive Descriptor Algorithm for Ternary Pattern Textures

A fast algorithm for color image segmentation

An Application of the Dulmage-Mendelsohn Decomposition to Sparse Null Space Bases of Full Row Rank Matrices

CLASSIFICATION OF ULTRASONIC SIGNALS

Lecture #15 Lecture Notes

Smoothing Spline ANOVA for variable screening

An Accurate Evaluation of Integrals in Convex and Non convex Polygonal Domain by Twelve Node Quadrilateral Finite Element Method

ESTIMATION OF PROPER PARAMETER VALUES FOR DOCUMENT BINARIZATION

Local Quaternary Patterns and Feature Local Quaternary Patterns

Lecture 5: Multilayer Perceptrons

Hermite Splines in Lie Groups as Products of Geodesics

NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS

12/2/2009. Announcements. Parametric / Non-parametric. Case-Based Reasoning. Nearest-Neighbor on Images. Nearest-Neighbor Classification

Problem Definitions and Evaluation Criteria for Computational Expensive Optimization

Classifying Acoustic Transient Signals Using Artificial Intelligence

An Image Fusion Approach Based on Segmentation Region

Vectorization of Image Outlines Using Rational Spline and Genetic Algorithm

Range images. Range image registration. Examples of sampling patterns. Range images and range surfaces

Using Fuzzy Logic to Enhance the Large Size Remote Sensing Images

MOTION BLUR ESTIMATION AT CORNERS

SLAM Summer School 2006 Practical 2: SLAM using Monocular Vision

Determining the Optimal Bandwidth Based on Multi-criterion Fusion

Accounting for the Use of Different Length Scale Factors in x, y and z Directions

TN348: Openlab Module - Colocalization

An efficient method to build panoramic image mosaics


TECHNIQUE OF FORMATION HOMOGENEOUS SAMPLE SAME OBJECTS. Muradaliyev A.Z.

An Iterative Solution Approach to Process Plant Layout using Mixed Integer Optimisation

A Modified Median Filter for the Removal of Impulse Noise Based on the Support Vector Machines

Fast Computation of Shortest Path for Visiting Segments in the Plane

The Shortest Path of Touring Lines given in the Plane

A New Approach For the Ranking of Fuzzy Sets With Different Heights

Tsinghua University at TAC 2009: Summarizing Multi-documents by Information Distance

Feature Reduction and Selection

Optimal Workload-based Weighted Wavelet Synopses

Proper Choice of Data Used for the Estimation of Datum Transformation Parameters

Unsupervised Learning

Nonlocal Mumford-Shah Model for Image Segmentation

A Background Subtraction for a Vision-based User Interface *

A MOVING MESH APPROACH FOR SIMULATION BUDGET ALLOCATION ON CONTINUOUS DOMAINS

Detection of an Object by using Principal Component Analysis

Quality Improvement Algorithm for Tetrahedral Mesh Based on Optimal Delaunay Triangulation

CS 534: Computer Vision Model Fitting

Brushlet Features for Texture Image Retrieval

A Deflected Grid-based Algorithm for Clustering Analysis

Wavefront Reconstructor

High resolution 3D Tau-p transform by matching pursuit Weiping Cao* and Warren S. Ross, Shearwater GeoServices

A Robust Method for Estimating the Fundamental Matrix

3D vector computer graphics

Related-Mode Attacks on CTR Encryption Mode

An Improved Image Segmentation Algorithm Based on the Otsu Method

The Codesign Challenge

Analysis of Continuous Beams in General

Support Vector Machines

Modeling, Manipulating, and Visualizing Continuous Volumetric Data: A Novel Spline-based Approach

Lecture 4: Principal components

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz

ANALYSIS OF ADAPTIF LOCAL REGION IMPLEMENTATION ON LOCAL THRESHOLDING METHOD

On Some Entertaining Applications of the Concept of Set in Computer Science Course

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

Hybrid Non-Blind Color Image Watermarking

Simplification of 3D Meshes

Subspace clustering. Clustering. Fundamental to all clustering techniques is the choice of distance measure between data points;

Load Balancing for Hex-Cell Interconnection Network

Interpolation of the Irregular Curve Network of Ship Hull Form Using Subdivision Surfaces

Classifier Selection Based on Data Complexity Measures *

Outline. Self-Organizing Maps (SOM) US Hebbian Learning, Cntd. The learning rule is Hebbian like:

The Research of Support Vector Machine in Agricultural Data Classification

Sum of Linear and Fractional Multiobjective Programming Problem under Fuzzy Rules Constraints

Dynamic wetting property investigation of AFM tips in micro/nanoscale

SVM-based Learning for Multiple Model Estimation

y and the total sum of

Classifier Swarms for Human Detection in Infrared Imagery

VISUAL SELECTION OF SURFACE FEATURES DURING THEIR GEOMETRIC SIMULATION WITH THE HELP OF COMPUTER TECHNOLOGIES

A Computer Vision System for Automated Container Code Recognition

Transcription:

Pattern Recognton 39 (2006) 89 101 www.elsever.com/locate/patcog Effcent computaton of adaptve threshold surfaces for mage bnarzaton Ilya Blayvas, Alfred Brucksten, Ron Kmmel CS Department, Technon, Hafa 32000, Israel Receved 30 December 2004; receved n revsed form 11 August 2005; accepted 11 August 2005 Abstract The problem of bnarzaton of gray level mages, acqured under non-unform llumnaton s reconsdered. Yanowtz and Brucksten proposed to use for mage bnarzaton an adaptve threshold surface, determned by nterpolaton of the mage gray levels at ponts where the mage gradent s hgh. The ratonale s that hgh mage gradent ndcates probable object edges, and there the mage values are between the object and the background gray levels. The threshold surface was determned by successve over-relaxaton as the soluton of the Laplace equaton. Ths work proposes a dfferent method to determne an adaptve threshold surface. In ths new method, nspred by multresoluton approxmaton, the threshold surface s constructed wth consderably lower computatonal complexty and s smooth, yeldng faster mage bnarzatons and often better nose robustness. 2005 Pattern Recognton Socety. Publshed by Elsever Ltd. All rghts reserved. MSC: 68T45 Keywords: Computer vson; Image bnarzaton; Threshold surface; Bernsen; Ekvl Taxt Moen; Nblack; Yanowtz Brucksten 1. Introducton Let us consder the problem of separatng objects from ther background n a gray level mage I(x,y), where objects appear lghter (or darker) than the background. Ths can be done by constructng a threshold surface T (x,y), and constructng a bnarzed mage B(x,y) by comparng the value of the mage I(x,y) wth T (x,y) at every pxel, va { 1 f I(x,y)>T(x,y), B(x,y) = 0 f I(x,y) T (x,y). It s clear that a fxed value of the threshold surface T (x,y)= const cannot yeld satsfactory bnarzaton results for mages obtaned under non-unform llumnaton and/or wth a non-unform background. Correspondng author. Tel.: +972 545 404 938; fax: +972 482 939 00. E-mal address: blayvas@cs.technon.ac.l (I. Blayvas). (1) Chow and Kaneko n Ref. [1] were among the frst researchers to suggest usng adaptve threshold surfaces for bnarzaton. In ther method the mage was dvded nto overlappng cells, and sub-hstograms of gray levels n each cell were calculated. Sub-hstograms judged to be bmodal were used to determne local threshold values for the correspondng cell centers, and the local thresholds were nterpolated over the entre mage to yeld a threshold surface T (x,y). Ths was certanly an mprovement over fxed thresholdng, snce ths method utlzed some local nformaton. However, the local nformaton was mplctly blurred to the sze of the cell, and ths, obvously, could not be decreased too much. Yanowtz and Brucksten made a step forward n Ref. [2] by suggestng to construct a threshold surface by nterpolatng the mage gray levels at ponts where the mage gradent s hgh. Indeed, hgh mage gradents ndcate probable object edges, where the mage gray levels are between the object and the background levels. The threshold surface was requred to nterpolate the mage gray levels at all support ponts and to satsfy the Laplace equaton at nonedge pxels. The surface was determned by a successve over-relaxaton method (SOR) [2,3]. 0031-3203/$30.00 2005 Pattern Recognton Socety. Publshed by Elsever Ltd. All rghts reserved. do:10.1016/j.patcog.2005.08.011

90 I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 Trer and Taxt conducted a performance evaluaton of 15 bnarzaton methods by comparng the performance of OCR system wth respectve bnarzaton method as the frst step [4]. The Yanowtz Brucksten (YB) method produced the best results wth the Trer Taxt method just slghtly behnd. After the addton of a ghost-elmnaton step from Yanowtz and Brucksten method, the methods of Nblack [5], Ekvl Taxt Moen [6] and Bernsen [7] performed slghtly better. As wll be shown later, the last three methods are not scale-nvarant, and ther performance s optmal only for some specfc object szes or requres parameter tunng. The Yanowtz Brucksten method s scale nvarant, however the computatonal complexty of successve over-relaxaton method s expensve: O(N 3 ) for an N N mage and the resultng bnarzaton process s slow, especally for large mages. Furthermore, the threshold surface tends to have sharp extremum at the support ponts, and ths can degrade the bnarzaton performance. We here follow the approach of Yanowtz and Brucksten and use mage values at the support hgh gradent ponts to construct a threshold surface. However, we defne a new threshold surface va a method nspred by multresoluton representaton [8]. The new threshold surface s constructed as a sum of functons, formed by scalng and shftng of a gven orgnal functon. Ths new threshold surface can be stored n two ways: as an array of coeffcents a lj k,orasa conventonal threshold surface T (x,y) whch s obtaned as a sum of scaled and shfted source functons, multpled by approprate coeffcents a lj k. The threshold surface coeffcents a lj k are determned n O(P log(n)) tme, where P s the number of support ponts and N 2 s the mage sze. These coeffcents can then be used to construct the threshold surface T (x,y) over the entre mage area N 2 n O(N 2 log(n)) tme or to construct the threshold surface over smaller regon of the mage of M 2 sze n only O(M 2 log(n)) tme. Furthermore, the adaptve threshold surface can be made smooth over all the mage doman. The rest of ths paper s organzed as follows: Secton 2 revews the best performng methods accordng to Trer and Taxt evaluaton [4], Nblack [5], Ekvl Taxt Moen [6], Bernsten [7], and Yanowtz Brucksten [2]. Secton 3 descrbes a proposed new method to construct a threshold surface. Secton 4 descrbes the mplementaton of the surface computaton. Secton 5 presents some expermental results, comparng the speed and bnarzaton performance of the proposed method wth the methods of Nblack and Yanowtz Brucksten. Fnally Secton 6 summarzes ths work wth some concludng remarks. 2. Revew of bnarzaton methods 2.1. Nblack s method The dea of ths method s to set the threshold at each pxel, based on the local mean and local standard devaton. The threshold at pxel (x, y) s calculated as T (x,y) = m(x, y) + k s(x,y), (2) where m(x, y) and s(x,y) are the sample mean and standard devaton values, respectvely, n a local neghborhood of (x, y). The sze of the neghborhood should be small enough to reflect the local llumnaton level and large enough to nclude both objects and the background. Trer and Taxt recommend to take 15 15 neghborhood and k = 0.2. 2.2. Ekvl Taxt Moen s method The pxels nsde a small wndow S are thresholded on the bass of clusterng of the pxels nsde a larger concentrc wndow L, S and L are sldng across the mage n steps, equal to the sze of S [4,6]. For all the pxels nsde L, Otsu s threshold T [9] s calculated to dvde the pxels nto two classes. If the two estmated class means ˆμ 1 and ˆμ 2 are further apart than a pre-defned lmt l, ˆμ 1 ˆμ 2 l, (3) then the pxels nsde S are bnarzed usng the threshold T. Otherwse, all the pxels nsde S are prescrbed to the class wth the closest updated mean value. Trer and Taxt recommend S = 3 3, L = 15 15 and l = 15. 2.3. Bernsen s method For each pxel (x, y), the threshold T (x,y) = (Z low + Z hgh )/2 s used, where Z low and Z hgh are the lowest and hghest gray level pxel values n a square r r neghborhood centered at (x,y). If the contrast measure C(x, y) = Z hgh Z low <l, then the neghborhood conssts of only one class, that s assumed to be a background. Trer and Taxt recommend r = 15 and l = 15. 2.4. Yanowtz Brucksten s method The essental steps YB bnarzaton method [2] are the followng: (1) Fnd the support ponts {p } of the mage I(x,y), where the mage gradent s hgher than some threshold value G th, p ={x,y }: I(x,y ) >G th. (4) (2) Fnd the threshold surface T (x,y) that equals to the mage value at the support ponts and satsfes the Laplace equaton at the rest of the mage ponts: T(p ) = I(p ), 2 T (x,y) = 0 f {x,y} Ω\{p }. (5)

I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 91 Here Ω s the set of all the mage ponts. The soluton of Eq. (5) s found by a relaxaton method. (3) Determne the bnarzed mage B(x,y) accordng to Eq. (1). These three steps are a smplfcaton of the orgnal method, made n order to dscuss the essental steps wthout beng lost n the detals. The orgnal method also ncluded the followng steps. A smoothng of the mage before Step 1. The one-dmensonal relaxaton along the mage boundary between the Steps 1 and 2 n order to use the obtaned values as the Drchlet boundary condtons for Step 2. Dscardng of ghost objects after Step 3, determned as the objects n the bnarzed mage wth relatvely small gradents along the edge. The smoothng of orgnal mage and dscardng of ghost objects were omtted here, whle the one-dmensonal relaxaton along the boundary and use of the result as Drchlet boundary condton was substtuted by the use of Neumann boundary condtons n Step 3. The SOR starts wth an approxmate soluton t(x,y), and numercal teratons take t to the unque soluton T (x,y) of the Laplace equaton [2]. 2.5. Analyss of the bnarzaton methods In order to make a goal-orented evaluaton of the bnarzaton methods Trer and Taxt bult an expermental character recognton module. The bnarzaton methods were appled to a hand-wrtten hydrographc maps. Ellptc Fourer descrptors were extracted from the contour curve of the fgures to form 12-dmensonal features. Then the extracted features were fed nto the quadratc classfer [10], assumng multvarate Gaussan dstrbutons for each of the ten dgt classes. Accordng to the evaluaton by Trer and Taxt, the modfed methods of Nblack, Ekvl Taxt Moen, Bernsen, and the Yanowtz Brucksten s method were ranked, respectvely, to places 1, 2, 3 and 4. Obvously, ths evaluaton procedure could serve a good ndcator for the performance of the bnarzaton methods not only for the applcatons of recognton of hydrographc maps but also for other character recognton applcatons. However, the authors note that the generalzaton of the results to other applcaton domans s not straghtforward. In the followng paragraphs, we show that the methods of Nblack, Ekvl Taxt Moen, and Bernsen are scale dependent, and wll not work properly f the object szes or the scale of the llumnaton unformty vary sgnfcantly along the mage. The threshold surface, constructed n the Yanowtz Brucksten method does not have explct scale dependency. However, we shall show that the propertes of ths surface shade a doubt on ts optmalty for mage bnarzaton. In the Nblack s method, (2) T (x, y)=m(x, y)+k s(x, y) defnes the threshold T nsde the square of a fxed sze, typcally 15 15. Every such regon s separated nto an object and a background. Consder a completely whte regon, say, at the blank regon of the page. The pxels wll have some mean m and standard devaton s. Whatever the ntensty dstrbuton of the pxels, some pxels wll necessarly fall below the threshold T defned by Eq. (2). Therefore, n every mage regon of sze 15 15 some pxels wll be classfed as objects and some as a background. Ths wll be a msclassfcaton for the mages havng regons of blank or objects of sze 15 15 or larger. The recommended value k = 0.2 can be consdered as an ncorporaton of the pror knowledge and reflects the fact that more brght background than the dark objects s expected. In the Ekvl Taxt Moen s method the problem of sngleclass regons s treated somewhat better, snce the condton ˆμ 1 ˆμ 2 l, n Eq. (3) detects the cases of a sngle class n a regon. However, the exstence of a magc sze L = 15 15 makes the method scale dependent. Obvously, ths scale s about the best compromse, at least for the case studed by Trer and Taxt, however t can be too small for cases when the objects are large and too large for the cases when the llumnaton changes too fast along the mage. Bernsen s method s also scale dependent, as can be shown by applyng smlar arguments. In the Yanowtz Brucksten s method there s no explct scale factor, and therefore ths method s more approprate for the general cases. However, the prce of constructng the threshold surface that depends on the entre mage s hgh computatonal complexty. Really, every method that s lmted to a fxed square sze wll scale lnearly wth the sze of the mage t = O(N 2 ). In the relaxaton soluton each teraton requres O(N 2 ) operatons for N 2 grd ponts and there should be O(N) teratons to converge to a soluton, therefore the method complexty s O(N 3 ) [2]. The soluton of Eq. (5) can be found n just a O(N 2 ) tme usng multgrd methods [11]. However, t wll become clear from the followng paragraph that not only the speed of computaton but also the propertes of the threshold surface can be mproved. The general form of the soluton of Eq. (5) n the contnuum lmt s (x, y)=ψ(x, y) P =1 ) q log ( (x x ) 2 +(y y ) 2, where ψ(x, y) s smooth and bounded functon [12]. Ths soluton has sngulartes at the support ponts. In the case of a problem dscretzed on a fnte grd, the teratve soluton of Eq. (5) wll be fnte, yet, t wll have sharp extrema at the support ponts. These sharp extrema and especally the hangng valleys between them can cause the unwanted ghost objects n the bnarzed mage. These (6)

92 I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 Fg. 1. Soluton of the Laplace equaton by the over-relaxaton method. ghost objects where elmnated n Ref. [2], however, t s preferable to get rd of them already by a careful constructon of the threshold surface. To llustrate the sharp extremas at the support ponts and the hangng valleys n between, Fg. 1 shows a surface computed by SOR for 100 support ponts wth random values n the range of 0 100. The support ponts were randomly scattered over a 128 128 grd. Ideally, a good threshold surface should ndcate the local llumnaton level, whch s usually a smooth functon of the coordnates. Moreover, the value of an mage at a support pont probably ndcates the local llumnaton level n ts vcnty and there s no reason that t wll be a local extrema. Hence, what actually happens to the threshold surface obtaned by SOR soluton of the Laplace equaton s not what we would expect a good adaptve threshold surface to be. Therefore, t would be better not to put an nterpolaton constrant on the threshold surface, but to construct t as a smooth approxmaton of the support ponts thus makng t robust to nosy outlers among the support ponts. The next secton descrbes a new effcent way to construct such a threshold surface. 3. The new threshold surface We propose to construct and represent the threshold surface as a sum of functons, obtaned by scalng and shftng of a sngle source functon, smlar to what s done n wavelets or multresoluton representatons [13]. In multresoluton representaton [8] the coeffcents are calculated on the bass of an orgnal sgnal that s known a pror. In our case the complete threshold surface s not known n advance, but only ts approxmate values at the support ponts: T(p ) = I(p ) v. Here p ={x,y } and v = I(x,y ) denote the th support pont and ts value. Ths secton presents an effcent way to construct surfaces that nterpolate and approxmate mage values at the support ponts I(p ). Frst an nterpolaton algorthm s presented. However, the nterpolaton surface obtaned s dscontnuous and cannot serve as a good threshold surface. Therefore, a small modfcaton to the nterpolaton algorthm s presented, that results n a contnuous and smooth approxmaton surface. Let us consder a unt step source functon, gven by { 1 f (x, y) Ω(I), G 000 (x, y) = 0 f (x, y) / Ω(I). Here Ω(I) =[0, 1] 2 denotes the set of all the mage ponts. All the other functons we shall use are generated by downscalng of ths source functon and shftng the downscaled functons around the mage plane and thus cover only part of the mage: ) G lj k (x, y) = G 000 (x2 l j,y2 l k, (8) where l = 0,...,log 2 (N) s a scale factor and j,k { 0,...,2 l 1 } are spatal shfts. The threshold surface wll be gven by log 2 (N) T (x,y) = l=0 2 l 1 j,k=0 (7) a lj k G lj k (x, y). (9)

I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 93 3.1. Interpolaton algorthm Let us ntroduce an algorthm to calculate the decomposton coeffcents a j k n order to obtan an nterpolatng surface T (x,y) by Eq. (9), passng exactly through all the support ponts T(p ) = I(p ). The algorthm runs as follows: (1) The decomposton coeffcent a 000 s set equal to the average of all the support ponts a 000 = v (0) = 1 P 000 v (0). (10) P 000 =1 Here the frst zero n ndex 000 refers to the 0th resoluton level, the followng 00 refer to the only possble spatal poston at ths level. The support ponts {p } P 000 =1 are defned by Eq. (4) and P 000 s the total number of support ponts. After step 1 every support pont v (0) s already approxmated by the average a 000, so t remans only to nterpolate the dfference between the value of every support pont and the average. (2) The values of the support ponts are updated as follows: v (1) = v (0) a 000. (11) The quanttes v (1) wll be referred to as the frst-order resduals. (3) The mage s dvded nto four cells, wth correspondng ndexes {jk} relatng to the spatal poston of the cell: {00, 01, 10, 11}. The average of the updated support ponts v (1) of each cell jk s calculated to yeld the approprate decomposton coeffcent a 1jk : a 1jk = 1 P 1jk v (1). (12) p S 1jk Here p S 1jk denotes a support pont p that belongs to the cell at the 1st resoluton level, stuated at the (j, k) spatal poston. P 1jk denotes the number of support ponts n ths cell. (4) After step 3 the values of support ponts n each cell jk are approxmated by a 000 + a 1jk, so ther values are updated to be v (2) = v a 000 a 1jk = v (1) a 1jk. (13) (5) Steps 3 and 4 are repeated for successve resoluton levels. At every resoluton level (l 1) each of the 4 l 1 cells of ths level s dvded nto four cells to yeld 4 l cells at the resoluton level l. The coeffcents a lj k of the cells at level l at (j, k) spatal poston are set to be equal to the average of the resdual values of the support ponts, belongng to ths cell: a lj k = 1 P lj k p S lj k v (l). (14) Here p S lj k denotes a support pont p that belongs to the cell at level l, placed at (j, k) spatal poston. P lj k denotes the number of support ponts n ths cell. After calculaton of the coeffcents a lj k, the values of the support ponts are updated: v (l+1) = v (l) a lj k. (15) (6) The procedure ends at the hghest resoluton level L (L = log 2 (N) for N N mage), when the sze of the cell equals to one pxel. At ths step there s at most one support pont n every cell jk, wth a resdual value v (L). The coeffcent a Lj k s set to a Lj k = v (L). The threshold surface, constructed n accordance wth Eqs. (7) (9) wth the coeffcents a lj k obtaned by the algorthm as descrbed n steps 1 6, wll be an nterpolaton surface of the support ponts {p,i(p )},.e. t wll pass through every support pont. Ths can be proved by the followng argument: Consder some arbtrary support pont p. The value of the threshold surface at ths pont wll be T(p ) = L a lj l k l. (16) l=0 Where the j l k l chooses at every level l the cell that contans the p. On the other hand the resdual value v (L+1) of the support pont p equals to (step 6): v (L+1) = v (0) a 000 a 1j1 k 1 a Lj L k L = 0, (17) whch can be rewrtten as v (0) I(p ) = a 000 + a 1j1 k 1 + +a Lj L k L. (18) From Eqs. (16) and (18) t follows that for an arbtrary support pont p, T(p ) = I(p ). Fg. 2 shows the nterpolaton surface, obtaned by our method for the same set of support ponts that was used for the over-relaxaton soluton, shown n Fg. 1. 3.2. Approxmatng source functon The method presented n the prevous secton yelds a surface that nterpolates the support ponts. However, the obtaned nterpolaton surface s dscontnuous. In order to obtan an n-contnuously dfferentable approxmaton surface, the source functon (7) must be substtuted by n-tmes

94 I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 Fg. 2. Interpolatng surface, obtaned by a new nterpolaton method. Fg. 3. The source functon, gven by Eq. (19). contnuously dfferentable functon vanshng together wth n frst dervatves at the boundary of ts support. In the practcal case of fnte grd t s enough to consder a source functon havng a value and dervatves small enough at the boundary. However, there are three addtonal requrements from the source functon: (approxmaton) t should have value close to 1 n the doman of ts cell; (normalzaton) the ntegral of the source functon over ts support must be equal to the mage area; (smoothness) t should decrease gracefully towards the boundary of ts support. The frst two requrements are necessary n order to buld the threshold surface really approxmatng the support ponts and the thrd one n order to have t practcally smooth. As a compromse between these contradctng requrements we chose a source functon wth support [ 1, 2] [ 1, 2], extendng over the mage area [0, 1] [0, 1]. Therefore the threshold surface (9) s constructed wth scaled functons, overlappng at each resoluton level. It was found

I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 95 Fg. 4. An approxmatng surface, obtaned wth source functon (19). emprcally that source (19) gave a good performance: G 000 (x, y) { e (x 1/2)4 (y 1/2) 4 2 2 f {x,y} [ 1, 2] 2, = 1 1 e (x 1/2)4 (y 1/2) 4 0 f {x,y} / [ 1, 2] 2. (19) The pont {x,y}={ 2 1, 2 1 } s the center of the mage, spannng over [0, 1] [0, 1]. Fg. 3 shows the source functon (19). The support ponts that wll determne the decomposton coeffcents le n the central cell [0, 1] [0, 1], where the source functon (19) s practcally flat. Eght perphery cells wll overlap neghborng functons thus makng the threshold surface smooth. Fg. 4 shows the smooth threshold surface, constructed wth the source functon (19) for the same set of support ponts that was used to construct the nterpolated surfaces of Fgs. 1 and 2. Fgs. 1, 2, and 4 show the support ponts by vertcal spkes. Some of the support ponts of Fg. 4 are lyng apart from the threshold surface. Ths s due to the fact that support ponts have random values for demonstraton purposes and therefore the approxmatng surface passes far from some of the support ponts. In real cases, the neghborng support ponts usually have smlar values and the approxmaton surface wll be close to them. The new threshold surface s smooth. It does not necessarly pass exactly through the support ponts, however, ths s an advantage rather than dsadvantage, because f several neghborng support ponts have substantally dfferent and nosy values ths ndcates ether that the threshold surface s under-sampled by the support ponts or that there s some error or nose n ther values. In both cases there s not enough nformaton at the support ponts about the threshold surface and the best thng to do s probably to set the threshold surface somewhere n between, as done by the proposed approxmaton algorthm. 4. Implementaton The algorthm descrbed n the prevous secton was mplemented n Matlab. The subsectons below descrbe the data structures and then the algorthm mplementaton. 4.1. Data structures The basc data structures are two arrays: The frst array s called coeffs (Table 1), t stores the decomposton coeffcents of the cells a j k n the frst row and the number of support ponts P lj k of these cells n the second. a lj k denotes the decomposton coeffcent of the cell ljk, whch s stuated at the (j, k) spatal poston at the level l of the resoluton. P lj k stores the number of support ponts n ths cell. Frst column of coeffs stores the sngle coeffcent of the lowest level a 000 and the total number of support ponts P P 000, followng are four columns of coeffcents of the frst level (a 100,...,a 111 ) and number of ponts n each of these cells (P 100,...,P 111 ), etc.

96 I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 Table 1 Array coeffs a 000 a 100 a 101... P 000 P 100 P 101... Contans decomposton coeffcents a lj k and number of support ponts P lj k n the cell ljk. Every support pont belongs to one and only one cell lj l k l at every resoluton level l. There are log 2 (N) dfferent resoluton levels, startng from sngle cell of sze N N at level0ton 2 cells of sze 1 1 at level log 2 (N). The second array, called pontarr (Table 2), has P columns and 1 + log 2 (N) rows. Every column of pontarr contans the resdual value of the support pont p (l) n the frst row, and the ndces nd l n other rows. These ndexes refer to the cells whch contan p at every level l: coeffs[:, nd l ]=[a lj k ; P lj k ]. Fg. 5 shows an example of a pont, whch belongs to cell 000 at level 0 (as every pont does), cell 100 at level 1, to cell cell 211 at level 2, etc. Ths pont wll contrbute n the constructon of the threshold functon only through the coeffcents a 000,a 100,a 211,.... These coeffcents are stored n the frst row, columns 1, 2, 11... of array coeffs (Table 1). Therefore the column of pontsarr, correspondng to ths pont wll have values 1, 2, 11,... n ts second, thrd, fourth... rows. 4.2. Algorthm descrpton (1) Array ponts (Table 2) s created and gradually flled. Every column of ths table contans value of the pont p n the frst row. For every pont p a calculaton s performed to determne to whch cell lj l k l t belongs at each level l, l = 0,...,log 2 (N). The postons of Table 2 Array pontarr p 1 p 2 p p p log2 (N)1 p log2 (N)2 p log2 (N)p Column contans the ndces of the cells contanng p. these cells n the array coeffs (Table 1) are flled nto rows 2,...,N of th column of pontarr, and smultaneously, for every encountered cell the counter of the ponts belongng to ths cell s ncreased n the array coeffs. Ths requres P log 2 (N) calculatons of the cell ndex and P log 2 (N) ncrements of the pont counters (because each of P support ponts entered nto log 2 (N) cells). (2) The coeffcents a lj k n the array coeffs are calculated. a 000 s set to be an average value of all ponts (10). After ths the value of every pont n ponts s updated: average value s subtracted from t (11). (3) Step 2 s repeated for a hgher level: Every pont contrbutes ts current value to the cell t belongs to, ths value s dvded by the number of ponts whch belong to the cell. After all the ponts of a gven level have contrbuted ther resdual values to the cells, ther values are updated: from each pont belongng to cell lj k the value of a lj k s subtracted. (4) The threshold surface s bult based on the coeffs and the bass functon (19). Ths requres O ( N 2 log 2 (N) ) operatons. So an approxmaton surface for P support ponts scattered over N 2 grd s determned as a set of coeffcents usng O ( P log 2 (N) ) operatons and bult explctly usng O ( N 2 log 2 (N) ) operatons. In the reconstructon phase, the vrtual coeffcents beyond the mage boundary were created to effectvely mantan Newman boundary condtons. Cell_211 P Cell_100 Cell_110 P Cell_101 Cell_111 P Cell_000 Fg. 5. Cell herarchy.

I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 97 5. Expermental results The three methods, YB wth adaptve threshold surface obtaned by SOR and the new one wth adaptve threshold surface obtaned by multresoluton approxmaton and the Nblack s method were compared for speed and qualty of bnarzaton. The programs were mplemented n MATLAB and ran on an IBM-Thnkpad-570 platform wth 128 MB RAM and a Pentum-II 366 MHz processor. Four artfcal black whte mages were generated by smulatng non-unform llumnaton of the black and whte pattern. Ths allowed to gve a quanttatve measure of the error of the bnarzaton method. The error was calculated as a normalzed L 2 dstance between the bnarzed and the orgnal B/W mage. The post-processng step of ghostelmnaton was omtted for all the methods. Fgs. 6 21show the gray level mages and the B/W mages, reconstructed by the three bnarzaton methods. Table 3 presents the runtmes and the bnarzaton errors for each method. In Fg. 6. Gray level mage of Squares. Fg. 8. Squares bnarzed wth MA method. Fg. 7. Squares bnarzed wth YB method. Fg. 9. Squares bnarzed wth Nblack method.

98 I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 Fg. 10. Gray level mage of Text. Fg. 12. Text bnarzed wth MA method. Fg. 11. Text bnarzed wth YB method. Fg. 13. Text bnarzed wth Nblack method. the Nblack bnarzaton method the value of k from Eq. (2) was chosen to mnmze the error, ndependently for each mage. It was equal +0.8, 0.6, +0.05 and 0.2, respectvely for the Squares, Text, Rectangles, and the Stars test patterns. For the Squares test patterns theyb method gave the best results. The Text test pattern reveals the defnte superorty of the Nblack method for ths mportant class of mages. The Rectangles test pattern was created by addton of 1% salt and pepper nose to the gray level mage of a geometrc seres of rectangles. For ths pattern the proposed method gave the best results. Fnally, for the stars test pattern the proposed method gave the best results agan. The YB method had dffcultes n the large regons wthout support ponts near the boundary, whle the Nblack method gave perfect bnarzaton for the objects of specfc scale, and produced less mpressve results for larger objects, as predcted n Secton 2.5.

I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 99 Fg. 14. Gray level mage of Rectangles. Fg. 16. Rectangles bnarzed wth MA method. Fg. 15. Rectangles bnarzed wth YB method. Fg. 17. Rectangles bnarzed wth Nblack method. 6. Concludng remarks In ths work we proposed a new way to construct a threshold surface n order to mprove the Yanowtz Brucksten bnarzaton method. The new threshold surface s constructed wth consderably lower computatonal complexty and hence n much shorter tme even for small mages. The new method allows even more gan n speed n regon-ofnterest processng scenaros. The new threshold surface can be made smooth and by the nature of ts constructon should be smlar to the local llumnaton level. These qualtes allowed to expect a better vsual performance of the bnarzaton process. A bnarzaton wth the new threshold surface was compared to Yanowtz Brucksten and the Nblack methods on the set artfcal mages, wth 4 representatve cases presented and dscussed here. Consderng the expermental results t s apparent that there s no clear wnner. The Nblack method was the best for the Text bnarzaton.

100 I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 Fg. 18. Gray level mage of Stars. Fg. 20. Stars bnarzed wth MA method. Fg. 19. Stars bnarzed wth YB method. Fg. 21. Stars bnarzed wth Nblack method. Table 3 Comparson of the speeds and performance of the Yanowtz Brucksten (YB) and multresoluton approxmaton (MA) and Nblack bnarzaton methods Test mage Squares Text Rectangles Stars Runtme Error Runtme Error Runtme Error Runtme Error SOR 165.2 0.0063 160.2 0.212 160.7 0.191 161 0.312 MA 9.7 0.0072 11.4 0.312 15.9 0.078 13.4 0.096 Nblack 0.95 0.128 0.96 0.000 0.98 0.152 0.98 0.1745 The performance of the best method s prnted n bold.

I. Blayvas et al. / Pattern Recognton 39 (2006) 89 101 101 Another advantage of the method s ts speed and smplcty of mplementaton. However, Nblack method s scale dependent, and that made t nferor to Yanowtz Brucksten and our methods on the non-text mages, where objects of dfferent scales appeared. For these mages our method was comparable or better than the Yanowtz Brucksten method, whle havng a sgnfcant speed advantage. References [1] C.K. Chow, T. Kaneko, Automatc boundary detecton of the leftventrcle from cneangograms, Comput. Bomed. 5 (1972) 388 410. [2] S.D. Yanowtz, A.M. Brucksten, A new method for mage segmentaton, Comput. Vson Graphcs Image Process. 46 (1989) 82 95. [3] V.R. Southwell, Relaxaton Methods n Theoretcal Physcs, Oxford Unversty Press, Oxford, 1946. [4] D. Trer, T. Taxt, Evaluaton of bnarzaton methods for document mages, IEEE Trans. Pattern Anal. Mach. Intell. 17 (1995) 312 315. [5] W. Nblack, An Introducton to Dgtall Image Processng, Prentce- Hall, Englewood Clffs, NJ, 1986. [6] L. Ekvl, T. Taxt, K. Moen, A fast adaptve method for bnarzaton of document mages, n: Proceedngs of the Frst Internatonal Conference on Document Analyss and Recognton, Sant-Malo, France, 1991, pp. 435 443. [7] J. Bernsen, Dynamc thresholdng of grey-level mages, n: Proceedngs of the Eghth Internatonal Conference on Pattern Recognton, Pars, France, 1986, pp. 1251 1255. [8] S.G. Mallat, A Wavelet Tour of Sgnal Processng, Academc Press, New York, 1999. [9] N. Otsu, A threshold selecton method from grey-level hstograms, IEEE Trans. Systems Man Cybernet. 9 (1) (1979) 62 66. [10] D. Stork, R. Duda, P. Hart, Pattern Classfcaton, Wley, New York, 2000. [11] W.L. Brggs, A Multgrd Tutoral, SIAM, Phladelpha, PA, 1987. [12] R. Courant, D. Hlbert, Methods of Mathematcal Physcs, Interscence Publshers, 1953. [13] I. Blayvas, A.M. Brucksten, R. Kmmel, Effcent computaton of adaptve threshold surface for bnarzaton, n: Proceedngs of the CVPR, Hawa, USA, 2001, pp. 737 742. About the Author ILYA BLAYVAS receved hs B.Sc. from the faculty of aerophyscs and space research of Moscow Insttute of Physcs and Technology (MIPT) n 1992, and hs M.Sc. (wth honours) n laser physcs from Ben Guron Unversty n 1996. In 1996 1999 he desgned Monoltc Mcrowave Integrated Crcuts at Israely Armament Development Authorty, and n 2000 2001 he performed an electro-optcal characterzaton of CMOS mage sensors at Tower Semconductor ltd. From 2001 he s dong hs Ph.D. research n Computer Vson at CS Department of Technon. About the Author ALFRED M. BRUCKSTEIN receved the B.Sc. (honors) and M.Sc. n electrcal engneerng from the Technon, Israel Insttute of Technology, Hafa, and hs Ph.D. n electrcal engneerng from Stanford Unversty, Stanford, CA, n 1977, 1980, and 1984, respectvely. Snce 1985, he has been a Faculty Member at the Technon, Israel Insttute of Technology, where he currently a full Professor, holdng the Ollendorff Char n Scence. Durng the summers from 1986 to 1995 and from 1998 to 2000 he was a Vstng Scentst at Bell Laboratores, and n 2001-2002 a vstng chared professor at Tsng-Hua Unvarsty n Bejng, Chna. He served on the edtoral boards of Pattern Recognton, Imagng Systems and Technology, Crcuts Systems, and Sgnal Processng. He also served as a member of program commttees of 20 conferences. Hs research nterests are n Image and Sgnal processng, Computer Vson, Computer Graphcs, Pattern Recognton, Robotcs (especally Ant Robotcs), Appled Geometry, estmaton theory and nverse scatterng, and neuronal encodng process modelng. Prof. Brucksten s a member of SIAM, AMS, and MM and s presently the dean of the Technon Graduate school. He was awarded the Rothschld Fellowshp for Ph.D. Studes at Stanford, Taub Award, Theeman Grant for a scentfc tour of Australan Unverstes, and the Hershel Rch Technon Innovaton Award twce. About the Author RON KIMMEL receved hs B.Sc. (wth honors) n computer engneerng n 1986, the M.S. degree n 1993 n electrcal engneerng, and the D.Sc. degree n 1995 from the Technon Israel Insttute of Technology. Durng the years 1986 1991 he served as an R&D offcer n the Israel Ar Force. Durng the years 1995 1998 he has been a postdoctoral fellow at the Computer Scence Dvson of Berkeley Labs, and the Mathematcs Department, Unversty of Calforna, Berkeley. Snce 1998, he has been a faculty member of the Computer Scence Department at the Technon, Israel, where he s currently an assocate professor. He s now a vstng Professor at the Computer Scence Department, Stanford Unversty, and workng wth MedGude Inc. Hs research nterests are n computatonal methods and ther applcatons n: Dfferental geometry, numercal analyss, mage processng and analyss, and computer graphcs. He was awarded the Hershel Rch Technon nnovaton award (twce), the Henry Taub Prze for excellence n research, Alon Fellowshp, the HTI Postdoctoral Fellowshp, and the Wolf, Gutwrth, Ollendorff, and Jury fellowshps. He has been a consultant of HP research Lab n mage processng and analyss durng the years 1998 2000, and to Net2Wreless/Jgam research group durng 2000 2001. He s on the advsory board of MedGude (bomedcal magng 2002 2005), and has been on varous program and organzng commttees of conferences, workshops, and edtoral boards of mage processng and analyss journals, lke Internatonal Journal of Computer Vson, and IEEE Trans. on Image Processng. He s the author of Numercal Geometry of Images publshed by Sprnger, November 2003.