Systematic approach for designing 2-subcycle and pseudo 1-subcycle parallel thinning algorithms

Systematic approach for designing 2-subcycle and pseudo 1-subcycle parallel thinning algorithms

Pattern Recognition, Vol. 22, No. 3, pp. 267 282, 1989. Printed in Great Britain. 0031 3203/89 $3.00 + .0() Pergamon Press plc Pattern Recognition So...

1MB Sizes 8 Downloads 42 Views

Pattern Recognition, Vol. 22, No. 3, pp. 267 282, 1989. Printed in Great Britain.

0031 3203/89 $3.00 + .0() Pergamon Press plc Pattern Recognition Society

A SYSTEMATIC APPROACH FOR DESIGNING 2-SUBCYCLE AND PSEUDO 1-SUBCYCLE PARALLEL THINNING ALGORITHMS YUNG-SHENG CHEN* and WEN-HSING HSU*~ *Institute of Electrical Engineering,National Tsing Hua University, Hsinchu, Taiwan 30043, R.O.C.: and tInstitute of Information Science, Academia Sinica, Nankang, Taipei, Taiwan, R.O.C. (Received 5 November 1987; in revised Jbrm 11 May 1988; received jbr publication 21 July 1988)

Abstract This paper describes a systematic approach for designing parallel thinning algorithms, in which three new functions, named local connecting, extended local connecting and erosive direction number, are introduced. With these functions as well as two properties of shape invariance of local edges and local straight lines, all the possible cases of 2-subcycleparallel thinning algorithm are constructed and all the corresponding removing conditions are generated and assigned automatically. In addition, the pseudo lsubcycle parallel thinning algorithm is also presented. Finally, the effects and efficiency of the above proposed algorithms are analyzed and compared with those of some presently well-known algorithms. Experimental results confirm this new approach, and an efficient and effective algorithm has been built for practical applications. Thinning algorithms Localconnecting Extendedlocal connecting Erosivedirection number Shape invariance Thinning window Parallel processing 2-subcycle Pseudo 1-subcycle Compatibility of matching deleting-conditions

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

During the past two decades, many thinning algorithms have been designed,w 18~ The thinning algorithm usually is an iterative edge-point erosion technique, where a 3-by-3 window is moved over the entire image with a set of rules applied to the contents of the window. In general, three types of thin line are focused, i.e. 4-connected, imperfectly 8-connected and perfectly 8-connected curve.O9) Three important requirements for the thin line are the preservation of line connectivity, the satisfaction of isotropy and the avoidance of excessive erosion (serious shrinking). The implementation of thinning algorithms may be designed in sequential fashion12'7'° 11.13 15) or in parallel.ll,3-6.s,12,16 18) Through Tamura's investigations, 4-connected versions of thinning algorithms usually yield noise branches and excessive erosion. "9) Other detailed illustrations can also be found in Naccache's paper. 113~ Excessive erosion may also appear in the imperfectly 8-connected version, such as the efficiency-oriented algorithm proposed by Zhang and Suen112) and its improved version by Holt et al. t16) This drawback has been indicated by us, "8) and will be illustrated again in Section 5.4. For providing a convenient abstraction of line-like patterns, the thin line is always expected to be perfectly 8-connected.t2°) Among several efficiency-oriented thinning algorithms proposed, 14'12 ~4.16,18~we recommend the par-

allel version for practicability as Smith tzl) pointed out. In general, the efficiency of an algorithm is tested by a general-purpose computer in CPU-time, ~4'12 14~ or an array processor in number of time-units, i.e. the complexity of an iteration (or subcycle); t16) and commonly in number of iterations. We have proposed a table mapping strategy "g) so that the problem of efficiency is only concerned with the number of iterations. Obviously, the most efficient algorithm must be the version which spends the fewest timeunits and the fewest iterations under the premises of remaining the perfect 8-curve and preventing excessive erosion. However, as Stefanelli and Rosenfeld14~indicated, a 1-subcycle/iteration parallel version has the disadvantage that it may yield non-connected or even empty medial lines for connected figures. For instance, a two-pixels-wide straight stroke will be entirely eliminated by a single iteration. Therefore, the 4subcycle/iteration and 2-subcycle/iteration versions performed in parallel are of interest too, and have been developed by many researchers. 1.'5 6 . 8 , 1 2. ! 7 1 8) Three 1-subcycle/iteration parallel algorithms have been developed by Rutovitz,tl) Deutsch, 13) and Holt et al. ~16~ respectively. Through Tamura's investigations~t 9) for the two former schemes and the examinations in this paper for the last scheme, it is found that these three algorithms will yield imperfectly 8connected curve and/or excessive erosion, and therefore result in a large number of iterations. Deutsch had modified the original Rutovitz's scheme and

267

268

YUNG-SHENGCHEN and WEN-HSINGHSU

overcome the deficiency of excessive erosion, but the modified version will yield a highly biased thin line. Accordingly, we can conclude that up to now, no 1subcycle/iteration parallel thinning algorithms have been successfully developed which produce the perfectly 8-connected curve. To develop a parallel thinning process which can reduce the number of iterations and the time complexity of an iteration, produce the perfectly 8-connected thin line, and prevent excessive erosion, we propose a new systematic approach which can induce not only 2-subcycle/iteration but also pseudo 1-subcycle/iteration parallel thinning algorithms. ("Pseudo" means "not exact", see Section 4 for details.) When using this new approach in designing parallel thinning algorithms, the property of dividing 2 subcycles in an iteration is obtained. The 2-subcycle/iteration parallel algorithm can be easily reduced to the pseudo 1subcycle/iteration version with a newly introduced function (called extended local connecting function). Perfectly 8-connected skeletons can be always produced by means of a new local connecting function and the shape invariant property of the local straight line. Moreover, the efficiency of these algorithms can be further increased by using the strategies of table look-up and local parallel broadcast. This paper is concerned with hardware-oriented measures for parallel thinning algorithms.

The 3 function is defined as follows: 3[JV(PJ!r) - i] =

0, for JV(P~o)y)#: i or P~)y = 0, 1, for JV(P~!r) = i and P~!y = 1.

(2.3) Since the total number of combinations of JV-number is 256 ( = 28) in equation (2.1), the equation (2.2a) can be written as [less=--0 } -x,yP'J+*) = ~ ~ ~ T(i)f[,A/'(P~!y) - i] ,

(2.2b)

i=

forx=0,1 ..... M-l,y=0,1 ..... N-1. In addition, a halting condition for the thinning filter (2.2b) which checks whether the sum of absolute differences (SAD) between the filtered patterns at the jth iteration (or subcycle) and those at the (j + 1)th iteration (or subcycle) becomes zero or not, is defined as follows: M-1N-1

SAD=

Z

Z Ie~!y_pt/+t)_~,y.

(2.4)

x=0 y=0

Based on the above framework, three new functions named local connecting (LC), extended local connecting (ELC) and erosive direction number (EDN), as well as two properties of shape invariance of local edges and local straight lines will be defined in Section 3 and be used to derive the thinning windows T(i)'s in Section 4. 3. S O M E D E F I N I T I O N S A N D F U N C T I O N S

2. BASI C F R A M E W O R K

A binary pattern matrix, whose size is M - b y - N pixels, consists of only two-level pixels: one is the pattern pixel (denoted by "I") and the other is the background pixel (denoted by "0"). For any pixel P~,y in row x and column y of the image matrix, let N(0), N(1) . . . . . N(7) be the values of its neighbors from P~,y-1 in clockwise order as shown in Fig. 1. The patterns are 8-neighbor connected. With these eight nearest neighbors of pixel P~,y, we define an eightdigit number, called JV-number, to indicate the value of the combination of these neighbors. The expression of JV-number for any pixel P~,y is given below: 7

Y(Px.y) = ~ N(n).2",

(2.1)

n=0

here for each N(n), the value is either 1 or 0. As we know, thinning may be defined as the successive erosion of the outmost layers of a pattern until only a connected "skeleton" or "medial line" of unit width remains. Such iterative process can be defined as the first-order recursive filter, named a thinning filter, i.e. x,y

