13
COMPUTER GRAPHICS AND IIv[AGE PnOCESSlNa (1974)3, (247-9,59) A Search Algorithm for Skeletonization of Thick Patterns I. S. N. MUHTHY Dept. of Electrical Engineering, Indian Institute of Science Bangalore, India AND K. J. UDUPA School of Automation, Indian Institutde of Science Bangalore, India Communicated by A. Rosenfeld Received May 4, 1974 An algoritbm is proposed in this paper for obtaining the "medial line" or the "skele- ton" of a thick pattem. The method introduces new concepts of a "turning point" and an "end point." The present method for thinning binary patterns is a two stage process. During tbe first stage tbe method ernp]oys four different pairs of operators to test and indicate the existence of vertical, horizontal, right and left inclined limbs in the pattern and to extract the respective end and turning points. During the second stage the medial line of tbe pattern is obtained by constructing the limbs from a knowledge of the already extracted end and turning points by a simple search procedure. The results obtained by the present method on hand printed alphanumerics are better than those obtained by the existing methods. The extraction of turning and end points also facili- tates coding and easy recognition of the given patterns. These results will be reported elsewhere. 1. INTRODUCTION In the area of pattern recognition, for several reasons, preproeessing opera- tions precede the actuaJ extraction of features and consequent recognition. Usually the thickness of the limbs does not contribute to the recognition even if the given pattern is a planar, binary picture with line like struc- ture(s). One of the objects, then, is to obtain the "skeleton" of a given pattern by removing the irrelevant details as it is much easier to extract the features from this skeleton. If this skeleton happens to be the medial line of the pat- tern without distorting the structure or the connectivity of the original pat- tern, it is all the more ideal. Many excellent algorithms [1,2,3,5] exist in the literature for skeletonization of a thick pattern. These algorithms, without caring for the pattern structure, scan the given binary picture matrix making use of a 3 x 3 square window or other suitable window sizes [4,6]. In these algorithms the window is centered successively at each individual point in the binary pattern and the conditions given in the algorithm are tested. Copyright © 1974 by Academic Press, Inc. 247 All rights of reproduction in any form reserved,

A search algorithm for skeletonization of thick patterns

Embed Size (px)

Citation preview

Page 1: A search algorithm for skeletonization of thick patterns

COMPUTER GRAPHICS AND IIv[AGE PnOCESSlNa ( 1 9 7 4 ) 3 , (247-9,59)

A Search Algorithm for Skeletonization of Thick Patterns

I. S. N. MUHTHY

Dept. of Electrical Engineering, Indian Institute of Science Bangalore, India

AND

K. J. UDUPA

School of Automation, Indian Institutde of Science Bangalore, India

Communicated by A. Rosenfeld

Received May 4, 1974

An algoritbm is proposed in this paper for obtaining the "medial line" or the "skele- ton" of a thick pattem. The method introduces new concepts of a "turning point" and an "end point." The present method for thinning binary patterns is a two stage process. During tbe first stage tbe method ernp]oys four different pairs of operators to test and indicate the existence of vertical, horizontal, right and left inclined limbs in the pattern and to extract the respective end and turning points. During the second stage the medial line of tbe pattern is obtained by constructing the limbs from a knowledge of the already extracted end and turning points by a simple search procedure. The results obtained by the present method on hand printed alphanumerics are better than those obtained by the existing methods. The extraction of turning and end points also facili- tates coding and easy recognition of the given patterns. These results will be reported elsewhere.

1. I N T R O D U C T I O N

