A robust parallel thinning algorithm for binary images

A robust parallel thinning algorithm for binary images

Pattern Recognition, Vol. 27, No. 9, pp. 1181 1192, 1994 Elsevier Science Ltd Copyright © 1994 Pattern Recognition Society Printed in Great Britain. A...

615KB Sizes 6 Downloads 121 Views

Pattern Recognition, Vol. 27, No. 9, pp. 1181 1192, 1994 Elsevier Science Ltd Copyright © 1994 Pattern Recognition Society Printed in Great Britain. All rights reserved 0031 3203/94 $7.00+ .00

Pergamon

0031-3203 (94) E0040- R

A ROBUST PARALLEL THINNING ALGORITHM FOR BINARY IMAGES A. DATTAt and S. K. PARUI t Computer and Statistical Service Centre, Indian Statistical Institute, 203 B.T. Road, Calcutta 700035, India ~.Electronics and Communication Sciences Unit, Indian Statistical Institute, 203 B.T. Road, Calcutta 700035, India (Received 29 July 1993; in revised form 21 March 1994; receivedfi~r publication 12 April 1994)

Abstract The class of multi-pass iterative thinning algorithms is considered. A new algorithm in the same class is proposed and is shown, on the basis of experimental results, to be superior to the existing ones with respect to medial axis representation and robustness. Some basic properties of thinning like 1 pixel thickness, preservation of connectivityfor the present algorithm are ensured for which theoretical proofs are also given. Binary object

Iterative thinning

Skeleton

I. INTRODUCTION Describing shape of objects is often necessary in image processing. While edges are used to represent the boundary of an object, the general shape of the object is represented by "stick figures". The former technique for shape representation of objects is boundary-based and the later one is region-based. Both the techniques have attracted researchers in the field of shape analysis and recognition of digital images. As a result a number of algorithms of a variety of natures exist for edge detection as well as for obtaining the "stick figures" and research is still going on. Our present paper deals with a shape-based technique for description of a digital binary object--that is, the process of obtaining the "stick figures", the so-called thinning process, from a binary object. In processing binary patterns, thinning has been of continuous interest for the past three decades and many algorithms have so far been suggested, t~ 91Thinning being the process of reducing the width of a pattern to just a single pixel is also sometimes called skeletonization and the thinned pattern is called the skeleton. Skeletons are useful for topological analysis and classification of the shape of patterns containing elongated or line-like parts (for example, printed or handwritten characters, chromosomes etc.). Character recognition systems require thinning for extracting the basic features of the characters. Other advantages of thinning or skeletonizatiorr are to reduce the memory space required to store the essential structural information of the pattern and to simplify the data structure required in processing the pattern. For digital binary objects there are numerous definitions of skeleton and hence thinning algorithms differ from each other in performanc~ and in implementation.

Medialaxis

Robustness

According to one of these definitions, the digital thinning process is defined as the removal of outer layers of object pixels in succession so that the general configuration and connectivity are not disturbed by any of these removals. There could be two serious outcomes when we remove the boundary pixel from the object. The skeleton derived may not preserve the connectivity of the object and the legs of the skeleton might become shortened. As a consequence the entire object may vanish in the thinning process. So the thinning algorithm should come to an end (we say it converges when no more pixels are removed), without altering connectivity or shortening skeletal legs. Different researchers have tackled this situation in different ways although their main approaches to the thinning process are similar.It-31 Thus the final skeletons obtained by different algorithms are not identical. Naturally there arises the problem of judging the best one. For example, Jang eta[. (4) have used mathematical morphology for thinning binary objects (call this algorithm A-II) and they have compared their results with that of some other algorithms ~1-3)(call these algorithms A-I). However, some criteria have been introduced which a good thinning algorithm should possess. ~z'5~ The skeleton should preserve the connectivity present in the pattern and the skeletal legs; and it should be 1 pixel thick uniformly. The skeleton should represent the medial axis. Furthermore, rate of convergence, computational complexity, robustness of the algorithm are also taken into consideration. The thinning algorithms so far developed can be classified into a number of classes. One broad classification would be sequential algorithms and parallel algorithms. Sequential algorithms operate on 1 pixel at a time and the operation depends on preceding processing results. Parallel algorithms operate on all