,

The designation of 3-by-3 square array is shown in Fig. 1; where N(n) for n = 0, 1. . . . , 7 denotes the values of eight neighbors of the central pixel Px,r. Let Se and SO denote two sets of integers {0,2,4, 6} and {1,3,5,7}, respectively. Let S~ denote a set of eight integers, i.e. Sx = S, uSo, and Sb denote a set of 7

integers {bpb = 0, 1 , . . . , Tb - 1, Tb = ~ N(n)}, here rl=0

Tb denotes the total number of black neighbors of the central pixel P. In order to facilitate the following calculations, let a mapping function B: Sb--' Sx be defined by B(b) = n, where b = 0, 1. . . . . Tb -- 1, and n = 0, 1, ..., 7, denoting the location of the bth black neighbor from Px,r_ 1 in clockwise order as shown in Fig. 1. For convenience, the inverse relation B-* is also used. Note that the variables b and n are treated modulo Tb and 8, respectively.

N(7)= Px-l,y-i N(6)= Px-l,N

N(0)= Px,g-i p

N(1) = Px+I,N-I

x'N

N(2) = Px+l,N

N(4)= Px,N+I

N(3) = Px+l, N+I

i=-cc

for x = O , 1. . . . . M - 1, y = O , 1. . . . . N - 1; where " ~ " represents NOT logical operation. T(i) is called the thinning window, to be discussed later in this paper.

N(5) = Px-l,N+l

Fig. 1. Designation of a 3-by-3 square array.

Parallel thinning algorithms For instance, a local pattern is given below and the neighbors of pixel P are listed. 1

1 0

N(0) = 1; N(1) = 0; N(2) = 1; N(3) = 1

0 P 1

N(4) = 1; N(5) = 0; N(6) = 0; N(7) = 1

269

7 and EP is 4. These expressions will facilitate the following calculations. Definition 3.4

The LC-function of a 3-by-3 local pattern, whose central pixel P is black, is given as:

0 1 1

Tb-- 1

LC(P) = ~

Then the corresponding black neighbors indicated by the b and n variables are shown in Table 1. Table 1 b = B-l(n) 0

n = B(n) 0

1

2

2 3 4

3 4 7

Before introducing the local connecting function (LC-function for short) of a 3-by-3 local pattern, we first define local pattern connectivity, the set of connecting elements, and a binary operator named the connecting operator (represented by symbol " [ ] ' ) . Definition 3.1

Let a 3-by-3 local pattern be 8-neighbor connected. Then the pattern connectivity of the local pattern is still preserved if removal of the black central pixel P will not break the pattern into two or more parts. Conversely, we say that the pattern connectivity is destroyed. Definition 3.2

For any nonzero neighbor N(n), let the connecting set be CE(n) = {n + 1}, if n e S o or CE(n) = {n + 1, n + 2}, if neSe. Definition 3.3

For any two consecutive elements in Sb, take the connecting set CE(B(b)) of the former element and take the location B(b + 1) of the latter. Then the connecting operation [ ] is given by: CE(B(b)) [ ] B(b + l) =

1, if B(b + 1)~CE(B(b)), O, if B(b + 1)¢CE(B(b)).

CE(B(b)) [ ] B(b + 1).

The LC-function is a function to evaluate those useful local patterns (refer to definitions 3.6 and 3.7), and therefore is used to generate the first thinning window (refer to equation (3.8)). According to the above definition, there are three main different values of LC(P) to be discussed. (1) LC(P) = Tb. This case indicates that the pixel P is an interior point (Tb # 0) or an isolated point (Tb = 0). The skeleton only has a meaning when it is applied to line-like patterns which have considerably greater length than width, and the binary pattern is always smoothed beforehand. 121) Removing the interior point will make a hole, and removing the isolated point will lose the objective for preserving such point. Hence, these points are not removable. (2) L C ( P ) = T b - 1 (#0). In this case, the local pattern connectivity will not be destroyed if the pixel P is removed. However, for the purpose of parallel processing, we will further discuss this case in detail. Note that if LC(P) = 0 then the pixel P is an endpoint which must be preserved. (3) L C ( P ) < T b - 2. It is inevitable that all such cases will destroy the local pattern connectivity if the pixel P is removed. In case (2), there intuitively exists a property of shape invariance for three possible local patterns, i.e. the local edge, the local straight line, and the local branch. A property of a 3-by-3 local pattern is called shape invariance if the pattern whose central pixel P is nonzero has shape S and it still has S after P has been removed. For instance, in the following examples, (A) has the shape invariance of local edge, (B) has the shape invariance of local straight line, (C) has the shape invariance of local branch, but (D) does not possess the shape invariance of local straight line.

(3.1) Following the preceding example, we have: CE(B(0))[]B(I)=CE(0)[]2=

1,

CE(B(1))[]B(2)=CE(2)[]3=

1

(A)

1

1

1

1

1

0 1 1 ~

0 0 1

1,

0 0 1

0 0 1

CE(B(2)) [ ] B(3) = CE(3) [ ] 4 = 1,

(P = 1)

(P = 0)

1 1 0

1 1 0

CE(B(3)) [ ] B(4) = CE(4) [ ] 7 = 0, C E ( B ( 4 ) ) [ ] B ( T b ) = C E ( 7 ) [ ] 0 = 1. If the operation of [ ] on all B(b)'s results in one value of zero, we give the starting pointer SP and ending pointer EP to denote the value of B(b + 1) and B(b), respectively. For the above example, SP is

(3.2)

b=O

(B)

0 1 1 -~ 0 0 1 0 0 0 (P = 1)

0 0 0 (P = 0)

270

YUNG-SHENGCHEN and WEN-HSINGHSU

010

(c)

evaluate whether the local pattern is a local edge or not. If the difference of each pair is 1, then E(P) must be equal to LC(P) and the local pattern is a local edge. Otherwise, it is not a local edge. Some examples are shown below.

010

0 1 1 ~ 0 0 1 ;010

(D)

010

(P = 1)

(P = 0)

110

ll0

011

~

001 011

(P = l)

(P = 0)

Shape invariance of the local edge is always true; the local branch should always be preserved in the thinning results. However, for the local straight line, those line-like patterns which will result in curve-like patterns after P is removed must be pruned, because they cannot preserve the property of shape invariance in the thinning results. In order to further illustrate the case of local straight line, we have the following definition. Let Stb and Sta be two connecting sets which are the shortest paths from SP to EP in a 3-by-3 local pattern before and after pixel P is removed, respectively. Therefore, Slb must be the union of set {SP, EP} and the singleton set containing the location of the central black pixel; and Sla must be a subset of the set Sb containing the locations of all the black neighbors in the local pattern.

Definition 3.5 Let p(= SP), q(= EP) be points of the set Slb (or S~a), and let pq denote the (real) line segment between p and q. We say that pq lies near Slb (or Sla), if for any (real) point (x, y) of pq, there exists a (lattice) point (i,j) of Slb (orSla) such that the Euclidean distance x/(i - x) 2 + (j - y)2 < 1. Ifpq lies near both S~b and S ~ then we claim that the local pattern (local straight line) satisfies the property of shape invariance. (This definition is modified fromt22~.)

Definition 3.6 A local pattern is called a local edge if E(P) = LC(P). The formula of E(P) is given as: B

110

011

0 P 1

1 P0

0 P 1

001

1 10

110

Local edge

011

I(SP)+Tb - 2

[B(b + 1) + C - B(b)l, (3.3)

E(P) =

1 11

b = B - t(Sp)

Local edge

Not a local edge

Definition 3.7 A local pattern is called a local straight line if

S4(P) = 2 and L(P) = 1. The formulas of S4(P) and L(P) are given as below: T/,- 1

S4(P) = ~

N(B(b)),

(3.4)

b=O B(b)¢S e

and T b -

~P) =

1

N(B(b)). N(B(b + 1)). N(B(b + 2)).

E b=O B(b)~S e

(3.5) The pattern containing a local straight line consists of two disjoint parts of connected background which are divided by a connected pattern. Thus, we only have the following four types of local straight lines generated by S4(P) = 2 and L(P) = 1 to satisfy the condition LC(P) = Tb -- 1 and definition 3.5 for a 3by-3 local pattern. Note that the symbol "X" denotes "don't care". X 10

i00X

0P

1

i0P

0i0

X

~X 1 0

Typel

1

Type2

X00

01X

1 P0

1 P0

0 1X

X 00

Type3

Type4

There also exists the useful information called the "direction of erosive breach" on the local patterns satisfying the condition LC(P) = Tb -- 1. A function of EDN (erosive direction number) will be defined as the following definition and plays an important role for designing parallel thinning algorithms in Section 4.

Definition 3.8

where I0, if B(b + 1) > B(b), C = 8, if B(b + 1) < B(b). Here E(P) is used to calculate the sum of all location differences between two consecutive black pixels starting from SP to EP in clockwise order. Because the pattern containing a local edge has only two distinct parts (i.e. a connected pattern and a connected background), we can easily use the function E(P) to

Given a direction function DF(P), SP+M-

1

E

k

k=EP+ 1

DF(P)

SP + M - EP -- 1'

where

M=

0, if SP > EP, 8, if SP < EP.

(3.6)

Parallel thinning algorithms Let DF(P) be equal to Int[DF(P)] + Frac[DF(P)], the first term denotes the integral part of DF(P) and the second term denotes the fractional part of DF(P), respectively. Then, the EDN of pixel P is defined by the following equation: DF(P), if Frac[DF(P)] = 0, Int[DF(P)], if Frac[DF(P)] :/: 0 and EP e S O

EDN(P) = {

Int[DF(P) + 1], if Frac[DF(P)] ~: 0 and SP e So.

271

affected by) the larger part. For instance, in case (B) of the above examples, since Qt > Q2, the EDN(P) is adjusted counter-clockwise; in case (C), since Q1 < Q2, the EDN(P) is adjusted clockwise. Accordingly, with the LC-function and the two properties of shape invariance of local edges and local straight lines, the first thinning window T1 is obtained and expressed as: 1,if [ L C ( P ) = T b - 1 (:~0)] and [E(P) = LC(P)] or [S4(P)= 2 and L(P) = 1], 0, elsewhere. (3.8)

TI(Y(P)) =

(3.7) Note that all EDNs are computed modulo 8. For clarity, we give the following examples to illustrate the calculations of DF(P) and EDN(P). ,,

Qt = 2 x

~t 1 1 l~O , 1 0 "01

(A)

Tb = 4 , L C ( P ) = 3 SP=5, EP=I DF(P) = (2 + 3 + 4)/3 = 3 EDN(P) = 3

Recall that Y ( P ) denotes the Jff-number of pixel P in Section 2. Here TdJff(P)) = 1 denotes that pixel P is a candidate for removal; conversely, TdJff(P)) = 0 denotes the pixel P cannot be removed. For the purpose of parallel processing, we must further consider the property of extended local connectivity because so far we have only dealt with the local connectivity. There are strong and weak properties on the extended local connectivity.