In the area of pa t t e rn recogni t ion , for severa l reasons, p r e p r o e e s s i n g ope ra - t ions p r e c e d e the actuaJ ext rac t ion of features and c o n s e q u e n t recogni t ion . Usual ly the th i ckness of t he l imbs does not con t r ibu te to the r ecogn i t ion e v e n if the g i v e n pa t te rn is a planar , b inary p ic ture wi th l ine like s t ruc- ture(s). O n e of the objects , then , is to obtain the " s k e l e t o n " of a g iven p a t t e r n b y r emov ing the i r r e l evan t detai ls as it is m u c h easier to extract the f ea tu res f rom this ske le ton . I f this ske le ton happens to be the m e d i a l l ine of the pa t - tern wi thou t d i s tor t ing the s tructure or the connec t iv i ty of the original pa t - tern, it is all the m o r e ideal . Many excel lent a lgor i thms [1,2,3,5] exist in the l i terature for ske l e ton i za t i on of a thick pattern. T h e s e a lgor i thms, w i t h o u t car ing for the pa t t e rn s t ructure, scan the g iven b inary p ic tu re matr ix m a k i n g use of a 3 x 3 s qua re w i n d o w or other sui table w i n d o w sizes [4,6]. In t h e s e a lgor i thms the w i n d o w is c e n t e r e d success ive ly at each indiv idual po in t in the b inary pa t t e rn and the condit ions g iven in the a lgor i thm are t e s ted .

Copyright © 1974 by Academic Press, Inc. 247 All rights of reproduction in any form reserved,

Page 2: A search algorithm for skeletonization of thick patterns

248 MURTHY AND UDUPA

Moreover these algorithms are based on the principle of elimination of con- tour points in stages and retaining the final points [3] which constitute the skeleton of the pattern. Sometimes hexagonal or triangular windows [4] are used as operators for this elimination of points not belonging to the medial line. These algorithms mainly suffer from two drawbacks. In the thinned pictures the open ends of the limbs get shortened, this shortening being dependent upon the thickness of the limbs. Second, for patterns with limbs of uniform thickness, the skeletons obtained are not just composed of the straight medial lines of various limbs, instead distortions occur at the junc- tions and at the open ends of the inclined limbs (see Fig. 17).

The algorithm suggested in dais paper works in two stages: first, four pairs of operators along with the final point conditions given extract the end points (e.p.), turning points (t.p.) and strings of final points fi'om the vertical, hori- zontal, right and left inclined limbs present in the pattern. Once these points are extracted, the medial line of the pattern is constructed by a simple search procedure. The results obtained by the present method on hand printed alphanumerics are free from the drawbacks mentioned above. Furthermore, the thickness of a limb may vary; however, this is subject to the condition that the thickness remains constant over a minimum length of six picture elements. Recognition of the given pattern from a knowledge of its t.p.'s and e.p.'s becomes simple. The results will be reported in a separate paper.

2. THE ALGORITHM

The complete process of skeletonizing the given binary pattern is shown in Fig. 1. There are two principal stages, viz (i) extraction of final points including t.p.'s and e.p.'s; and (ii) construction of the skeleton fl'om a knowl- edge of the t.p.'s and e.p.'s by a search procedure.

A. Extraction of Final Points

This is a multistage process consisting of four subcycles. The four pairs o£ operators which effectively extract information about the final points from the vertical, horizontal, right and left inclined limbs of a given pattern are shown in Figs. 2, 4, 6 and 8, respectively. The respective final point (in- cluding t.p.'s and e.p.'s) conditions are given in Figs. 3, 5, 7 and 9. Each sub- cycle consists of scanning the given pattern by a pair of operators and then testing for the associated final point conditions.

The flow chart for the subcycle involving extraction of final points from vertical limbs is shown in Fig. 10. The general scheme for one subcycle is as follows, Assume that the given binary pattern is stored in two matrices A and F. Select one amongst the four pairs of operators. Scan matrix A parallelly with the first operator of the pair first and then with the second of the pair under consideration. During this process an operator is centered at each element of A and its eight neighbors as defined by the operator are tested to see whether or not they satisfy the conditions of the scanning operator. If satisfied, the center element is made zero, otherwise it is unaltered and the operator moves to the next point. The scanning process is continued with

Page 3: A search algorithm for skeletonization of thick patterns

SEARCH ALGORITHM FOR SKELETONIZATION

i I Operotor pair l Of fig,~.and | FL.PT conds.o(I

fig. g.

strings 1 of 5 s in F

E, inary --~. Pattern A,F

lot f ig .) and J ]of fig.4.and [

strings o! 2~ in F

I of flg.11,

F' ~--

T. P, CondltIOns P Conditions ' of f ig 12 I

o,,gl, I

ond I r.ond$. I

strings I of~p

T1,T2 T3, T4 ,TS[ ~ E 1 E2, E3 I E4, T6 j T7 j TS. ~ ES~ E6jE7 EIB.

Scorch from T.Ps. and E.Ps.

The skeleton of the pattern,

Fie. 1. Block Schematio of the A]gorithm,

2 4 9

Co) (b)