1181

1182

A. DATTAand S. K. PARUI

or a subset of all pixels simultaneously. Hence parallel thinning is substantially faster than the sequential one if the parallel processor is available. Since in real time environment fast processing is required, the sequential algorithms cannot meet the demand specially if the image size is large. Unfortunately, again, fully parallel thinning algorithms can have difficulty in preserving the connectivity of the object pattern. Many researchers have tried to overcome this problem by partially serializing the thinning algorithm. In other words, each iteration process of the algorithm contains more than one subiterations (passes) which are processed in a sequential manner. Each such subiteration tends to apply thinning operators to all parts of the object pattern in parallel. A n u m b e r of researchers have tried the thinning by removing successively the outer layers of pixels (boundary pixels) from an object while retaining any pixel whose removal would alter the connectivity or shorten a leg of the skeleton. This process is continued until no further pixels are removed. The thinning algorithm proposed here removes the outer layer of pixels in multiple passes. In each pass it removes a subset of the b o u n d a r y pixels in parallel and the output is passed to the subsequent pass. A boundary pixel is not removed if: (i) its removal alters the connectivity; or (ii) its removal shortens any leg of the skeleton. A pixel that satisfies (i) is termed as a critical pixel, and a pixel satisfying (ii) is termed as an end pixel. The thinning algorithm uses only four 1 x 3 (in fact, two 1 × 3 and two 3 × 1) basic templates. Apart from these it uses one more 3 x 3 window to prevent the deletion of a pixel which satisfies condition (i) or (ii). Some important results on the necessary and sufficient conditions (which can be checked in parallel) for a b o u n d a r y pixel to be a critical or end pixel are established on the basis of which the algorithm preserves the connectivity and general configuration of the skeleton. Attempts are made to compare the proposed algorithm with some of the existing algorithms of similar nature (multi-pass, iterative). Experimental results are compared in the light of some well accepted properties of a good skeleton, namely, 1 pixel thickness, connectivity, noise immunity, and good medial axis representation.

2. THE THINNING ALGORITHM

2.1. Definitions and results We shall now list the definitions that will be used in different contexts of our discussion. F o r any object pixel p there are four 4-neighbouring pixels (4-neighbours) namely P2, P4, P5 and PT; and eight 8-neighbouring pixels (8-neighbours) namely Pl, P2, P3, P4, Ps, P6, P7, Ps (Fig. l(e)).

Definition 1. ft.(p, q) is said to be an 8-path (4-path) of length n from an object pixel p to another object pixel q if there exists a sequence of object pixels (p = a 0, a~,

a 2. . . . . a, = q) such that ai is an 8-neighbour (4-neighbour) of a i_ 1, 1 < i _< n.

Definition 2. A subset C of the object pixels is called an 8-connected (4-connected) subset if for any two distinct pixels p, q • C there is an 8-path (4-path) in C from p to q. Definition 3. The maximal 8-connected (4-connected) subsets of the object pixels are called 8-connected (4-connected) components. In our paper we have considered the object (denoted by 1, unless specifically mentioned otherwise) to be 8-connected and hence the background or holes (denoted by 0) are 4-connected.

Definition 4. The boundary of an object is defined by the set of the object pixels each having at least one non-object pixel as its 4-neighbour.

Definition 5. The 4-connected component of non-object pixels which contains the top and bottom rows, and the rightmost and leftmost columns of the image is the background; and any other four-component of non-object pixels is a hole. Definition 6. A pixel p is called critical if its removal causes any disconnectivity or formation of a hole.

Definition 7. A skeletal leg is a limb of thickness one with one end not connected to anything. This pixel not connected to anything is called an end pixel. In other words, the end pixel has exactly one 8-neighbour.

Definition 8. A pixel p is said to be removable if it is neither an end nor a critical pixel. Consider the 3 x 3 window around pixel p, call it W. Let S be the set of 8 pixels in the window (Fig, l(e)) excluding the pixel p. That is, S = {Pl,P2, P3, P*,P~,P6, Pv, Ps}' If we concentrate only within the window W then we have the following results:

Theorem 1. If p matches (is in the middle of) any of the four templates (a)-(d) (Fig. I) then following are true respectively: (a) p is critical iff(p 2 = Ps = 1); (b) p is critical iff(p4 = P3 = 1); (c) p is critical iff (p2 = P6 = 1); (d) p is critical iff(p4 = Ps = 1).

0 and P3 = 1) or (Pv = 0 and 0 and Pl = 1) or (P5 = 0 and 0 and Pl = 1) or (P7 = 0 and 0 and P6 = 1) or (P5 = 0 and

Proof Consider case (a). It is given that p matches template (a). That is, P4 = 1, p = 1 and p5 = 0. This means p is a boundary pixel. Therefore, its removal cannot form a hole. Hence, in the present case, p is critical iff its removal causes disconnectivity. 'If', part: suppose P2 = 0 and P3 = 1. The two object pixels P, and P3 become disconnected when p is

A robust parallel thinning algorithm for binary images

11

o (a)

1183

o5111 (b)

(c) Pl

P2

P3

P4

P

P5

P6

P7

P8

(d)

(e) Fig. 1. (a)-(d) Four thinning 1 x 3 templates. (e) The 3 × 3 window of a pixel p. removed. Hence p is critical. Similarly, p is critical if p~ = 0 and Ps = 1. 'Only if' part: suppose p is critical. That is, removal of p causes disconnectivity. So, there is a pair of object pixels (Pi, Pj) (i # j , i, j e { 1, 2, 3, 4, 6, 7, 8}) such that Pi and pj are connected/disconnected before/after removal ofp. Now note that no such pair exists ifp2 = pv = 1. Thus either P2 = 0 or P7 = 0. If Pz = 0, then one of the object pixels Pi and pj has to be Pa, the other being from {Pt,P4,P6,Pv, Ps}. On the other hand, if P7 = 0, then one of the object pixels pi and p~ has to be Ps, the other being from {Pl, P2, P3, P4, P6}. Similar arguments hold for the cases (b) (d).

Theorem 2. If p matches the template (a) then p is end pixel iff Pi,P2,P3,P6,P7 and Ps are 0 (equivalently, Px + P2 + P3 + P6 + P7 + Ps = 0). Similar conditions hold for the other three templates. 2.2. The algorithm Firstly, we shall brief on the parallel thinning algorithms which already exist and which can be classified into a common class with respect to their basic nature. For example, we have considered the algorithms discussed above ~1-4~ in this common class for our study. The main characteristics that are common to all these algorithms are, they are iterative in nature and the boundary pixels are removed in multiple passes. The algorithms A-I consist of two cycles. The first cycle, consisting of four passes, uses a 3 x 3 template in each pass to remove boundary pixels from a given direction, namely, northwest or northeast or southeast or southwest (Fig. 2(a)). The second cycle is another iterative process to remove the north, east, south and west boundary pixels, and the unnecessary pixels (not critical ones, Fig. 3(b)) at junctures using the templates shown in Fig. 2(b). The algorithm A-II is also iterative in nature and each iteration consists of four passes. The difference is that it performs a sequence of morphological set transformations instead of the conventional

template matching as done in several cases." 3~ It makes a sequence of hit/miss transformations on the set of object pixels by the structuring templates (also called structuring elements) as shown in Fig. 2. The order of applying the transformation with different structuring templates is such that the homotopy of the object pattern and the skeletal legs are preserved. In all the above mentioned algorithms, after a finite number of iterations the original object pattern will converge to a 1 pixel thick skeleton. Like the above parallel thinning algorithms the algorithm proposed here is iterative in nature. It goes on removing the boundary pixels in each iteration. The removal of pixels is done in parallel. To preserve the connectivity of the original input pattern each iteration is subdivided into four subcycles. At each such subcycle a subset of the boundary pixels is removed. The four subcycles correspond to the right, top, left and bottom boundary pixels and each subcycle removes boundary pixels of only one of the above types. The corresponding templates (Fig. 1) for the four types of boundary pixels are (a), (b), (c) and (d), respectively. The templates (a) (d) are used for removing boundary pixels. A 3 × 3 window keeps a check at every pixel deletion so that the skeleton remains connected and the skeleton legs are not shortened. After a finite number of iterations, depending on the thickness of the input pattern, the input pattern converges to its skeleton which is uniformly 1 pixel thick and preserves the connectivity and the skeletal legs. Based on the theorems and definitions mentioned above the thinning algorithm can be described as follows:

Step 1. Remove all pixels in the input pattern in the following four substeps (passes): (a) Remove all pixels that match template (a) and are removable; (b) Remove all pixels that match template (b) and are removable; (c) Remove all pixels that match template (c) and are removable;

1184

A. DATTA and S. K. PARUI

0

0

x

x

0

0

x

1

x

x

1

x

0

1

1

1

1

0

1

1

0

0

1

1

x

1

x

x

1

x

x

0

0

0

0

x

(a)

x

0

x

x

1

x

x

1

x

x

1

x

1

1

1

1

1

0

1

I

1

0

i

1

x

1

x

x

1

x

x

0

x

x

1

x

(b)

0

0

X

0

0

0

X

0

0

X

1

X

0

1

1

0

1

0

1

1

0

0

1

0

0

0

X

X

1

X

X

0

0

0

0

0

0

0

1

0

0

0

0

0

0

1

0

0

0

1

0

0

1

0

0

1

0

0

I

0

0

0

0

0

0

1

1

0

0

0

0

0

(c) Fig. 2. (a)-(b) Matching templates or structuring templates used in algorithms A-I and A-II. Object pixels are 1, background pixels are 0, x means do not care. (c) Trimming templates used for noise elimination. Bold pixel is the centre of the template.

1

1

0

0

1

0

1

1

1

0

1

0

0

1

0

1

I

0

0

1

0

1

1

1

0

1

1

0

0

1

1

1

1

0

1

0

(a)

0

0

1

0

1

0

0

1

0

0

1

0

0

i

1

1

i

0

1

i

1

0

I

1

1

1

0

0

1

0

0

0

0

0

1

0

(b)

Fig. 3. (a) Examples where the bold 1 pixels are critical because their removal causes disconnectivity or formation of hole. (b) Examples where the bold l pixels are not critical because their removal preserves the connectivity.

A robust parallel thinning algorithm for binary images (d) Remove all pixels that match template (d) and are removable.

1185

not trivial. Let us explore the possibility that some object pixel q, other than p, in W gets removed in the same pass. Assume that q belongs to the first row of W. Since a necessary condition for q being removed in the same pass is that it matches template (a), there are following possible configurations for the first row of window W (Fig. 4(a)):

Step 2. G o on repeating Step 1 until no further changes occur in the image pattern, that is, no further pixels are removed. Note that the templates (a)-(d) ensure that only boundary pixels are removed and hence no hole is formed during any pass of the iterations, while the other criteria of a skeleton are met by the following proposition.

(i) p~ = 1, P2 = 1, P3 = 1 and q is P3; (ii) Pl = 1, P2 = 1, P3 = 0 and q is P2; (iii) Pl = 0, Pz = 1, P3 = 1 and q is P3; (iv) Pl = 1, PE = 0 , and q is Pl (pixel just left to p~ = 1, call it r).

Proposition. After a finite n u m b e r of iterations the algorithm converges and produces a non-empty skeleton which is 1 pixel thick and preserves the connectivity of the original object pattern.

It is easy to see that even if q is removed simultaneously with p, in each of the cases (i)-(iii), the object pixels in the first row are connected to P4 and in case (iv) there must exist an object pixel outside W (like pixel r above) which is connected to P4. Similar argument can be given when q belongs to the third row of W in which case the corresponding object pixels are connected to P4 again. Thus connectivity is assured in the pass we considered. Similar argument holds for the other three passes. Lastly, since a single template from (a) (d) is applied in each pass and output of each pass is passed on to the next pass, at the end of each iteration connectivity is guaranteed. This proves the claim that after some iterations there will be no pixel to be removed (i.e. when the algorithm converges). Next we prove that the skeleton is 1 pixel thick. It suffices to show that at any pixel of the final skeleton there does not exist any of the 2 × 2 square patterns as shown in Fig. 4(b) unless the pixel is critical. This is obvious since some of the templates (a) (d) will detect these 2 x 2 patterns and remove the origin pixels unless it is a critical one. This completes the proof.

Proof. If the input pattern has any isolated object pixel then it is obviously not removed as it does not match any of the templates (a) (d). Due to the same reason any pixel which is not a boundary pixel is not removed. The templates (a)-(d) allow only the boundary pixels to be removed. Again a b o u n d a r y pixel is removed if it is neither a critical nor an end pixel within its local 3 × 3 window. Therefore, the critical and end pixels will remain even if the iterations are continued indefinitely. Thus the converged image cannot be empty. We shall now show that the derived skeleton preserves the connectivity. Consider a particular pass say, Step l(a) above. Consider the 3 x 3 window W around an object pixel p (Fig. l(e)). The pixel p is removed if it matches template (a) and p is removable. In other words, we have P4 = 1, p = 1, P5 = 0. It is to be noted that in a single pass we are removing the boundary pixels (which are removable locally) in parallel and hence the preservation of the overall connectivity is

i

i

!

i

!

o

! o

i

!

1

1

0

1

1

0

1

i

0

i

!

o

1

I

(a)

x

1

1

x

i

1

1

1

1

1

1

1

1

X

X

1

i l

(b)

Fig. 4. (a) Possible configurations when an object pixel ( = 1) can be removed in the first row of the window, bold 1 is pixel p and underlined ! is pixel q. (b) The 2 x 2 square patterns (origin is bold, x means do not care).

1186

A. DATTAand S. K. PARUI 3. EXPERIMENTALRESULTSAND DISCUSSION

The algorithm has been tested on different patterns and the results are compared with those from the other algorithms (Figs 5-7). With respect to robustness and medial axis transformation, it has given better results which will be discussed in the rest of this paper. 3.1. Robustness An important aspect of thinning algorithm is noise immunity. If the original object contains noise at the boundary, the skeleton should not deviate much from the skeleton of the same object without noise. Such noise effects can be eliminated by a smoothing opera-

tion to smooth out the noisy boundary of the input pattern before the thinning process. But this operation involves an added preprocessing step which is not desirable in some applications with real time constraints. A serious problem with the algorithms tl-4) is that they produce noisy skeletons if the input patterns contain noisy boundary (Figs 5(d) and 6(d)). However, these algorithms have tried to eliminate the noise by applying a set of additional eight trimming (cleaning) templates (Fig. 2(c)) simultaneously with the thinning templates. These templates help to suppress the growth of spurious limbs generated by the boundary noise. But the problem that arises in this process of noise removal is that it cannot distinguish between noise

, , , , . , , ~ ° , , , , . .

• o • • , . * * * * * * * * * , ~ , , e , ~ . , o , , . , ,

****...

• ..*

...*..

• *.

*..*

....

, . * * * * . . * . . . . . . .

• . • . . .*

....

****.

(a) ....



.

.

.

.

• ..*,... ..*

.

*.. .

.

.

. . . * . . . . ,.~,.

• ....~

*.

....

*... .*..

..

..***

* * . . . . . , ~ . . . . . . ~ o . , , . . o 1 , o ~ , ~ . ~ . o o . , ~ . . . , , . , , ~ , , , o ,

• .*

.*..

.*..*. .**. , , , , ° , . . * . . , . , , o o

o~..

*.*.

, ° . o ° , o , . , o * . . o . ° o . o ° , . , , o , ° , , o , . , ~ , , . , . , e . . , , o , e . , , o . , , . ® * o . . , . , , . . . , .

(c) o o , , e , , o . # , , o W , , . o , . o , . , . , ~ * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

(b)

Fig. 5. Results of algorithms A-I. The '*' represents the skeletal pixels and '" represents the object pixels. Background and holes are represented by blanks.

1187 . ° . . .******... • e***

° ..,

......

. . . °,..

******

°...,°

............... ..............

....

**

* * * * * * * * * * * * . , . .

(d)

**** . .***.**.. ..**.

.,...

..,..

....

* .........

...*..*.********..

.4to

..,.

.,...

.,o

. .,..

,..

.-W.-

o**.

.,...

.4r. .****

.,...

.~.

°°..

.'k. .'k.

.°.°.

,

, .....

°°...

,

, ......

°.ooo

,

, ....

.W....°Q.....*

o*ooooo~.ooooWoo • * ..

. . . . . ~ . ° . . . . . . . . o . . o , . . . . ° . * * * * * * * * * * * * * * * * * * * * * * *

. .*..

• *

.*..o

• *

.*.

°

....

. . . . . ~ . . . . . . . . . Q . . . . w ~ . . . . . • *

.***

• ***...***....

......

.....°.°~.........

(e)

(f)

***.....

.....

..~°o.. o...W°.

....*.......o~.... ....*......*...° ....*....*....

.....

.... .... ....

**

* .... * ......

* ........

.....

* .... * .... * ....

. ~ . ° ~ . . . . . . . . . ~ ° o o . *..°W..

~,Wo...

..°..~.

.~.....

....*o.

..*°...

o.°~.o.

°..W...

.°.*...

.°.*.**

..*....

....**.

***...°.

.....***

(g) Fig. 5. (Continued)

***

1188

A. DATTAand S. K. PARUI

spurs and end pixels of skeletal legs. Thus skeletal legs are no longer preserved. Moreover, the trimming operation increases the total implementation cost. In the worst case 1 pixel thick limbs can be reduced to a single pixel because the trimming templates will treat the end pixel(s) as noise spurs of unit length. In fact, this discrimination is fundamentally impossible with the 3 x 3 templates and thus one way to deal with the problem is to assume knowledge of the approximate size of the object so that the number of iterations can be predetermined for termination of the thinning process. In contrast, the proposed algorithm produces clean skeleton (Fig. 7(d)) straightway from the thinning process. It does not require the additional trimming

template matching along with the thinning operation, and skeletal legs are also preserved perfectly. 3.2. Medial axis representation The skeleton should well represent the medial axis, i.e. the derived skeleton should be as close as possible to the ideal medial axis. Experimental results (Fig. 7) show that this closeness is very high for the present algorithm. From the results of algorithms A-I it is quite clear that these algorithms produce biased skeletons and in some cases the bias is very high (for example, Fig. 5(b) and (e)). As argued by Jang and Chin, (4) the possible reasons for the bias are" (1) the applying order

,,,,,,,,,o,,°,, ,,°,°,o°,,o,,O° ***....**

....********,..

,,,,

,,.,°o

.****..*. .....

• ,***.

• o*..*-



• .*"

o,.,,,-

(a) o~o.o

.....***.*.***,..''" ********************** • *.

......

*.,,*..-.,.'***

,,,o,,o~o,e-,,,

• ..

*.

o...,o,o..~o..°oo-,." *. .... .....

. • ,,**.-** ,,**

.....

......... .**

.......



.oo..**.........,**'''''" oo..**...,o.,o....,.W*.o,., ,.**,,,.,..,.,o.---'''**''"

(b) Fig. 6. Results of algorithm A-II.

(c)

1189

.

~

.

~

.

~

.

~

~

,

.

.

° ° . . . ° ° ° o . ~ e . . . . , ° ° . . , ° . o . . . . . ~ . ° . ° . . , . ° ° . . ~ ° , ° ° o . . ° ° . . , . , ° ° . . . ~ . .

(d) .°°.

e . . . . . * . . ° . . . . °

. ~ . .

~

,

, . ~ . . . ~ . . .

.

....

~

~

~

.

.

.

. . . . . . . .

~ . .

. . ~ . .o~°°

,,~°.

. . ~ . . . ~ 0 . . -~. ..~,° .o.~.o . ~ . °

.

~

~

.

~

.

.

. . ~ . . . ~ . . ~k ~

.

~

~

~

.

.

.

~

.~..

.

.o~.. ,~.. 'k

..~. . , ~ . . . . ~ . ,

~ . .

. ~ .

• ~ . . ~ . . ....

. ~ . . ~ . .

~

~ . . . . ~

. . . . ° ° ° . ° , ° . o ° ° ° ° °

(e)

(f)

~e°°o,°°

eooo.°°~

, ° o ~ ° , .

,°~°oe.

.°°°~°o

eee~°ee

°°o~°°.

°°,°~*°

° e ~ . ° ° . o°~°°..

e o * ~ * ° . ° ° ° ~ . ° .

. . . .

~..~

• . . . . ~ .

.... ....

. . . ° ~ . ~ . . . . , . ° o ° ~ . , . ~ ° ° ° * . ° . ° i ° . . . . ~ . o ° o ° ° . ~ ° ° ° ° o . . ~ , ° ° ° ° ° o ~ ° * ° . ° ° ° ° ° ~ o ° . , * ° ° ~ . ° ° . ° e ° ° e e ° ~ ° ° ° ° • . . ~ . . .

°.~oo.o

• e°~e,o

oo°~*°*

• o°~eeo

, ° . ~ ° , .

ot°~.°e

• ~ ° . o

°**~o*.

.

.

.

.

(g) Fig. 6. (Continued)

~ o .

1190

A. DATTA and S. K. PARU1

of the templates are such that they remove pixels from convex corners faster than from concave corners; and (2) the algorithms consist of two cycles--the first one removes pixels from convex corners and the second one removes the same from concave corners and thus aggravate the symmetry. On the other hand, both the algorithm A-II and the algorithm proposed here use only one cycle and thus the produced skeleton has much less bias. Jang and Chin has also introduced a measure (fl) to quantify the closeness of the extracted skeleton to the ideal medial axis. They have defined fl by Area [A'] f l = - Area [A]

o

,

,

,

,

,

,

,

°

,

,

,

,

,

where A = set of all object pixels in the input pattern; A' = union of the maximal digital disks (included in A) centered at all the skeletal pixels; and Area [.] is an operator that counts the number of pixels. Then fl ranges from 0 to 1 and the derived skeleton is identical to the ideal medial axis if fl is 1. The closer the value of/3 is to 1, the better is the skeleton with respect to the medial axis representation. Thus fl measures the closeness of the extracted skeleton to the true medial axis. Jang and Chin found the average values of fl to be 0.712 and 0.881 on a number of patterns for algorithms A-I and algorithm A-II, respectively. In our case the values of fl has been computed for a number patterns and their average is found to be 0.931. From this it can be inferred that the skeleton extracted by

,

*o

* t ~ i o * * l o o l e l e

* .

* o ~ l e * l J e o o l o e

.

.

.

.

***,.

ol~,Jo

.*.

,.*..°

io~*oo

*.,

.*.

.o~ea*

.*,

.*..

eioooo*

.****,

e * o o , e *

.....

,*.,****.. *,*,* °,***,,.

....

*. *..

(a) ...*°°o. ...*..°. °.W°., .,.*.°°o °°,,°*°,,,°°

o°W,.

o,,,,o°~°.,.°°,,, ,.,,~°°°,

,°°,oo***..***....,,

,°,.,*,,,..

**********************

,°.°°~°,,,,

***.,,,...*.,*,..,.oo**,

°,°,°,~,.,,°°

,°°,o,,,W°,°,,,,o ,°°°°°,.Wo°°°,,,. ,°°,o°°.,W,°,°.,,°°

oo°°°°°,°.W.o°°°°oo°.

.°.,....o**.** .....,..** ......

**

**,...

.........

**

.,..,**.o°o.. o.,**.,, ,**.,.°,o,o

..... .....

..... .....

.... ....

,... .... ......

,.** ....

..... .**...

..,o....,**,

(b) Fig. 7. Results of the proposed algorithm.

(c)

*.. *.. °~°°. .**. °°°~,

119 *********************************

(d) o

,

,

°

,

°

,

o

°

,

°

,

°

,

,

,,**,, ,,**,,*,,.

• ,,.*

.....

,...**,, .°~,,

,W*.,

°.**o o.Wo, ,oW°o

°°~o.

.W,,,

,~°.°

,.~,,

,,W.°

,~ooo ,,Woo ,,*oo ,.*.°. o.~..o o~°°o.°o..°~,, .*°

,°*o

..*********.*.. ,~,,,o°o°...,~., .°*°° .o*o.

.,~.,.,...,°.°.o...°.~,,

o*°.

*************************

..*.. °*°.

°* .

.

.

.

*. .°*..

o*.o

°.*o

• .*,*,,

°.*,*,

.°*oo

,

(e)

(f) ....

,**°.°° °.°~,,o oW,.,

goem~eo ooa~*ll

• o**

.......

**,,,

.o,*,°,,,*o,.,

...**,,,...*,,,,

,o.~,o°o.°..,,,~°°oo ,,.W..°

,,*...o

.°,.W°°

,,W,oo. o,,*.°°. .°o*o.,

o,,~.°°

..°*o,o

o°**°°. ***,.,,.

(g) Fig. 7. (Continued)

**,

1192

A. DATTAand S. K. PARUI

the proposed algorithm is on the average closer to the medial axis compared to the algorithms A-I and A-II. 4. CONCLUSIONS For digital binary objects there are several definitions of skeleton and hence thinning algorithms differ from each other in performance and in implementation. Moreover, the skeletons obtained by different algorithms are not identical. Some criteria of good skeletons have been discussed. The skeleton should preserve the connectivity present in the pattern and it should be 1 pixel thick uniformly. The proposed algorithm ensures these two properties for which theoretical proofs are also given. The algorithm has been tested on different patterns and the results are compared with those obtained from the other algorithms of similar nature. It has given better results according to the above criteria. The skeleton should well represent the medial axis, i.e. the derived skeleton should be as close as possible to the ideal medial axis. Experimental results have shown this closeness to be very high for the present algorithm. Another important aspect of a thinning algorithm is noise immunity. The algorithms A-I and A-II produce a noisy skeleton if the input pattern contains noisy boundary while the algorithm discussed here produces clean skeletons. The existing parallel thinning algorithms use 3 x 3 templates (eight or more in numbers) for thinning operation and another set of templates for trimming to eliminate the noise. The difficulty with trimming

operation is that in some situation it fails to preserve the skeletal legs. The algorithm described here uses only four 1 x 3 templates and one 3 × 3 window. Moreover it does not require any trimming operation. Computations can further be reduced by marking the critical and end pixels and thus avoiding the template matching in subsequent iterations for such pixels.

REFERENCES

1. C. Arcelli,L. Cordelia and S. Levialdi, Parallel thinningof binary pictures, Electron. Lett. ll, 148-149 (1975). 2. H. Tamura, A comparison of line thinning algorithms from digital geometry viewpoint, Proc. 4th Int. Joint Conf. Pattern Recog. pp. 715-719. Kyoto, Japan 0978). 3. C.J. Hilditch, Comparison of thinning algorithms on a parallel processor, Image Vision Comput. l, I 15-132(1983). 4. B. Jang and R. T. Chin, Analysis of thinning algorithms using mathematical morphology, IEEE Trans. PAMI 12, 541-551 (1990). 5. A. Rosenfeld,A characterization of parallel thinningalgorithms, Inform. Contr. 29, 286-291 (1975). 6. R. T. Chin, H. K. Wan, D. L. Stover and R. D. Iverson, A one-pass thinning algorithm and its parallel implementation, Comput. Vision, Graphics, Image Processing 40, 30-40 (1987). 7. T. Y. Zhang and C. Y. Suen, A fast parallel algorithm for thinning digital patterns, Comm. of the ACM 27, 236-239 (1984). 8. C. M. Holt, A. Stewart, M. Clint and R. H. Perrott, An improved parallel thinning algorithm, Commun. of the ACM 30, 156-160 (1987). 9. Y.S. Chen and W. H. Hsu, A systematic approach for designing 2-subcycleand pseudo 1-subcycleparallel thinning algorithms, Pattern Recognition 22, 267-282 (1989).

About the Author--AMITAVADATTAreceived his Master's degree in Statistics from the Indian Statistical

Institute in 1977 and did a post-graduate course in Computer Sciencefrom the same institute in 1978. After working for a few years in reputed computer industries he joined the Indian Statistical Institute as a System Analyst in 1988. Since then he has been working in image processing and pattern recognition. From 1991 to 1992 he visited GSF, Munich as a Guest Scientist and worked on query-based decision support system. His current interests are in neural net based image processing and computer vision.

About the Author--S. K. PARUIreceived his Master's degree in Statistics and Ph.D. degree from the Indian

Statistical Institute in 1975 and 1986, respectively. From 1985 to 1987 he held a post-doctoral position in Leicester Polytechnic, England and during 1988-1989 he was a visiting scientist in GSF, Munich. He has been with the Indian Statistical Institute from 1987 and is now an Associate Professor. His current research interests include shape analysis, image processing, statistical pattern recognition and neural networks.