x

Q2 = 2

,

Definition 3.9

Q1 = 3.5 Tb = 6, LC(P) = 5 (B)-

S P = 4, E P = l

--

DF(P) = (2 + 3)/2 = 2.5 EDN(P) = 2

Q2 = 2.5 Q1 = 1.5

//

0 0 .el!

(c) --~ /~ 0 i ---'3 3' 1 1

T~= 4, LC(P) = 3 SP = 3, EP = 6 DF(P)=(7+8+9+10)/4=8.5 EDN(P) = 1

I11 Y2

PI

/'2

Z1

Z2

I YI Pt

Z1

I"2 /'2 Z2

Here Y1 and Y2 at least have one nonzero pixel, so as Z 1 and Z 2.

Definition 3.10

/.

," Q2 = 2.5 The designations of equation (3.7) are based upon the following. If the value of DF(P) is an integer, then it can be directly assigned to EDN(P). However, if the value of DF(P) is not an integer, then the integer assignment of EDN(P) is adjusted by the distribution of black pixels surrounding P. First, we note that there are "edge lines" surrounding the lattice P after P has been removed, and the number of "edge lines" is smaller than 4 due to the condition LC(P) = Tb -- 1. (We use the term "edge lines" to prevent confusion with the pattern of the local edge.) Hence, we can find a central line (denoted by the dotted line as shown in the above examples) to separate the "edge lines" into two symmetric parts. Three possible cases are --~P--,

That two adjacent removable pixels PI and P2 cannot be rashly deleted simultaneously is called weak connectivity if they are horizontal or vertical adjacent pair. These cases may be as follows:

"~,

and