FIG. 2. Operator pair for vertical limbs.

lO i ! o

FIG. 3. Final point conditions.

(o) (b)

FIG. 4. Operator pair for horizontal limbs.

Page 4: A search algorithm for skeletonization of thick patterns

250 MURTHY AND UDUPA

FIG. 5. Final point conditions.

I I I

(o) I I I

I I 0

. . . . (b)

FIG. 6, Operator pair for right inclined limbs,

o , , ,o,

1 1 1 01 0 1 1

1 1 0 1 1 0 1 1 1

FIc, 7. Final point conditions,

I I I

o I I

(a) (b)

FIG, 8. Operator pair for left inclined limbs.

i ~o ~ 11 i~o

1 I I 0 I 1 0 I 1

0 I I I 01 I 0 I

FIG. 9 Final point conditions,

Page 5: A search algorithm for skeletonization of thick patterns

SEARCH ALGORITHM FOR SKELETONIZATION 251

r °

J

No

" ° N O

FIG. 10, Flow chart for extracting final points from vertical limbs,

the two operators of the pair working alternately. However, at some stage should one of the operators cease to be effective (i.e., none o£ the points in the modified matrix A satisfy the conditions of that operator) one has to con- tinue to scan with the remaining operator, until no further changes take place. Call this resultant matrix A'. As a result of the above operation some of the l 's in A become O's in A'.

The final points are those elements of A' which satisfy any one of the final point conditions associated with the operator pair. The elements in F corre- sponding to the final points in A' are replaced by one of the digits 2 or 3 or 4 or 5 depending upon the operator type (2 for vertical, 3 for horizontal, 4 for right inclined and 5 for left inclined limbs). At the completion of a subcyeIe, strings of one of the above four digits appear in flae modified F matrix.

After the conapletion of the above subcycle, one has to proceed in a similar way with the remaining three subcycles, each time using a pair of operators and the respective final point conditions. Before the commencement of a

Page 6: A search algorithm for skeletonization of thick patterns

252 MURTHY AND UDUPA

X4 X31×2

X5 XO Xl

X6 X7 X8

1 d d d 3 d 1 1 d d d 1

1 2 2 # 3 d 1 4 4 1 5 5

1 d d i 1 1 d d 1 1 1 1 : 1

Make ×1=1 M o k e x 3 =1 Make x1=1 M ( ~ k e x l - 1 d~dont care

FIG. 11. Redundant point conditions.

n e w subcycle, one has to start with the original matrix A which can easily be ob ta ined from the modified F matrix.

Thus at the complet ion of the four subcycles one finds strings of 2's, 3's, 4's and 5's in the modified F matrix indicating the existence of vertical, horizontal, right and left incl ined limbs in the pattern. Depend ing upon the thickness of a limb, sometimes there may result two adjacent parallel sb'ings of final points of the same kind. Under these circumstances the string corre- sponding to the bes t medial line is retained using the additional conditions shown in Fig. 11. When any of the conditions shown in this figure is satisfied b y a point in the modified F matrix, an appropriate neighbor of it is con- ver ted to a 1 as indicated. Also it is possible that some points satisfying the final point conditions do not appear in strings and are isolated. Such points are not considered as true final points and are converted to l 's. The matrix ob ta ined after making the above modifications is designated by F ' .

End and Turning Points

Turning points are the points in F ' that satisfy one of the conditions of Fig. 12. Accordingly w e classify them into eight kinds viz. T1, T2 . . . . . T8 as shown in Figs. i 2 a - h (T1 for the conditions of Fig. 12a, etc.). End points are the points in F ' that satisfy one of the conditions of Fig. 12 and a cor- responding condition in Fig. 13. We classify them also into eight kinds viz E l , E2 . . . . . E8 (thus E1 is a point in F ' satisfying the conditions of Figs, l ga and 13a, etc.). In other words, e.p.'s E l , E2 . . . . . E8 are the t.p. 's T1, T2 . . . . . T8 satisfying the additional conditions of Figs. 13a, i3b , . . . l ah respectively. Thus using the conditions of Figs. 12 and 13, t.p.'s and e.p.'s are extracted.

1 1 i 1 2 1 1 1 1 1 1 1

1 2 1 1 2 1 ,3 3 1 I 3 ~ i

1 2 , 1 1 1 1 1 ~ 1 1 ~

( a ) T 1 ( b ) T2 (C )T3 (d ) T4

1 1 1 1 1 4 1 1 1 5 1 1

1 4 1 ; 1 4 1 1 5 1 1 5 1

4 1 1 i l 1 1 1 1 5 i 1 1

( e ) T 5 ( f ) T 6 ( g ) T 7 ( h ) T 8

FIG. 12, Turning point conditions.

Page 7: A search algorithm for skeletonization of thick patterns

SEARCH ALGORITHM FOR SKELETONIZATION 253

( L j}

(e )E5

Z I×l×lx_L l 2 I i j ) I t ,J) ( e ) E3