['~.

That two adjacent removable pixels PI and P2 can be deleted simultaneously is called strong connectivity if they are diagonal adjacent pair. These cases may be as follows:

Y

P2

P2

Y

P1

Z

Z

PI

Here Y and Z can be zero or nonzero pixel. Based on the above two definitions, the extended local connecting function (ELC-function for short) for a 3-by-3 local pattern is given by: ELC(P) = r b~ 1 T1[X(N(B(b)))] b=O B(b)ES e

(3.9) Tt(df(P))= 1

I

Now we give a quantity (Q) to express the total quantity for each part. If the value of either one part (say Q 1) is greater than that of the other (say Q2), then the adjusting direction of EDN(P) is biased to (or PR 2 2 : 3 - D

If ELC(P) = O, then the pixel P can be exactly removed in parallel processing. Conversely, if ELC(P) :/: O, by definition, the pattern connectivity will be destroyed as the pixcl P and its removable neighbor(s) are

272

YUNG-SHENG CHEN and WEN-HSING HSU

deleted at the same time. Accordingly, two questions may be raised in designing parallel thinning algorithms. First, how many subcycles in an iteration are sufficient for designing parallel thinning algorithms? Secondly, which removable candidate should be assigned to which subcycle? The corresponding answers will be detailed in the next section. In addition, the pseudo 1-subcycle/iteration parallel thinning algorithm will also be introduced. 4. THINNING WINDOWS

In this section, two types of parallel thinning algorithms will be introduced. First, 2-subcycle~iteration version is constructed by the checking procedure of off-line ELC-function. Secondly, with the developed results of the first version as well as the use of on-line ELC function, the pseudo 1subcycle/iteration version can be easily constructed. Note that the meaning of on-line and off-line is concerned with whether the ELC-function is being applied to the thinning process or not. As mentioned in Section 3, if all removable candidates shown by TI[,~'(P)] = 1 are deleted simultaneously, then whether the pattern connectivity is destroyed or not is checked by whether there exists the nonzero ELC(P). Therefore, for a black pixel P, we must provide a procedure to check all possible cases of the JV-number for their ELC(P) value. If the value of ELC(P) is zero, then the pixel P can always be deleted. Otherwise, we have to know which pair of JV-numbers cannot co-exist, and mark the pair by the values of EDN(P) and EDN(N(.)) which is opposite to EDN(P). The procedure can be described in algorithm 4.1.

Algorithm 4.1 Off-line checking procedure of ELC-function. Notation: input is all possible JV-numbers of a black pixel P in the range [0, 255]. Output is a list of the pairs of EDN and its opposite value. 1. For all possible JV-numbers of a black pixel P do: Begin. 2. Calculate TI[Jff(P)]. 3. If T~[~'(P)] = 1 then calculate EDN(P) else do nothing. Begin. 4. Set ELC(P) to zero. 5. For b from 0 to Tb -- 1 do: 6. If B(b) ~ So then do nothing. Begin. 7. For all possible ./V-number of the black neighbor N(B(b)) do: Begin. 8. Calculate TI[Jff(N(B(b)))]. 9. IfTI[W(N(B(b)))] = I then increase ELC(P) by one and calculate EDN(N(B(b))). End. End.

End. End. 10. End of algorithm. After having executed algorithm 4.1, we obtain four pairs of EDNs. They are 0,--*4 (or 4,-* 0), 1 .-, 5 (or 5*-* 1), 2,--~6 (or 6 ~-)2), and 3,--~7 (or 7 ~-~3). They can be regarded as a product set (1,5) x (2,6) x {3,7} starting from the node 0,-~ 4, and therefore it has a tree diagram as shown in Fig. 2. Obviously, Fig. 2 illustrates that there are eight possible cases of the 2subcycle/iteration parallel thinning algorithm to be constructed. Consequently, according to algorithm 4.1, we have empirically shown the following conclusion.

Conclusion 4.1 Division of an iteration into two subcycles is sufficient for designing the parallel thinning algorithm. The pattern connectivity will not be destroyed if all the removable candidates satisfying T1[Jff(P)] = 1 are deleted simultaneously except that half the candidates whose ELC(P) values are nonzero are excluded in the current subcycle. In Fig. 2, let L 1 and R t be the two sets of the mutually opposite EDNs {0, l, 2, 3} and {4, 5, 6, 7} respectively, L 2 and R 2 be the sets of the mutually opposite EDNs {0, 1, 2, 7} and {4, 5, 6, 3} respectively, etc. Accordingly, by conclusion 4.1, we first have one common subwindow T, and sixteen different subwindows Tit and T2t for t = 1, 2. . . . . 8. They are: T~(i) =

1, if ELC(P) = 0, 0, elsewhere,

1, if ELC(P) q: 0 and EDN(P)~L,

Tit(i) = 0, elsewhere,

(4.1)

(4.2)

and 1, if ELC(P) ¢= 0 and EDN(P)eRt,

T2t(i) = 0, elsewhere,

(4.3)

for t = 1, 2, ..., 8, and i is the X-number of P. Accordingly, eight thinning windows T2Wt, for t = 1, 2. . . . . 8 are found for the thinning filter (2.2b). The so-called 2-subcycle/iteration parallel thinning algorithm is constructed from them. The eight thinning windows are expressed as follows: T2 Wt(i)

J'T~(i) v Tt,(i), ifj is even, (Tc(i) v T2f(i), ifj is odd,

(4.4)

for t = l, 2, ..., 8; where " v " represents OR logical operation andj is thejth subcycle referred to equation (2.2b).

Theorem 4.1 Consider any candidate P* being removed in the on-line thinning process. Whichever subwindow Tit

Parallel thinning algorithms

273

÷ Fig. 2. Eight combinations of the contrary EDNs' pairs. ELC(P~') are zero. It evidently implies that deleting simultaneously both candidates P* and P* will neither affect nor destroy the pattern connectivity.

or T2, the process takes, the pixel can be exactly deleted iff Tb- 1

ELC(P*) =

T2[W(N*(B(b)))]

2 b=O

T:(J~(P)) =

B(b)¢Se

1 (4.5)

is zero. Here T2 and T2 represent two mutually opposite subwindows either T1, or T2t, and N* is the neighbor of P* being computed.

Therefore, according to theorem 4.1, the other eight thinning windows T1 Wt, for t = 1, 2, ..., 8 are found for the thinning filter (2.2b). They are:

t T~(i)v Tl,(i) v

T2,(i), if ELC(P*) = 0, T~(i) v T1'(i), if ELC(P*) :/: 0 and j is even, T~(i) v T2,(i), if ELC(P*) ~ 0 and j is odd,

T1Wt(i) =

Proof

(4.6)

Assume that two candidates P* and P* are voted by the subwindows 7"1, and T2t respectively in the on-line thinning process, and they can be deleted simultaneously. Then it implies that the candidate P* is not excluded by the co-used subwindow Tit, and the candidate P* is not excluded by the co-used subwindow T2,. But, this fact is contrary to conclusion 4.1. Accordingly, it implies that equation (3.9) is reduced to the on-line ELC-function (4.5) which is zero. O n the other hand, suppose both ELC(PT) and

for t = 1, 2 , . . . , 8. Because, in general, most of the earlier iterations for on-line thinning (uniform pattern in particular) are in the case of E L C ( P * ) = 0, and only the window T~(i) v Tl,(i) v T2,(i) is used until the case of ELC(P*) :/: 0 appears. Accordingly, we claim that the thinning windows T1 W, for t = 1, 2 . . . . . 8 construct the pseudo 1-subcycle/iteration parallel thinning algorithm. In order to further systematically illustrate the

I Algorithm 4.1 1 For 2-subcyc[e]=====

~E~(P

verstonJ

Added for p s e u d o ll-subc~c[e u e r s t o n I

II ~ On-l ~ i i*ned H

)~0

IE ~ ( P ) = 0

Fig. 2 tree diagram ,

[

even

t-'--:--J

_

pfJ)

)

x,~

odd'l

p(j+l) Hart or Xty con£t~ue Fig. 3. Systematicflowchartof the proposed approach.

274

YUNG-SHENGCHENand WEN-HSINGHSU

entire approach, we summarize the 2-subcycle/iteration and pseudo 1-subcycle/iteration thinning processes in a flowchart as shown in Fig. 3. All the thinning windows are generated and assigned automatically in off-line time. They can be directly mapped as the thinning process is being performed except that the on-line ELC-function acts for pseudo 1subcycle/iteration version. It is worth emphasizing that the perfect 8-connected skeletons can be exactly produced by using these algorithms. This good effect is due to the use of the local connecting function in equation (3.2) and the property of shape invariance of the local straight line in definition 3.5 of Section 3. 5. IMPLEMENTATIONS,EXPERIMENTS,AND COMPARISONS As mentioned in Section 1, an efficient and effective thinning algorithm should satisfy the following requirements: (A) The algorithm should be a parallel version. (B) The number of subcycles and the time-units (complexity) per subcycle should be as small as possible. (Note that the term "subcycle" is more appropriate than the term "iteration" for evaluating a 2-subcycle/iteration or a 1-subcycle/iteration parallel algorithms.) (C) The thin lines must be perfectly 8-connected, possess a good isotropy, and should avoid excessive erosion. All the proposed algorithms have been applied to a large number of patterns. The experiments show that the pseudo 1-subcycle version can approximately meet the above requirements. The 2-subcycle version is slightly inferior to the pseudo 1-subcycle version but superior to many other analogous algorithms. 5.1. Implementations of the proposed algorithms First, according to the system flowchart in Fig. 3, we can tabulate off-line all the cases of T~(i), T,t(i), and T2,(i), for t = 1, 2. . . . . 8, as an example for t = 3

displayed in Fig. 4, where O's denoting that the corresponding inputs (i.e. the values indicated by A 0 - A7) are not applied to these subwindows. Similarly, l's, 2's, and 3's denote that the corresponding inputs are applied to the subwindows TI,(i), T2,(i), and T~(/), respectively. Figure 5(a) shows possible hardware for a processing element (PE) easily simulated by software. Here " ~ " and " ~ " represent the EXCLUSIVE OR and NOR logical operation, respectively. A register Rx.y contains the pixel information, and a flag Fx.y records the state whether or not the pixel in Rx.y is changed from 1 to 0 after the end of a subcycle. The circuit performing on-line ELC-function is designed with "G", "~/", and " v " logical gates. The j-counter in the control unit is to indicate which subcycle is being performed; here the lowest bit C O is to indicate that j is odd (C 0 = 1) or even (C o = 0 ) . Because the contents of Fig. 4 are in the range [0, 3], it needs only two bits (D1Do) to represent the relative subwindows, i.e. T ~ ( i ) ( O l D o = l l ), Tl,(i ) (DiDo=01), T2,(i) (D~Do = 10), and DID o = 00. To arrive at a conclusion, this hardware can implement not only the pseudo 1-subcycle but also 2-subcycle version. The corresponding operations of different arbitrators are listed in Table 2 and Table 3, respectively. The interconnections among PE~.y and its eight nearest PEs are shown in Fig. 5(b). We call these connections a local parallel broadcast, since all nearest neighbors' information of Px.r can be accessed by Px,y itself, and the information of Px,r can broadcast to all its nearest neighbors simultaneously. As mentioned above, with the main ideals of table look-up and local parallel broadcast, we can explain how the least time-units (complexity) per subcycle is approximately obtained. Assume a fully parallel processor is utilized, the basic operations performing the pseudo 1-subcycle version are listed below: (1) Update the j-counter (output Co). (2) Read eight nearest neighbors simultaneously.

IA7 A6 A5 A4llA3 A2 A1 A0 l

A7 A0 A1

[0123456V~gABC 0 0 1 0 2 0 3 3 4 0 53 63 73 80 90 A 0 B 0 C 3 D 1 E 3 F 3

0 0 0 0 3 0 1 0 3 0 0 0 3 0 3 2

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

3 0 0 0 1 0 1 0 3 0 0 0 3 0 3 2

0 3 0 2 0 0 0 0 0 0 0 0 0 0 0 0

3 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0

3 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0

3 0 0 0 0 0 0 0 3 0 0 0 2 0 2 0

0 3 0 3 0 1 0 3 0 0 0 0 0 1 0 3

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2

3 3 0 3 0 0 0 1 0 0 0 0 0 0 0 1

2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0

3 3 0 3 0 0 0 1 0 0 0 0 0 0 0 1

DEF 3 1 0 1 0 0 0 0 3 1 0 1 2 0 2 0

A6 P

A2

A5 A41A3 0is a r e

no£

l's a r e

used

Lt =

used.

tn Tlt (t) .

{0,i,6,3).

2 ' s are u s e d tn T 2 t ( / ) . Rt = {4,5,2,7}. 3's

a r e used tn

Tc(t ) .

Fig. 4. An example of tabulating all the cases of T~(i), T,,(i), and T2,(i), for t = 3.

Parallel thinning algorithms

275

Table 3. Arbitrator for the 2-subcycle version

Table 2. Arbitrator for the pseudo 1-subcycle version

Co

D1

DO

ELC~.y

R~!y

-,x.y)ou + t)

Fx,y

Co

Dt

Do

ELCx,r

X X 0 (1) 0 (l) 0 (l) 0

X 0

X 0

X X

0 1

0 1

0 0

X 0

X 0

X X

R(]~; 0 1

0

1

0

1

0

1

0

1

X

1

1 (0)

l

0

X

1

1

X X 0 (1) o (i) X

1

1

X

1

0

1

1

1

0 (1)

1

0

0

1

0

1

0

1

1

1

0

(o)

(i)

X

l

1

1

1

0

1

X's are don't cares.

It only takes approximately eight time-units per

ifrom four nearest

PEs I

tDpo)x..-1. IDpo)x+l.u. ID1%:x,N+IIIDIDo)x-I,NI