1

X (d) E4 ( i., j)

X

0

~a -~ Vg] r-J-1

X 5 0 o , ' I ( g ) E7 (h) E8

FIG, 13. Additional conditions for end points.

B. Search Procedure

To start with, the information in matrix F ' regarding strings of 2's, 3's, 4's, and 5's is transferred to a new matrix D with all the remaining elements of D being made zeros. The search is made on matrix F ' which now contains digits O's, l 's, 2's, 3's, 4's, and 5"s some of which are e.p.'s and t.p.'s. The final points de tec ted in the search procedure are stored in D.

Starting with a t.p. the search for another t.p. is made in all the eight direc- tions. In this process one may encounter a 0, 1, 2, 3, 4 or 5 at each step. If a 1 is encountered in a direction the search is continued in that direction. I f either a 0 or a digit not indicative of the direction of search (see Fig. 14a) is encountered one has to come back to the point from which the search began. On the other hand, if the digit consistent with the search direction is en- countered all the elements in the path be tween this point and the t.p. are registered as final points. This is clone by replacing the corresponding O's in matrix D by the appropriate digit. After completing the search in eight direc- tions, move to the next element fl'orn the t.p. in a direction appropriate to that t.p. as shown in Fig. 14b (thus one continues to move to the e lement just above (below) and in the same column for T1 (T2)) and continue the search in eight directions only if this new element is a 1. Othe~vise the search procedure for the tp . under consideration is complete and one has to pro- ceed to the next t.p. The process has to be repeated for all the t.p.'s in F '

Page 8: A search algorithm for skeletonization of thick patterns

9.54 MUI:{THY AND UDUPA

(o)

T7 TI ~ El T5

(b}

F~G. 14.a. Digits assigned to different directions, b. Directions associated with end points and turning points.

Search from End Points As pointed out earlier, an e.p. indicates an open limb and during the

search process, starting fi'om an e.p., one need search in one direction only as ' indicated by the arrows in Fig. 14b till a 0 is encountered. Then the O's in D corresponding to the elements along the path be tween the e.p, and the first 0 encountered are replaced by a digit appropriate to the e.p. This p r o c e s s is repeated for all the e.p.'s. At tbe completion of this step, matrix D conta ins strings of 2's, 3's, 4's, and 5's which constitute the skeleton of the g i v e n pattern.

3. EXAMPLE

T h e various operations described above for skeletonizing a given pattern are i l lustrated for the handprinted letter K. The digitized pattern is shown in Fig. i 5 a which is stored in two matrices A and F of size 47 × 47.

I11111111 klltIllli III1111U 111111111 lilll]lll }i1111111 ]11111111 IIIIIIiii L ~ L L I I I 1 L L L L I L I l L L~Illllll !IllllLii LIIIIlIII iiii}1111 111111111 111111111 iiii11111 111111111 I111LI111 1111}1111 111111111 111111111 lllIlllll lllIlllll

1111tilll 111111111 IIIIiiiii 11111111[ l l l I l k l I 1 1 1 ~ 1 1 1 1 1 1 ~IiIi1111 lllLlllll 111111111 111111111 IiiiI[III 11111111! ~Ll}l!lll il~iliLli IIili1111 ]llllliLl 111111111111111111 11111111111]1111111 !1iiI?11111111111111 Iiti11111111111111111 1111111111111111111111

1 1 1 1 1 1 1 1 1 1 l ~ l l l l } L ! l l II[IIIIIlLI 1111111111 llIliilll 111111111 11111111!

IIIIIIIIL 1 1 1 1 1 1 1 1 1 111111111 111111111 iii111111 iI~Ii1111 111111111 I11111111

l l l l l ~ l l l Iiiitlili 111111111 111111i11 i11|11111 l'.Li,[i1~ 111111111

1 1 1 1 1 1 1 1 1 1111111}I 11111111! I111111~i 111111111 iii1111}1 IIiiii111 1111111~i

6t

[ l l l l l l l l l l l l l l l l l t l l l / ! l l 1 ! k I ; i l l , * l ! ! i 1111111111111111111111~[[IIIiiiIIIII1111 1 1 1 1 1 I i 1 1 1 i 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ~ 1 1 1 1 1 1 1 1 1 1 ! 1 1 l i 1 1 1 1 1 1 1 1 1 ! 1 1 1 1 1 1 1 1 1 1 1 1 1 ; l i l t

l l l l 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 t l l l l l l l I l ? ~ l l l l l l l l I l l l l l i l l l l l l l l l l l [ l l l l l l l l l l l i l l l l l I ! I l l [ I ) I I ~ ] [ I ~ I I I ~ : . I L I L I A I ! ~ I ~ I l I I I ! ! 1 1 1 1 1 1 1 1 1 1 1 l l l l l l l l H l l t t l I I ! I L I L l l l l i l t t t t 1 l ~ l ~ l l l i l l l I } l ] i 1 1 ! , lllll iii11! 1 1 1 1 1 1 1 1 l ! 1 11111 1 i 1 1 1 1 ~ l [ l l l I l l [ 1 11111 llllll lillll lllll .11111 !11ili [!,!~I 11111 ~111i 111111 lillll IIiii IIiII lilt11 llIIll Ii!!i

1111 l l l l l l l l l l l i 1111 1 1 l l [ 1 1 k 1 1 1 1 1 1 1111}

11111 l X 1 1 1 l l 11111

~1 111 1 1 1 1 1 1 1 1 } 1}}I1 l l i i 1 1 1 1 1 1 1 1 1 1 1 ,111}i

1 1 ~ I ~ " : l i l i l ~LLI] , . l l l l l 11111 iLllll 111111 11111 1111| I111tI 111111 Iiiii

1 1 } l l 1 1 l ! l l 111111 11111 11111 Iiiiii l l l l i l l l l L [ 11ii Ililll 111~i? : ~ I ' ~

11111 111111 lilltlli111 ii111111111 illlk111il I!Ilti:ilI 111!iiiii I11]IItlI111111!]iii1111111111iliIIi1111 I i l l l l [ l l t l l l L ~ L l I l l L i l L I L l t l l l L l I I L L I I ]~.}ll'llil)~!.}'i:I~l:11]iiL.it:'~.i 111111i111iIIii11111111111i111i111111111 l l l l [ l l l } | l l i l l I l l I } L 1 1 1 1 1 t l l l l l l l l l L l t } 1 1 1 1 l I 1 1 1 1 i 1 1 1 1 1 1 1 1 1 I l l l 1 1 1 1 1 1 ~ i . ~ t ! . + 11111111111111!I11}1111111;111111121}111 III111i111111111111111111111111111~Ii111

FIG. 15. Data matrices for the examples.

Page 9: A search algorithm for skeletonization of thick patterns

SEARCH ALGORITHM FOR SKELETONIZATION 255