tt I

v

I

I EIA2x ,N

Rx ,u-I

.

'F

:,I

i

ito control. un/. t

from etght nearest

control.

urt£t

from

0 0 1 (o) o (1) 1

subcycle for the pseudo 1-subcycle version. In the 2subcycle version, the operations (4) and (5) can be ignored and bypassed, then the number of time-units taken becomes only six. Consequently, with the concepts of table look-up and local parallel broadcast, the time-units (complexity) per subcycle can be reduced to as few as possible and therefore the efficiency can be evaluated by the number of subcycles only. Furthermore, the proposed pseudo 1-subcycle algorithm can provide a way to reduce the number of subcycles (as illustrated in the

(3) Lookup table (output DIDo). (4) Read four nearest neighbors simultaneously. (5) Perform the on-line ELC-function (output ELCx,y). (6) Execute the arbitrator. (7) Update Rx.r. (8) Check the flag Fx.y.

tt

Fx.y

X's are don't cares.

(i)

I

--x.rR(J+1) 0 1 0 (H 1 (0) 0

to e i g h t

'

nearest PEs

PEs Fig. 5(a). A possible architecture for a PE.

276

YUNG-SHENGCHEN and WEN-HSINGHSU

PEx-I,y-I ~ I PEx,y-II ~ PEx+l,y-i PEx-I,Y ~

PEx,y ~

l[ll/l PEx-1,

~/+l

PEx'[/+i

PEx+l'U

I ~ PEx+I'g+I

(b) Fig. 5(5). The local parallel broadcast to the nearest PEs.

next sub-section). Hence, we conclude that the first two requirements (A) and (B) are approximately met. 5.2. Experiments of the proposed algorithms In this sub-section, we use four terms, namely, (1) number of subcycles, (2) isotropy, (3) degree of 8connected curve, and (4) degree of erosion, to evaluate the thinning results. Because, empirically, all the subwindows (Tit vs T2,) are changeable, the other sixteen different cases (whose thinning windows are denoted by T2W~ and T1 W[, for t = 1, 2. . . . . 8, respectively) are constructed. Hence, in order to confirm the newly proposed approach, we should test all the 32 different algorithms in detail. First, two artificial patterns "l" and " v " shown in Fig. 6 are designed to test the number of subcycles and the goodness ofisotropy, respectively. The skeletons of the two patterns are obtained by applying the 32 cases and shown in Fig. 7. It is noted that the number ofsubcycles required by the pseudo 1-subcycle version is about 50 percent fewer than that required by the 2-subcycle version, if the width of the thinning pattern is as uniform as shown in Fig. 6(a). In addition, the thinning result obtained by the pseudo 1-subcycle version is more isotropic than that obtained by the 2-subcycle version as displayed in Fig. 7(d), (e), and (f). In order to further test the degree of 8-connected curve and erosion, a non-artificial pattern is given in Fig. 8. All the thinning results shown in Fig. 9 are perfectly 8-connected and do not result in excessive erosion. Recall that a thin line except its junctions is

]iiii]iii]]]~]iil]l:} ..................... ..................... ::lt:gl|:::Ig:g:II|l: HHHIIHllHIHIIH ......

:i::::::i::::~:i::::: .....................

perfectly 8-connected if there does not exist any 8deletable point on the line. The reason for ignoring the junctions is that the junction is always a part of intersection of thin lines no matter whose 8-deletable points are removed. (See the discussion of shape invariance in Section 3.) According to the above thinning results, we can conclude that the third requirement (C) is also met. 5.3. Comparison with five 2-subcycle parallel algorithms

We compared five 2-subcycle parallel thinning algorithms with different halting criteria which were proposed by Deutsch, (s) Zhang and Suen, tl2) Chen and Hsu,(lS) Stefanelli and Rosenfeld, (a) and Tamura. (s) The first three schemes are based on the R-halt criterion, and the last two are based on either the C-halt or both. Here R-halt is designed to check whether the set of removable points is empty or not after the end of the current subcycle. C-halt is designed to check whether or not the set of final points is exactly the core line or final skeleton. The concept of final points is that these points are prohibited from deletion at any subsequence once they are detected (*) As stated in Section 2, the halting criterion of the new proposed algorithms is based on whether the SAD (sum of absolute differences) in equation (2.4) is zero or not, which is equivalent to R-halt. Therefore, we can directly use the compatibility of matching deleting-conditions (CMD) shown in equation (5.1) to determine which possible thinning windows (T2Wt also stands for T2W[, for t = 1, 2 . . . . ,8) the first three compared algorithms belong to. For the last two algorithms, we can transfer the halting criterion from C-halt to R-halt, which implies that preservation of final points is transferred to the deletion of removable .:]:. .:::. points. Although these two algorithms reflect the •: : : : : | L ,|g|:gg:o original ones approximately but not accurately, they .÷::::i~::i~::::~:..:~i~::::iiii::::~" can be determined by CMD for comparison. The CMD is expressed as follows:

~ T2W.,(i) (a)

(b) Fig. 6. Two artificial patterns.

CMDa'

~ T2Wt(i) i

{ T 2 W A } c ~ { T 2 W I }r

(5.1)

Parallel thinning algorithms .. .. .. .. .. .. .. .. .. .. ::::::::::::::::::::: ::::::::::::::::::::: . . . . . . . . . . ::::::::::::::::::::: . . . . . . . . . . ..................... ::::::::::::::::::::: ..................... .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..................... ::::::::::::::::::::: . . . . . . . . . . ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: :::::::::::::::::::::