Consider the operator pair of Fig. 2 which extracts information from ver- tical limbs. First the operator in Fig. 2a scans matrix A in parallel and modifies it; and then this is followed by the operator 2b which may further modify A. Thus the two operators of the pair operate parallelly and alter- nately on the modified A matrix obtained at the end of the previous scan. As mentioned earlier this process is continued (with one of the two opera- tors even if the other ceases to operate) until no further changes take place. Now the points in modified A satisfying any one of the conditions of Fig. 3 are the final points of the vertical limbs of the pattern. All such elements are designated by the appropriate digit viz 2, resulting in strings of 2's in the modified mah'ix F.

Before proceeding with the second and succeeding operator pairs, the original matrix A of Fig. 15a is obtained from the above resultant F matrix. The scanning operation on A with the operator pair of Fig. 4 is carried out and the final point conditions tested. At the end of this step strings of 3"s (index for horizontal limbs) are not indicated in matrix F, showing that the operator pair is ineffective in this example. Repetition of the process for the operator pairs in Figs. 6 and 8 with the respective final point eonditions of Figs. 7 and 9 gives strings of 4's and 5's in F indicating that the given pattern contained right and left inclined limbs. The conditions of Fig. 11 are then used to get rid of strings (of 2's, 3's, 4's or 5's as the case may be) running parallel and adjacent to the strings of final points (best medial lines). The resultant matrix obtained after the above operations is shown in Fig. 16a and this constitutes matrix F'. The t.p.'s obtained by using the conditions of Figure 12 are T1, T2, T6, TT. The e.p.'s are those that satisfy the respective conditions in Figs. 19. and 13 as mentioned earlier. These are shown as E~, E~, E5 and E8 in Fig. 16a for the example under consideration.

The search procedure is carried on matrix F'. To obtain the skeleton start from T1 in F' and search in all the eight directions. In all but the vertically upward direction a zero is encountered after passing through a few l 's . One should not proceed to search in the direction in which a zero is encountered. In the vertically upward direction digit 2, which is appropriate to the vertical direction is encountered after a few l's (ten l's). Accordingly the zeros in matrix D (which for this example contains strings of2's, 4's and 5's separated by zeros) corresponding to these l's in F' are replaced by 2's. Next move to the element immediately above TI in F ' and if this is a 1 the search in eight directions (now only in six directions since the vertically upward and down- ward directions have been exhausted in the previous step) is continued as above. In general, after completing the search in eight directions com- menced from the t.p. T1, one has to keep on moving to the successive elements in the upward direction (for other t.p.'s these directions are in- dicated by arrows in Fig. 16a by the side of the t.p.'s). Here again the search from the new element in six directions is continued only if it is a 1. Other- wise the search for the t.p. T1 is complete. Note that in the present case after crossing three l's in the vertically upward direction from T1 one comes to an element T~' and during the search in six directions from T~', t.p. T6 (with 4

Page 10: A search algorithm for skeletonization of thick patterns

256

t~'t

~VfURTHY AND UDUPA

! : i ~ : : : H 1 i i ~ ' ? : : E~/ ] 2 " - ' I ~ ' 2 1 1 1 ~ 1 1 1 . i , ; , 3 , i i i 1 . 1 1 ~ 1 ] ~ 7

," i I ~ 1 , : ? , ! i'I~:~'! ; Z t i ¢ : i . l l Z t l , , l l i . , . : . . . , ' I ) - - ! I L :

~ . I ' ; : ! ' i ~ L ; ; l . . l l ] : l : , ] l l ! I l L t 4 i l t l i I 1 . " ' 11 " " !,ii;]11~ ~ l . ~ . l i * iiii?I~; ii11411[!

__ i l l ~ l ~ i l l L ~

iri :~: ' ' ' : :~I" i I ) ] ! l , I ; i - . .

I : '.~- t J i l L ' - , . 1 1 ] ! ] : 1 •

TI' i ~ ' ¢ " ~ l t " , i , , !i] ! ~I. I I.!

t r l . '''i~ ~*!' ~ ' ] , - ~ ' . " ~' . l l l

'~ ' ~, : 2 l ! '

] . ' . l ' ~ t ' . ! ! . ! , ~

a

FIG. 16a. Final point matrix (F ') for Fig. 15a.

44

! • . . - ' . 3 s 3 . . 5"~:3'!,~'..•3. ' . ~33

25 42 ~_ L. 2 5 2

~ 2. s 44 2

2 2 ~ ~ % ~ 22

44 44~ i 2 :, 2

4 ~ 5 Q 2 , 4 ~ :, 4 2

2 , ~ -'v," 2 4 5 2 * 5

4 b 2 4 e ~b 2

4 h ~ 4 5 b 2 24 2 2 2 c 2 44 5 2

s 2 5 , ~ + 5 2

2 5 2 4 '4 5 2 2

2 !'~ 2 4 ~ 2 2 3 ~ 4 5 2

33333 $33~ !3 J 3 3 3 3 3 3 3 3 3 3 a 3 3 3 3 3 3 3 ~ 3 ~ 3 3 3

b c FIGS. 16b, and e. Skeletons of the patterns in Figs• 15a,b.

as the index) appropriate to the search direction (viz. north east from TI') is encountered. Consequent ly the zeros in maLrix D corresponding to the e l e m e n t s b e t w e e n T,' and T6 are made 4"s. As a result of the above search t.p. T~ gets connected to T2 and T6. In a similar way T6 and T7 get con- nected.

Corresponding to the four open limbs there are four e.p.'s. The search from an e.p. n e e d be made in only one direction as indicated in Fig. 14b.

Page 11: A search algorithm for skeletonization of thick patterns

S E A R C H A L G O R I T H M F O R S K E L E T O N I Z A T I O N 257

Thus starting from E8, during the search in the southeast direction a 0 is en- countered after crossing three r s in F '. The O's in matrix D corresponding to these three l's are replaced by 5's. The same procedure is adopted for the remaining e.p.'s. The resultant skeleton for the hand printed K is shown in Fig. 16b.

As a second example, a pattern containing vertical, horizontal, right and left inclined limbs with different thicknesses for different limbs is shown in Fig. 15b. The skeleton obtained by the present method is shown in Fig. 16c. The skeletons obtained by thinning the patterns in Figs. 15a and 15b using

! i

: i l

i

i l

!

! 1 I

l

I 111

111

i i 1 1~1 1 1 1 i i i l i Ii l t ii l L I I 1

I I I I i I i i

1 11 i 1 11 1 1 ii | l 11 I 1 II I l 11 } I I I i l I i 1 i I i i I 1 11 i ). III ) 1 ) 1 ] I'I

111 1 1 ! 1 l

11 1 I 1 1 l l 1 1 1 1 1 1 t 1 1 1 t 1 1 l 1 1 1 ! 1' 1 " I l

t t 1

l l ~ I

a

i i

I I

I l

1 I

1 1 1 1 1 1 1

i 1

1 I

1

l I l l

I i I

1 i

i I

L I

i 1

I l

I l ]

l

I i i i

1

b

i]ii.I!i!i!itlii1111!ili l l l l l l l

I I

i

!1 l i

! 1

i

1 11 1

: l I t

i i " 1!

LT l !

! 1 i 1

7_ l l ! I L

! i l !

i ~. ! I 1~ i i 1

,~l 11

~I i ~ l ! i

I I I l i

i i 1 '. llt !i: ill I lILl~ -i iIIi iI i't II ~l I

c

i i

T

I

i

i t

i i I 1 L

i 1

i 1

l l l ! ] l ! l ] 111 i 1 ! 1 ~ ] 1 1 . 1 1 1 1 1 1 i 1 I l l J i

• 1 ! 1 l 1 I !

I 1 i l ] 1

i 1 1 1

1 l 1 L .1

I ] I [ I !

. I I I , 1

! i I

i i i

1

! l ] l t l t i ! l l ] t l l l l l l l ~ l l l l l l l l d

FIG, 17. Skeletons obtained by other algorithms.

Page 12: A search algorithm for skeletonization of thick patterns

258 M U R T H Y AND U D U P A

the algorithms of Stefanelli and Rosenfeld and that of Deutsch are shown in Figs. 17a, 17b and 17c, 17d, respectively.

It can be seen that the distortions at the junctions of the limbs and at the open ends of the inclined limbs in Figs. 17a, 17b and 17e, 17d are absent in Figs, 16b, c. Also note that in Fig. 16b there is no shortening effect at the two ends o£ the vertical limb, whereas Figs. 17a and 17b show this effect, the amount of shortening being proportional to the thickness of the limbs. Be- sides, the predominant edge erosion at the comers of Figs. 17b and d is ab- sent in Fig. 16e, obtained by the present method.

4. COMMENTS

1. Patterns that do not contain open limbs will not have e.p.'s. For the ex- ample in Fig. 15b only t.p.'s are obtained. Patterns with no t.p.'s do not have any closed path(s) and junction(s) of limbs and there exist at most two e.p.'s. Such patterns are simple strokes or line segments.

2. If for a given pattern there are many t.p.'s search from a few of them is generally sui~cient to connect the relevant paths between them, Therefore, the search from those t,p,'s which are already connected terminates at the beginning itself. Before starting the search from a t.p, in F ', one could easily verify whether that tp . has already been connected to some other t,p. or not by testing the neighbors of that point in D which corresponds to the t.p, in F '. Thus in practice search need be made at most from half the total number of tp. ' s in a given pattern,

3. To obtain the skeleton it is not necessary to extract the e.p.'s explicitly. Alternatively the following procedure can be adopted, One may start from points in F ' satisfying any one of the conditions for t.p.'s. The final points obtained during the search from all such points in F' are stored in matrix D. At the completion of this search process, the final point information is trans- ferred back to F '. The points which were labelled as e.p.'s earlier still satisfy the conditions of Fig. 12 and by the application of the search procedure explained for e.p.'s one gets the skeleton of the given pattern.

5. CONCLUSIONS

A basic and more /undamental algorithm for obtaining the skeletons of thick patterns with line like structure is proposed. The algorithm introduces new concepts of a "turning point" and "end point" and extracts these points from horizontal, vertical, right and left inclined limbs using four different pairs of direetionally sensitive operators. Once these points are extracted construction of the skeleton of the given pattern is done by a simple search procedure. The skeletons obtained by the present method do not exhibit shortening of open limbs; noise at the junctions of two or more limbs and at the open ends of the inclined limbs; or erosion of the edges at the corners. Also, the present method retains the connectivity of the diagonals to the proper point at the comers, whereas the results obtained by other methods show that while retaining the connectivity property, the diagonals bend away from the corners. The results obtained by the present algorithm on

Page 13: A search algorithm for skeletonization of thick patterns

SEABCH ALGORITHM FOR SKELETONIZATION 259

hand printed alphanumerics are better than those obtained by the existing algorithms. The algorithm is pattern size invariant and works for patterns with varying thicknesses o£ limbs subject to the condition that the thickness of a limb remains constant over a minimum length of six picture elements.

ACKNOWLEDGMENTS

The authors are grateful to Professor I. G. Sarma and Professors Joseph Vithayathil and B. L. Deekshatulu for all the help and encouragement given during this work and to Professor A. Rosenfeld, University of Maryland, U.S.A., for the useful discussions the authors had with him during his brief visit to Bangalore. Mr. Udupa is thankful to the Council of Scientific and In- dustaial Research for awarding him a research fellowship.

REFERENCES

1. D. RUTOVlTZ, Pattern recognltion, J. Rou. Star. Soc., 129, 1966, 504-530. 2. C. J, HILDITCH, Linear skeletons from square cupboards, in Machine Intelligence IV

(B. Meltzer and D. Michie, Eds.), pp. 403-420, American Elsevier, New York, 1969. 3. R. STEFANELLI AND A. PxOSENFELD, Some parallel thinning algorithms for digital pictures,

]. Assoc. Comput. Maeh. 18, (9.), 1971, 255-264. 4. E. S. DEUTSCH, Thinning algorithms on rectangular, hexagonal and triangular arrays,

Commun. Assoc. Comput. Math. 15(9), 1972, 827-837. 5. E. S. DEUTSCrI, Preprocessing for character recognition. IEE-NPL Conference on pattern

recognition, Teddington, Mddx, July 1968. Conf. Publ. 4g, IEEE, London, pp. 179-190. 6. P. NARAGA AND D. J. WOOLLONS, The design of operators for pattern processing, Ref. 5 , pp.

106-116.