.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ::::::::::::::::::::: ::::::::::::::::::::: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ::::::::::::::::::::: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -.................... ::::::::::::::::::::: ::::::::::::::::::::: .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .......................................... ::::::::::::::::::::: ::::::::::::::::::::: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: :::::::::::::::::::::

:::::::::::::::::::::

(a) N I = I I

277

.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ::::::::::::::::::::: ::::::::::::::::::::: . . . . . . . . . . . . . . . . . . ::::::::::::::::::::: . . . . . . . . . . . . . . . . . . ::::::::::::::::::::: ::::::::::::::::::::: ..................... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ::::::::::::::::::::: ::::::::::::::::::::: . . . . . . . . . . . . . . . . . . ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: ::::::::::::::::::::: :::::::::::::::::::::

(b) N I = 2 0

(c) N I = 2 0

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .......................... . ............................................... . .................................................................. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .-. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..........................................................................................................

-

:

~

E

~

5

:

"

-:~!!!!ii~!ii!!iiiii~: -:::::-

(d) N I = I 0

- : ~ ! 5 ~ i i i ~ : "

:

~

E

~

!

~

:

-

. ~ . . . . : . . . : ;. ~. .!. !. ~. . :. -. . . . . . . . . . . . . . . . . . :. .................... -::::::..

-:::::-

(e) N I = I I

(f) N I = I 2

Fig. 7. Skeletons of the patterns shown in Fig. 6 are obtained by applying the 32 cases. (a) T1Wz and T1W~, (b)T2W, (c) T2W~, (d)T1Wt and T1W~, (e)T2Wt, (f)T2W~, for t = 1, 2. . . . . 8. (NI denotes the number of subcycles.)

....iii~i~...... :::" .:::::::::q~:....... .~:::":ii~:" .:::" ::iii~: ::l:|:::::::::l::::::::::

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

Fig. 8. A non-artificial pattern.

Here ~ T2WA(i) denotes the sum of all the deletingi

conditions in both subcycles of the algorithm A, so does ~ T2Wt(i). {T2WA}c ~ {T2Wt}, denotes that the i

set of deleting-conditions tabulated by the compared algorithm A is a subset of those tabulated by the proposed algorithm with the thinning window T2Wt (T2Wt for short). If{T2WA} c ~_ { 72Wt}r, we can calculate the CMDAt to obtain the degree of compatibility between the compared algotithm A and the reference algorithm T2Wt. Accordingly, there are two cases concerned. (1)CMDA, = 1, i.e. {T2WA}c = {T2Wt},, expresses that the algorithm A is exactly equivalent to the proposed algorithm T2Wf. (2)CMDA, < 1, i.e. (T2WA}~ c {T2W~},, expresses that the algorithm A belongs to but is inferior to the proposed algorithm T2Wt, since several of deleting-conditions should be but are not considered by the algorithm A. If { T2W,4}~ {T2Wr},, Vt, we claim that the algorithm A does not belong to any cases of the 2-subcycle version constructed by this new approach. To confirm the correctness of CMD, let T2Wt, for t = 1, 2 . . . . . 8, be both compared and reference algorithms, then all the pairs are computed and shown in Table 4. Now, let A = 1, 2, 3, 4, 5, denote the

algorithms in comparison proposed by Deutsch, Zhang and Suen, Chen and Hsu, Stefanelli and Rosenfeld (approximated), and Tamura (approximated), respectively; and, the relative CMDs computed are listed in Table 5. In Table 5, all the schemes except that proposed by Stefanelli and Rosenfeld (approximated) are covered by the new approach. Their thinning criteria are not designed completely enough to produce the perfectly 8-connected thin line (the imperfect 8-curve seldom appears in Chen and Hsu's scheme according to the following description) or to avoid excessive erosion (only occurred in Zhang and Suen's scheme) as displayed in Fig. 10(a)-(e). After having examined these schemes in detail, we discover that the following deleting-conditions have been mentioned but not included in the main routine of the Deutsch's algorithm. 7

~" N(n) = 2,

(5.2a)

n=0

and

N(n) ^ N(n + 2) = 1, for n = O, 2, 4, 6. (5.2b) The major deficiencies of Zhang and Suen's scheme were corrected by us. "a~ The above deleting-conditions are included in the main routine of the Chen and Hsu's algorithm, but divided and assigned to the different subcycles. However, according to the examplified table in Fig. 4, these deleting-conditions belong to the common subwindow T~, i.e. all these conditions can be assigned to both subcycles. Accordingly, the relative positions of Deutsch's, Zhang and Suen's, and Chen and Hsu's scheme shown in Table 5 are obviously obtained. With regard to Tamura's scheme as well as Stefanelli and Rosenfeld's scheme, we add the end-points as

278

YUNG-SHENGCHENand WEN-HSINGHSU Holt et al.'s scheme "6~) perform in parallel. According to Tamura's investigations,t ~9) Hilditch's scheme uses the 8-connectivity number defined later by Yokoi et al. ~7~ so that the perfectly 8-connected curve can be obtained. It uses raster-scanning type of sequential operations to prevent the 2-by-n figure from disappearing. A simplified version of Hilditch's approach was presented by Stefanelli and Rosenfeld,t4) which has several drawbacks and cannot reflect exactly the original approach as Naccache and Shinghal indicated."a~ Also according to Tamura's paper, the Rutovitz's scheme has several deficiencies such as imperfectly 8connected curve, thick diagonal lines, and excessive erosion. Although the modified version of Rutovitz's scheme presented by Deutsch ta~ improves the thinness of diagonal lines and prevents excessive erosion, it will still yield the imperfectly 8-connected curve and further result in highly biased thin lines as shown in Fig. 1l(a).

final-points for preventing excessive erosion when the halting criterion is transferred from C-halt to R-halt as mentioned before, so that they can approximately but not accurately reflect the original schemes. The imperfectly 8-connected thinning results are shown in Fig. 10(d)-(g). Table 5 reveals that Tamura's algorithm is covered by the new approach, but the approximated Stefanelli and Rosenfeld's is not. The major factor of the latter is that the shape invariant property of the local straight line (see definition 3.5) is not taken into consideration in this scheme, therefore the thinning result is more distorted in the nearby junctions as shown in Fig. 10(g). For details, all the mistakes of the original Stefanelli and Rosenfeld's scheme can be found in Tamura's paper/61 5.4. Comparison with four 1-subcycle algorithms Four 1-subcycle thinning algorithms are compared. One of them (Hilditch's schemet2~)performs in sequential fashion, the others (Rutovitz's,"~ Deutsch's,t3~ and

.._~-~--:..

s

----;~-:. . . . . ;;

.... iii~ :.~!~. . . . .

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

i]!i :~!~. . . . .

-.........~::::::".......

........ '

_..iii!i:_.

i!~i .:;-

::::iiiiL

:........-~iiiii.~iiu_;_~.;

./-' :~!ii.--:

T2W 1

T2W 2

.... ii~ii: ......

-

_~;r:---:L.._-:-

";_;_;A;~-::-

-:i~"z

T2W 5 .

.

.

..r-

--i:: :::::_

_i:::-':'i~':"

::r::--

-.

:i~;- ; # r "

T2W 7

-'--": "_::'_:-:..

.

T2W 8 .;;"

-i~r::~ "--:

.

.

.

.

~ili

._-;::--:_:..-:-

- -~;5.;-;-;"-

T2W 6

:~!iii-......

T2W 4

::~!!!!!!!!:: ._"/

.?_.:---~:..:.:-

.~h ::::: .

./

T2W 3

-~"

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

.

:::" --:!~L

-,;~::'-;~!!:

- ....

.{~':

....ii~giz. . . . . / "

:~iiii:'~i;S

::;;~-

ii! :

~::T~;S

ii!

::;; . . . .

-::::~!i~-iy ..............

........

n~r:-

:~,~ii~:~::i/-

u;;~:~ ~

Fig. 9. Skeletons of the pattern shown in Fig. 8 are obtained by applying the 32 cases. The average number of subcycles is 5.

Parallel thinning a l g o r i t h m s

.::::. :~iqbiE;:.

.r r .~

.:::

::::::!?:2' ::1..........

:x..

...::::::.. :::::

:~;;

:~!'!'~::::: ..... ..... •-~:"

:::

::::

::1: . . . . . . . . . .

279

:iii:

.rr r

~i!!!i!':i~'~.:'''

:1:

::::

::::

.;:-

::::::::::~r~:

:ii!ie!::. -

::... ::: .... :i!~TVr!!Ei;r!:::::::

.......

:i'i:..:.:. .;;.

~i~

....... i!~ .

.

.

:~' :~ii!!? ..

.

.

.

.

.

.:::.

TIW I

TIW 2

:::i::~

TIW 3

.~i~:

TIW 4

.~,

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

@,,/ _i~i:

. ...... --::;..::...

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

!-i-;~:

-.-'~

...... ~.~i.~;;;: i!!:

L;L;~ ~FTlW

:r!~;-'

5

TlW

:::: _~,. ... . . .. . . ... . ... . . .. . . . . . . . . . . : ......... ~i~!= . . . . . . .

6

TlW

.... ::i~! . /

TIW 8

7

:::: : : :. . . . : : .

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

:......... ii~:- . . . . . .

.i~:-'_-:!L::-

::: ....... :::: ~5

~..!.;;~

:~-:~'r~'~r"....... --

.i~-':---~iT-

.J!}J

.

;'~:---:r:::-

T IW 4 .iE: ::1::.

:::. ....

_;;

.... ~.~--.~ . . . .

:"

Li: :::..

.:.:i~iii. ....

-::::iiii-i;~ ~"

:-"'"~iii:':::./'"'

~i!!iiiii!;;:: . J :

-ilii :/

::~- _~:,

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

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

i:;~:6i r

TIW 8

Fig. 9. Continued.

T a b l e 4. C M D s b e t w e e n {T2Wt} c and {T2W~},

Table 5. C M D s b e t w e e n { T 2 W a } c and {T2W~} r

T2Wt

T 2 Wt t=l t=2 t=3 t=4 t=5 t=6 t=7 t=8

T2Wt

t=l

t=2

t=3

t=4

t=5

1 * * * * * * *

* 1 * * * * * *

* * 1 * * * * *

* * * 1 * * * *

* * * * 1 * * *

t=6t=7 * * * * * 1 * *

t=8 * * * * * * 1 *

T2WA A = A = A = A=4 A =

* * * * * * * 1

Recently, an improved

by

Holt

the

need

for

alternating

thinning

algorithm

by

expanding

element

neighbors•

to include

Through

* * * * *

* * * * *

t=3

t=4t=5

* 0.74 0.96 * 0.52

* 0.74 * * 0.52

t=6 * * * * *

0.91 * * * *

t=7

t=8

* 0.74 * * 0.52

* 0.74 * * 0.52

version of Zhang and Suen's

proposed

removes each

5

t=2

'*' d e n o t e s {T2Wa}c * {T2Wt},. A = 1: D e u t s c h ' s scheme, tS) A = 2: Z h a n g and Suen's scheme, t12~ A = 3: C h e n and Hsu's scheme/TM A = 4: A p p r o x i m a t e d Stefanelli and Rosenfeld's s c h e m e . A = 5: A p p r o x i m a t e d T a m u r a ' s scheme.

'*' d e n o t e s {T2Wt}~ * {T2W,},.

a p p r o a c h 112) w a s

1 2 3

t=l

et

the

of

window

edge information

our detailed

al/TM

subcycles

about

examinations,

It

scheme

a

connected

for its this

still

has

the

deficiencies

curves and excessive

F i g . 1 l(b). I n a d d i t i o n , complex

than

our

new

of imperfectly

erosion

this algorithm approach,

c a l c u l a t e at l e a s t six e d g e f u n c t i o n s

as s h o w n is m u c h

because

8in

more

it m u s t

for each element

280

YUNG-SHENGCHEN and WEN-HSINGHSU ~iii~.

. . . . . . . :......-". :::::_

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

-iiiii: ..:ii~i~i~i:

~!~!~!ii!~ !''''::

:::::::::::::::::::::::: ......................... -~'.'--'-"":::"" . . . . . . . .

:~iii. . . . . . . .

:;:;;;;z:::. -............

Y'EL:. :::::::

"~'::

.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . . . . . . . . . . . . . . . . . . . . . ................. :::::::::;:::

:::: :::

:::1::-

.~;-

ii!!i

~ .:~:-

-::-""-:':J" .::" ::-';::.

!iiiiii

~:

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

(a) NI=6

. .i.~. .[.! ~ ........

~i~r:~~:

:_.:::-.

(b) NI=I5

~i!!~!!!ii~

(c) HI=6

:: :: -: :' .:':. :' ::: . ::::::.

;!!!!!~!!!ii~:

(d) NI=8

.i~:

.ili:

.:::::'

:i~i~;:

-. . . .

::::iiii--~i~f

................ .~!iii!i!iiii~.

~!!:::::::~:------: .........

iii~i!

::::~zr--.::'. ......

!iiiii~

~!!!!ii!!!!!ii!!!~!~"

._ii~i::::-- ~ -

~:-

.ii~iiii

:i~!~!!!!~!i!!!~ii!~ii ~

:~--iii:

.:~iiiii~

(e) NI=7

:iiii~i:

(f) NI=8

.,~ ~!i~.

~

:~---iii:

(g) NI=5

Fig. 10. Thinning results obtained by (a) Deutsch's, ~) (b)Zhang and Suen's,(~2~ (c)Chen and Hsu's, "s~ (d)-(e)approximated Tamura's, and (f)-(g)approximated Stefanelli and Rosenfeld's scheme. (NI denotes the number of subcycles.)

...... .

.

.

.

.....

. .

.

:iii:

. .

. .

.

.

.

.

. . . . ::::::::

.

.

.

.

.

. . . :::::::.

.

.

.

.

iiiiii::::~i~ii~iiiiiii . . . . . . . . . . .

. . . . . . . . . :::::::: . . . . . . .

.

.

.

.

.

.

.

. .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

(a) NI=9

.

.

.

.

.

.

.

.

.

.

.

.

. .

.

.

.

.

.

.

.

.

..

.

.

.

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

.

.

.

.

.

.

.

.

.......... ii!~: . . . ....... . . ..... .

.

.

.

.

.

.

(b) NI=I6

version spends two more time-units than the 2subcycle version. Therefore, we recommend that the pseudo 1-subcycle version is better in practical applications. Since the pattern being processed is always unknown, we do not recommend which case of the pseudo 1-subcycle version should be selected. All of these cases can produce good thinning results; the user can select any case to satisfy the visual quality.

Fig. 1 I. Thinning results obtained by (a)Deutsch's,~3) and (b)Holt

et al.'s~ )

scheme. (NI denotes the number of

subcycles.)

and does not possess the advantage of the efficient operations presented in Section 5.1. The characteristics of all the algorithms compared and the proposed approach are summarized in Table 6. It shows that, based on the new systematic approach, the proposed algorithms are more efficient and effective for practical applications. 6.

C O M M E N T S

Many researchers have proposed complex thinning algorithms to treat the patterns containing only little contour noise. We recommend that, in such cases, it is more economic tO use a low-complexity smoothing process to remove the noise, so that the thinning algorithm will not become complex for solving the problem of noise. According to the experiments and analyses discussed in Section 5, and assuming a fully parallel processor, the pseudo 1-subcycle version obtains better thinning results (especially in terms of isotropy) and takes fewer subcycles than the 2-subcycle version, even though in one subcycle the pseudo 1-subcycle

7.

CONCLUSIONS

This paper has presented a systematic approach for designing parallel thinning algorithms. Three new functions called the local connecting (LC), the extended local connecting (ELC), and the erosive direction number (EDN) functions have been introduced. With these functions as well as two properties of shape invariance of the local edge and the local straight line, all the possible cases of the 2-subcycle parallel thinning algorithm are constructed. By further using the ELC-function, the 2-subcycle version can be easily reduced to the pseudo 1-subcycle version and the number of iterations is also decreased. By using the new definition of LC-function and the shape invariance of local straight line, the skeletons produced are always perfectly 8-connected. Experiments have shown that with this new approach, more efficient and effective algorithms can be constructed for practical applications.

S U M M A R Y

Thinning is an important technique in image processing. Because thinning results can preserve pattern

Parallel thinning algorithms

281

Table 6. Characteristics of all the compared algorithms and the new proposed approach Number of Type of Excessive Algorithm Operation subcycles thin line erosion RutovitzI1~ Parallel 1 Imperfect Yes 8-curve HilditchTM Sequential 1 perfect No 8-curve Deutsch~3~ Parallel 1 Imperfect No 8-curve Stefanelli~4~ Parallel 2 Imperfect No 8-curve Deutsch ~s~ Parallel 2 Imperfect No 8-curve Tamura ~8~ Parallel 2 Imperfect No 8-curve Zhang~127 Parallel 2 Imperfect Yes 8-curve Holt I16~ Parallel 1 Imperfect Yes 8-curve Chen~18~ Parallel 2 Imperfect No S-curve New Parallel 2 Perfect No approach (2) 8-curve New Parallel (*)1 Perfect No approach (l) 8-curve (*) denotes pseudo l-subcycle.

features and facilitate vectorization, thinning is frequently used in recognition or data compression of line drawings. This paper presents a systematic approach for designing parallel thinning algorithms. Three new functions, namely local connecting, extended local connecting and erosive direction number, are introduced. With these functions, as well as two properties of shape invariance of the local edge and local straight line, all the possible cases of the 2-subcycle parallel thinning algorithm are constructed and all the corresponding removing conditions are generated and assigned automatically. By further using the extended local connecting function, the 2-subcycle version can be easily reduced to the pseudo 1-subcycle version. Consequently, the number of iterations required by the pseudo 1-subcycle version is about 50 percent smaller than that required by the 2-subcycle version, if the width of the input pattern is uniform. The skeletons produced are always perfectly 8-connected due to the use of the local connecting function and the shape invariance of the local straight line. This technique prevents excessive erosion. The efficiency of these proposed algorithms can be further increased, i.e. reduction of time-units in a single iteration, by using the strategies of table lookup and local parallel broadcast. Thus, the Hardwareoriented measures for parallel thinning algorithms are of concern in this paper; possible hardware implementing the proposed algorithms is also presented. According to the detailed evaluations, it only takes approximately six (eight) time-units per subcycle for the 2(pseudo 1)-subcycle version. The use of the compatibility of matching deletingconditions shows that the new approach provides a

bound for several popular 2-subcycle parallel thinning algorithms. Experimental results also show that the pseudo 1-subcycle version derived from the new approach can produce a more isotropic and perfectly 8-connected curve with fewer iterations, and prevent excessive erosion. Acknowledgements--The authors are very grateful to Professor Jun S. Huang and Mrs Ming Y. Hsu for their valuable advice and suggestions.

REFERENCES

1. D. Rutovitz, Pattern recognition, J. R. Statist. Soc. 129, 504-530 (1966). 2. C. J. Hilditch, Linear skeletons from square cupboards, Machine Intelligence IV B. Meltzer and D. Michie, Eds, pp. 403-420. American Elsevier, New York (1969). 3. E. S. Deutsch, Comments on a line thinning scheme, Br. Comput. J. 12, 142 (1969). 4. R. Stefanelli and A. Rosenfeld, Some parallel thinning algorithms for digital pictures, J. Ass. Comput. Mach. 18, 255-264 (1971). 5. E. S. Deutsch, Thinning algorithms on rectangular, hexagonal, and triangular arrays, Communs. ACM 15, 827 837 (1972). 6. H. Tamura and K. Mori, A parallel thinning algorithm for binary pictures and its connectivity, 1974 Natn. Cony. Rec. IECEJ, No. 1539, p. 1390 (1974). (In Japanese.) 7. S. Yokoi, J. I. Toriwaki and T. Fukumura, An analysis of topological properties of digitized binary pictures using local features, Comput. Graphics Image Process. 4, 63 73 (1975). S. H. Tamura, Further considerations on line thinning schemes, Paper of IECEJ Technical Group on Pattern Recognition and Learning, PRL75-66, pp. 49-56 (1975). (In Japanese.) 9. C. Arcelli and G. Sanniti di Baja, On the sequential approach to medial line transformation, IEEE Trans. Syst. Man. Cybernetics, SMC-8, 139-144 (1978).

282

YUNG-SHENGCHEN and WEN-HSING Hsu

10. T. Pavlidis, A thinning algorithm for discrete binary images, Comput. Graphics Image Process. 13, 142-157 {1980). 11. C. Arcelli, L. P. Cordella and S. Levialdi, From local maxima to connected skeletons, 1EEE Trans. Pattern Analysis Mach. Intell. PAMI-3, 134-143 (1981). 12. T. Y. Zhang and C. Y. Suen, A fast parallel algorithm for thinning digital patterns, Communs ACM 27, 236 239 (1984). 13. N. J. Naccache and R. Shinghal, An investigation into the skeletonization approach of Hilditch, Pattern Recognition 17, 279-284 (1984). 14. N. J. Naccache and R. Shinghal, SPTA: a proposed algorithm for thinning binary patterns, IEEE Trans. Syst. Man Cybernetics, SMC-14, 409-418 (1984). 15. Y. K. Chu and C. Y. Suen, An alternate smoothing and stripping algorithm for thinning digital binary patterns, Signal Process. II, 207-222 (1986). 16. C. M. Holt, A. Stewart, M. Clint and R. H. Perrott, An

17. 18. 19. 20. 21. 22.

improved parallel thinning algorithm, Communs ACM 30, 156-160 (1987). S. Suzuki and K. Abe, Binary picture thinning by an iterative parallel two-subcycle operation, Pattern Recognition 20, 297-307 (1987). Y. S. Chen and W. H. Hsu, A modified fast parallel algorithm for thinning digital patterns, Pattern Recognition Lett. 7, 99-106 (1988). H. Tamura, A comparison of line thinning algorithms from digital geometry viewpoint, Proc. 4th Int. Conf. Pattern Recognition, Kyoto, pp. 715-719 (1978). S. H. Y. Hung and T. Kasvand, Critical points on a perfectly 8- or 6-connected thin binary line, Pattern Recognition 16, 297-306 (1983). R. W. Smith, Computer processing of line images: a survey, Pattern Recognition 20, 7-15 (1987). A. Rosenfeld, Digital straight line segments, IEEE Trans. Comput. C-23, 1264-1269 0974).

About the AuIhor--YUNG-SHENG CHEN was born in Taiwan, on 30 June 1961. He received B.E. and M.E. degrees in Electrical Engineering from Chung Yuan Christian University and National Tsing Hua University, Taiwan, in 1983 and 1985, respectively. He is now a doctoral student of Electrical Engineering of National Tsing Hua University in Taiwan. He is currently interested in image processing, parallel processing and human perception. About the Author WEN-HSING HSU was born in Taipei, on 17 May 1950. He received B.E. degree in electrical engineering from National Cheng-Kung University, Taiwan, in 1972 and received M.E., Doctor of Engineering degrees in electrical engineering from Keio University, Tokyo, Japan, in 1978 and 1982, respectively. His research interests include image processing, pattern recognition and parallel processing algorithm. Since 1982, he has been an Associate professor of Department of Electrical Engineering at National Tsing Hua University, Taiwan, and a Research Associate at the Institute of Information Science, Academia Sinica, R.O.C. since 1985. He received the award of Sun Yat-Sen Cultural Foundation in November 1986, and was honored with an outstanding person in Information science of R.O.C. in 1986. Dr Hsu is a member of the Institute of Electronics, Information and Communication Engineers (IEICE), and Information Processing Society of Japan and a member of the IEEE Computer Society of U.S.A.