Redundancy of parallel thinning

Redundancy of parallel thinning

Pattern Recognition Letters ELSEVIER Pattern RecognitionLetters 18 (1997) 27-35 Redundancy of parallel thinning You Yi Z h a n g Zeta Software Inc.,...

505KB Sizes 0 Downloads 80 Views

Pattern Recognition Letters ELSEVIER

Pattern RecognitionLetters 18 (1997) 27-35

Redundancy of parallel thinning You Yi Z h a n g Zeta Software Inc., 49 Sterling Street, Malden, MA 02148, USA Received 12 June 1996;revised 12 November1996

Abstract

Many algorithms for vectorization by thinning have been devised and applied to a great variety of pictures and drawings for data compression, pattern recognition, and raster-to-vector conversion. But most existing thinning algorithms generate skeletons with redundancy. Therefore, in such cases, the additional work would be taken to remove the redundant pixels. In this paper, the perfect (or one-pixel-wide) skeleton is defined, a theorem is proposed to generate perfect skeletons and the thinning speed with redundancy is also discussed. © 1997 Elsevier Science B.V. Keywords: Parallel thinning; Perfectskeleton;SubiterationTemplatematching;Vectorization

1. Introduction

2. Definitions and notations

In dealing with pattern recognition, data compression, and raster-to-vector conversion, the study of vectorization has attracted more and more attention in industries and academia, since it can be applied to compressing data and retaining significant features of the image. But, vectorization algorithms require onepixel-wide lines as input (Lain and Lee, 1992). One cannot use some published algorithms for vectorizing if there are redundant pixels in skeletons. Therefore, in such cases, one should do some work (additional thinning as shown in Fig. 1) to remove the redundant pixels. The additional thinning step can be skipped if a perfect thinning algorithm is used. This article is organized as follows. Section 2 contains definitions and notations. Section 3 proposes the redundancy theorem after analyzing four thinning algorithms. A new measure method of thinning speed and the results of experiments are shown in Section 4. Section 5 discusses the future work.

The image is the set of all points in the Euclidean plane. A set is finite if it contains only a finite number of elements. Let Q be a finite image and B = {0, 1}. A finite binary image is a function V mapping Q into B. Then the binary image is uniquely defined by its foreground set P (or black pixel set). Those of the complement set will be termed background set (or white pixel set). P = { P I P ~ Q/x V ( p ) = 1}.

Definition 1. N ( p ) is the set of all neighbors of p and is termed the neighborhood of p (Fig. 2). The neighbors having even numbers (p [ 0], p [ 2], p [4], p[6] or North(p), East(p), South(p), West(p) ) are called the 4-neighbors of p; the neighbors with odd numbers (p[ 1], p [ 3 ] , p [ 5 ] , p[7] or North-East(p), South-East(p), South-West(p), North-West(p)) together with the 4-neighbors, are called the 8-neighbors of p.

0167-8655/97/$17.00 (~) 1997 ElsevierScienceB.V. All rights reserved. PH S0167-8655 (96) 00127-4

Y.Y. Zhang/Pattern Recognition Letters 18 (1997) 27-35

28 mlllllllnUUlllillmlllliimlliiii i,o,.,,,,,.,o,,,,i,,.,,,,,om.,,, :i;;::::::::~ ~

IlllllillNnlillilmmmililmlmllil Imim,no,,,,mlma.,,,,jDJ,,oH,gm

"~:i::::;i;IIIIl;I;Illl;;II;IlIll]I;lll~IIIIll

(1)

f2)

illlllliiimnlllimiilellllllnlll mno.,mml,,.,,llno.,Jlm.nomn

a

|II|IlllIl|IlI|;I|II||ll|II|l;I

(3)

(4~

Fig. 1. Thinning: (1) to (2), additional thinning: (2) to (3), and veetorization: (3) to (4). (l) Image "A". (2) Skeleton by algorithm ZS (Zhang and Suen, 1984) (with 6 redundant pixels). (3) One-pixel-wideskeleton. (4) Vectordrawing by vectorization. p[7]

p[0]

p[1]

p[61

p

p[2]

p[5]

p[4]

p[3]

Fig. 2. Window W: pixel p and its neighbors.

Definition 2. The weight number of p, W N ( p ) , is defined as 7

WN(p) = Zp[k]

* 2 k.

GRS = { 3 , 5 , 6 , 7 , 1 2 , 1 3 , 1 4 , 1 5 , 2 0 , 2 1 , 2 2 , 2 3 , 2 4 , 28,29,30,31,48,52,53,54,55,56,60,61,62,63, 65,67,69,71,77,79,80,81,83,84,86,88,89,91, 92,94,96,97,99,101,103,109,111,112,113, 115,116,118,120,121,123,124,126,129,131, 133,135,141,143,149,151,157,159,181,183, 189,191,192,193,195,197,199,205,207,208, 209,211,212,214,216,217,219,220,222,224, 225,227,229,231,237,239,240,241,243,244, 246,248,249,251,252,254}, # = 108.

k=O

For a 3 • 3 window the weight numbers are in the range 0 through 255. For the rest of this paper, we always use the weight number W N ( p ) to indicate a point p. For example, pixel 86 means the pixel p with the weight number 86. The set that consists of all weight numbers is called WS = {0, 1. . . . . 255}. Definition 3. The neighbor number of p, N N ( p ) , is the number of nonzero neighbors of the current pixel p:

Definition 6. A point p E P is called irreducible i f p is not a globally removable point. The set consisting of all irreducible points is termed IPS. Thus IPS = WS - GRS. Definition 7. The removable set (or locally removable set) of subiteration k of algorithm o~, wLRS [ k], is the subset of GRS which satisfies the k-subiteration condition wCk, i.e., wLRS[k] = { p [ p E GRS A p E wCk}.

7

N N ( p ) = ~-~p[k]. k=0

Definition 4, The connection number of p, C N ( p ) , is defined as

An element in wLRS is called a removable point. The totally removable point set of algorithm w, ~oTRS, is the set union of all wLRS[k] : wTRS = LJ toLRS[k],

CN(p)=

Z

p[k].(p[k+l]Up[k+2]).

k=l

k=0,2,4,6

where n is the number of subiterations. Note that p[k] = 1 - p [ k ]

and p [ 8 ] = p [ 0 ] .

Definition 5. A point p E P is called globally removable if C N ( p ) = 1 and N N ( p ) > 1. The set consisting of all globally removable points is termed GRS.

For example, the removable sets for a 4-subiteration thinning algorithm called PTA4 can be defined as pta4LRS[ 1 ] = {p I P E GRS A North(p) = 0},

YY Zhang/Pattern Recognition Letters 18 (1997) 27-35

pta4LRS[2] = {p [ p E GRS A South(p) = 0}, pta4LRS[3] = {p I P E GRS A East(p) = 0}, pta4LRS[4] = {p [ p E GRS A West(p) = 0}. The totally removable set pta4TRS is 4

pta4TRS = U pta4LRS [ k]. k=l

Definition 8. A skeleton S is called perfect (i.e., of one-pixel-wide) if all pixels in S are not in GRS. Definition 9. The redundancy of an algorithm to, N(w), is defined as

~(~o) -- 1 - l a , TRSI/IGRSI,

29

3.1. Thinningalgorithm GH (Gao and Hall, 1989) GH is a 2-subiteration parallel thinning algorithm with one subiteration deleting the north and east contour points and the other deleting the south and west contour points. The subiteration conditions are as follows. a. CN(p) = 1 b. 2 ~< M ( p ) ~<3 c. Apply one of the following: 1. (p[0] V p [ 1 ] V,-~p[3]) A p [ 2 ] = 0 (the first subiteration) 2. (p[4] V p [ 5 ] V,,~p[7]) A p [ 6 ] = 0 (the second subiteration) Thinning stops when no further deletions occur. Here M(p) = min{Ml(p), M2(p)} with

where 0 <~ ~(~o) ~< I.

Ml(p)=(p[7] V p [ 0 ] ) + ( p [ 1 ] V p [ 2 ] ) It is possible that ~R(w) is less than 0 for some algorithm to. In that case, ]wTRSI must be greater than ]GRS I, and some end points (CN(p) = 1 and NN(p) = 1), hole points (CN(p) = 0), or breakpoints ( C N ( p ) > 1 ) must be in toTRS - G R S . Therefore, algorithm oJ would delete some end points, create some hole points, or disconnect the skeleton. Definition 10. A thinning algorithm is perfect if it can generate perfect skeletons.

3. Redundancy of parallel thinning In parallel thinning, pixels are examined for deletion based on the results of only the previous iteration. For this reason, these algorithms are suitable for implementation on parallel processors where the pixels satisfying a set of conditions can be removed simultaneously. Unfortunately, fully parallel algorithms can have difficulty preserving the connectedness of an image if only a 3 * 3 window is considered. Therefore, the usual practice is to use 3 * 3 neighborhoods but to divide each iteration into subiterations in which only a subset of the contour pixels are considered for removal (Lam and Lee, 1992). Normally, each subiteration has its thinning conditions. In the following four 2-subiteration thinning conditions are shown.

+(p[3] Vp[4])+(p[5]

Vp[6]),

M2(p) = (p[0] V p [ 1 ] ) + (p[2] V p [ 3 ] ) + (p[4] V p [ 5 ] ) + (p[6] V p [ 7 ] ) . Two removable sets for algorithm GH could be constructed as follows. ghLRS [ 1 ] = {p E GRS/x p E ghCl } = {028,056,060,065,067,080,081,083,088,089, 092,097,099, 112, 113, 115,120, 121,124, 131, 193,195,208,209, 211,216,217,220,224,225, 227,240,241,243,248,249,252}, # = 37, ghLRS[2] = {p E GRS A p E ghC2} = {005,007,013,014,015,020,021,022,023,028, 029,030,031,052,053,054,055,056,060,061, 062,063,131,133,135,141,143,149,151,157, 159,193,195,197,199,205,207}, # = 37, where condition ghC1 is CN(p)=I/X2<~M(p)

<<.3IX

(p[0] + p [ 1 ] + ( 1 - p [ 3 ] ) ) , p [ 2 ] and condition ghC2 is

=0

30

Y.Y. Zhang/Pattern Recognition Letters 18 (1997) 27-35

CN(p) = I A 2 ~ < M ( p )

<~3A

(p[4] + p [ 5 1 + ( 1 - p [ 7 ] ) ) * p [ 6 1

=0.

The following procedure describes the process of the construction of the removable sets ghLRS [ 1] and ghLRS [ 2 ]. Procedure Removable_Set_Construction begin for k := l to 2 do begin ghLRSfk] := {}; for I := 0 to 255 do If I E ghCk then ghLRS[k] := ghLRS[k] + {I}; end; end; For example, given three pixels: 28, 34 and 151, the following three 3 * 3 windows can be constructed: 000

= {003,006,012,024,048,069,071,077,079,084, 086,091,094,096,101,103,109,111,116,118, 123,126,129,181,183,189,191,192,212,214, 219,222,229,231,237,239,244,246,251,252}. This means that only 68 types ofpixels can be removed and the other 40 types of pixels cannot be removed in each iteration. Therefore, the redundancy of GH is ~R(GH) = 1 -

IghTRSI/IGRSI= 40/108

3.2. Algorithm ZS (Zhang and Suen, 1984)

In 1984, Zhang and Suen published a 2-subiteration parallel thinning algorithm: in the first subiteration, the contour point p is deleted from the digital pattern if it satisfies the following conditions: (a) 1 < NN(p) < 6;

001

1 1 1

(b) A ( p ) = 1;

0p0

0p

1

(c) p[0] , p [ 2 ] , p [ 4 ] =0;

0 1 1

100

0 1 0

(d) p[2] , p [ 4 ] , p [ 6 ] =0;

(28)

(34)

(151)

0p

1

Then we examine them if they satisfy the thinning conditions: P28 satisfies ghCl; P34 does not satisfy ghCl or ghC2; Plsl satisfies ghC2. After examining all pixels (0 to 255), the removable sets ghLRS[ 1] and ghLRS [ 2 ] can be constructed and ghTRS (included two subiterations) is ghTRS = ghLRS[1] + ghLRS[2] = {005,007,013,014,015,020,021,022,023,028, 029,030,031,052,053,054,055,056,060,061, 062,063,065,067,080,081, 083,088,089,092, 097,099,112,113,115,120, 121,124,131,133, 135,141,143,149,151,157, 159,193,195,197, 199,205,207,208,209,211, 216,217,220,224, 225,227,240,241,243,248, 249,252}, # = 68. The set of all redundant points for algorithm GH is ghRS = GRS - ghTRS

,.~ 0.37.

where A (p) is the number of 01 patterns in the ordered set p[0] ,p[ 1] . . . . . p[7]. In the second subiterative, only conditions (c) and (d) are changed as follows: (c') p[0] , p [ 2 1 *p[61 =0; (d') p[0] *p[41 . p [ 6 1 =0; and the rest remains the same. Using the Removable_Set_Construction procedure, the removable sets of ZS are zsLRS[1] = {003,006,007,012,014,015,024,028, 030,048,056,060,062,096,112,120,129,131, 135,143,192,193,195,199,207,224,225,227, 231,240,241,243,248,249}, # = 34, zsLRS[2] = {003,006,007,012,014,015,024,028, 030,031,048,056,060,062,063,096,112,120, 124,126,129,131,135,143,159,192,193,195, 224,225,227,240,248,252}, # = 34,

31

Y.Y. Zhang/Pattern Recognition Letters 18 (1997) 27-35

zsTRS = {003,006,007,012,014,015,024,028, 030, 031,048,056,060,062,063,096, 112,120, 124,126,129,131,135,143,159, 192,193,195, 199,207,224,225,227, 231,240, 241,243,248, 249,252}, # =40. The redundancy of Algorithm ZS is ~(zs)

= 1 - I z s a ' R S l / l G R S I = 68/108 ~ 0.62.

3.3. Algorithm LW (Lu and Wang, 1986)

3.4. Algorithm PTA2T (Zhang and Wang, 1996) Fig. 3 shows the templates for use in the thinning algorithm PTA2T. There are eleven 3 • 3 templates (T01 to Tll) in this template set. The symbols "p", "0", "1", " . " and "#" used in these templates, denote the currently tested pixel, a white pixel, a black pixel, a don't-care pixel, and a pixel in IPS, respectively. Each template T is a set of neighborhoods of pixel p. For example, the template T01 shown in Fig. 3 can be expressed as follows:

In 1986, Lu and Wang published a 2-subiteration parallel thinning algorithm as follows:

00.

(a) 2 < N N ( p ) < 6;

*1.

0p

1

=

0p

(c) p [ 0 ] * p [ 2 ] * p [ 4 ]

=0;

(d) p [ 2 ] * p [ 4 ] * p [ 6 ]

=0;

01

(d') p[0] . p [ 4 ] . p [ 6 ] =0; and the rest remains the same. Using the Removable_Set_Construction procedure, the removable sets (IwLRS[ 1] and IwLRS[2]) and the totally removable set (IwTRS) can be constructed: lwLRS[I] = {007,014,015,028,030,056,060,062, 112,120,131,135,143,193,195,199,207,224, 225,227,231,240,241,243,248,249}, # = 26, IwLRS[2] = {007,014,015,028,030,031,056,060, 062,063,112,120,124,126,131,135,143,159, 193,195,224,225,227,240,248,252}, # = 26, IwTRS = {007,014,015,028,030,031,056,060, 062,063,112,120,124,126,131,135,143,159, 193,195,199,207,224,225,227,231,240,241, 243,248,249,252}, # = 32. The redundancy of Algorithm LWis = 1 - I I w ' r R S I / I G R S I = 76/108 ~ 0.7.

0p 010

20

22

or

0 p 1

1

000

000 1

or

0p

1

01

1

28 001

or

0 p 1

1 10

1 10

52

54

30

0p

or

000

0 p 1

where A (p) is the number of 01 patterns in the ordered set p [ 0 ] ,p[ 1] . . . . . p [ 7 ] . In the second subiteration, only conditions (c) and (d) are changed as follows: (c') p[0] . p [ 2 ] . p [ 6 ] =0;

1

001 or

001

010

T01

(b) A(p) = 1;

~(tW)

000

or

001 1

or

0p

1

1 1 1

1 1 1

60

62

We can convert all templates to weight numbers as follows: T01 = {20,22,28,30,52,54,60,62},

# = 8,

T02 = {80,88,112,120,208,216,240,248},

# = 8,

T03 = {84,86,92,94,116,118,124,126,212,214, 220,222,244,246,252,254}, # = 16, T ~ = {209,217,241,249}, T05={6,14},

#=4,

#=2,

T~={48,56},

#=2,

ro7={12},

#=1,

ros = {24},

# = 1,

To9={211,219,243,251},

#=4,

32

Y.Y. Zhang/Pattern Recognition Letters 18 (1997) 27-35

00.

* 00

* 0*

1 1 0

00

1

000

000

1

1 p0

1 p 1

1 p0

0p

1

0p0

0p

* 1 *

* 1.

*1.

*1.

00.

1 1.

001

0p

T01

TO2

To3

To4

To5

To6

1

To7

000

1 # 1

0 1 0

0#

1

0p0

lp0

#p0

#p

0

*1.

*1.

*1.

01

1

To8

To9

T10

Zl 1

Fig. 3. Thinning templates for algorithm PTA2T.

T10 = {81,89, 113,121},

#=4,

T~r = {83,91, 115,123},

#=4.

wn[7]

wn[0]

wn[1]

wn[6]

p

wn[2]

wn[5]

wn[4]

wn[3]

Then Fig. 4. WN window: pixel p and its neighbors.

pta2tLRS [ 1 ] = Tl +T2 -q-T3+T4 +T5 -q-T6+T7 +/'8 -b-T9+ Ti0 + Tll = {006,012,014,020,022,024,028,030,048,052, 054,056,060,062,080,081,083,084,086,088, 089,091,092,094, 112,113,115,116, 118,120, 121,123,124, 126,208,209, 211,212,214,216, 217,219,220,222,240,241,243,244,246,248, 249,251,252,254},

#=54.

The second removable set, pta2tLRS[2], can be constructed by 180° rotations of the removable set pta2tLRS [ 1] : pta2tLRS[2] = {003,005,007,013,015,021,023, 029, 031,053,055,061,063,065,067,069,071, 077,079,096,097,099,101,103,109, 111,129, 131,133,135,141,143,149, 151,157,159, 181, 183,189,191,192, 193,195,197, 199,205,207, 224,225,227,229, 231,237,239}, # = 5 4 . The totally removable set pta2tTRS is the sum of pta2tLRS[ 1] and pta2tLRS[2] which is equal to GRS. Therefore, the redundancy of algorithm PTA2T is ~R(PTA2T) = 1 - Ipta2tTRSJ/JGRSl = 0/108 = 0.

3.5. Redundancy theorem Thinning algorithms can have difficulty generating the skeletons without redundancy if only 3 * 3 supports are considered; for example, templates T09, Tl0 and Ti I

in Fig. 3 may not be implemented because there is not enough information to examine whether the neighbors are in IRS in such a thinning process. Therefore, the usual practice is to use 3 • 4 or 4 • 3 or 4 • 4 neighborhoods. In Fig. 4, a new configuration called weight number window (WN window) is proposed in which the neighbors of p are represented by weight numbers W N ( p [ k ] ) , where wn[k] = W N ( p [ k ] ) , k = 0 . . . . . 7. Using the WN window, it is easy to design the thinning procedure ThinAlg shown in Fig. 5. There are four parameters for this procedure: max_row is the maximum row number of the pattern; max_col is the maximum column number of the pattern; Q is the digitized pattern array: q[ 1..max_row, 1 ..max_col] ; AlgArr is the algorithm array which can be Pta2tAlg or GhAlg or ZsAlg or LwAlg. In the procedure ThinAlg, "WNQ := W N ( Q ) " means a weight number matrix W R Q [ i , j ] to be constructed by WN(q[i,j]) for i from 1 to max.,row and j from 1 to max_col; "wn := WNW(q[row, col] )" means the elements of weight number array wn[0] . . . . . wn[7] to be assigned by the WN window of pixel q[row, col]. We use Pta2tAlg as an example to explain how to construct the algorithm array Pta2tAlg [ 1..2, 0..255 ]. Since the total weight number is 256 the first subiteration algorithm array Pta2tAlg[ 1, k] (k = 0 . . . . . 255) can be constructed from pta2tLRS[ 1 ] as follows: Pt~lg[1,0..255]={0,0,0,0,0,0,1,0,0,0,0,0, 1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0, 1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,

Y.Y. ZtmnglPattern Recognition Letters 18 (1997) 27-35

33

Procedure ThinAlg(AlgArr, Q, max_row, max_col) begin thinning_not_end := TRUE; while (thinning_not_end) do begin thinning_not_end := FALSE; for k := 1 to 2 do begin WNQ := WN(Q); for row := 2 to max_row - 1 do for col := 2 to max_col - 1 do begin stable := FALSE; wn := WNW(q[row, col] ); case AlgArr[ k, WNQ[row, coil ] of 1: stable := TRUE; 2: if AlgArr[k, wn[0] ] = 0 then stable := TRUE; 3: ifAlgArr[k, wn[6]] = 0 then stable :=TRUE; 4: if AlgArr[k, wn[0] ] = 0 and AlgArr[k, wn[6]] = 0 then stable := TRUE; end; {case} if (stable) then begin q[row, col] := 0; thinning_not_end := TRUE; end; end; {row, col} end; {k} end; {while} end; {ThinAlg} Fig. 5. The 2-subitoration thinning procedure.

(e)

Ca)

(e)

Fig. 6. Comparisons of thinning results (the white rectangle is the removed pixel). (a) Original image "Diamond". (b) Skeleton by PTA2T. (c) Skeleton by GH. (d) Skeleton by ZS. (e) Skeleton by LW.

0,0,0,0,0,1,3,0,4,1,0,1,0,1,3,0,4,1,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,4,1, 0,1,0,1,3,0,4,1,0,1,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,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,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,1,1,0,2,1,0,1,0,1,1,0,2,1,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0, 2,1,0,1,0,1,1,0,2,1,0,1,0}

YY Zhang /Pattern Recognition Letters 18 (1997) 27-35

34

Table 1 Comparisons of four 2-subiteration thinning algorithms Iteration

Subiteration

1

1

1

2

2 2 3 3 4 4 5 5 Total

I 2 1 2 1 2 1 2

PTA2T 200 131 119 108 99 92 87 85 84 84 1089

Tested pixels GH ZS 200 200 135 186 122 175 111 164 102 157 95 150 90 147 87 146 86 146 86 146 1114 1617

where the value of each element of Pta2tAIg[ 1, k] is assigned by the following table. Pta2tAlglWN(p) ] 0 1 2 3 4

p is stable no yes ( T01-T08) yes if North(p) is in IPS (To9) yes if West(p) is in 1PS (Tl0) yes if North(p) and West(p) a r e i n IPS (Tll)

For example, pixel 6 in T05 is stable, then Pta2tAlg[1, 6] := 1; pixel 81 in /'10 is stable if West(p) is in IRS, then Pta2tAlg[1,81] := 3. Pta2tAlg [ 2, k] can be constructed from pta2tLRS [ 2 ] in the same way. The weight number window gives a method to get more information from a 3 • 3 configuration, but not how to examine if a thinning algorithm is perfect. This problem will be solved by the following theorem.

Theorem 1 (Redundancy Theorem). A thinning algorithm w is perfect if ~ ( o) ) = O. Proof. From Definitions 8 and 10, an algorithm w is perfect if the skeleton S is generated by o) and all pixels in S are not in GRS. It is assumed that there is a thinning algorithm ~o with ~R(o)) = 0 which generates a skeleton S and there is a pixel p E S and p E GRS. By the definition, if ~(o~) = 0, then all pixels in GRS are removed by the algorithm toin the thinning process. So that there is no skeletal pixel which is in GRS if

~(o))

=

O. []

From the discussion above, algorithms GH, ZS and

LW 200 186 175 164 157 150 147 146 146 146 1617

PTA2T 69 12 11 9 7 5 2 1 0 0 116

Removed pixels GH ZS 65 14 13 11 11 11 9 7 7 7 5 3 3 1 1 0 0 0 0 0 114 54

LW 14 11 11 7 7 3 1 0 0 0 54

Table 2 Numbers of redundant pixels in skeletons of pattern "Diamond" PTA2T 0

GH 1

ZS 63

LW 63

LW are not perfect, and the algorithm PTA2T is perfect.

4. Speed of parallel thinning It is desirable that measures of thinning speed provide results which are generally applicable to a wide range of computers. In this section, a new measure method is proposed: the parallel speed of an algorithm is measured by the number of those pixels tested to solve the problem. Parallel implementations of the four algorithms have been simulated on a serial machine (pentium 100 IBM PC). The numbers of pixels tested for these algorithms are given in Table 1. These implementations have been applied to the image "Diamond" illustrated in Fig. 6. Table 2 shows the numbers of redundant pixels for these algorithms. From the experimental results above, the parallel speed of PTA2T is superior to those of algorithms GH, ZS and LW.

5. Discussions There is no general agreement what exactly thinning is, but it is reasonable that thinning algorithms should generate skeletons without redundancy. This requirement holds not only for vectorization but also for improvement of thinning speed. In this paper, the redundancy theorem is proposed, which guarantees to

Y.Y. Zhang/Pattern Recognition Letters 18 (1997) 27-35

generate perfect skeletons if some conditions are satisfied. The weight number window is presented which can get more information from a 3 • 3 configuration. We also compare four 2-subiteration algorithms with some experimental results. More examples will be tested with different algorithms, particularly with perfect thinning algorithms we have defined in this paper, and hopefully, a criterion for the quality of the resulting skeletons can be found in future research.

Acknowledgements The author is grateful to the Managing Editor E. Backer and to the reviewer; their detailed comments have been very helpful in the revision of this article.

35

References Gao, Z. and W.R. Hall (1989). Parallel thinning with twosubiteration Algorithm. CACM 32 (3), 359-373. Lam, L.S.W. and C.Y. Suen (1992). Thinning methodologies - a comprehensive survey. IEEE Trans. Pattern Anal. Mach. Intell. 14 (9), 869-885. Lu, H.E. and P.S.P. Wang (1986). A comment on "A fast parallel algorithm for thinning digital Patterns". CACM 29 (3), 239242. Zhang, T.Y. and C.Y. Suen(1984). A fast parallel algorithm for thinning digital patterns. CACM 27 (3), 236-239. Zhang, Y.Y. and RS.R Wang (1996). A parallel thinning algorithm with two-subiteration that generates one-pixel-wide skeletons. Proc. 13th lnternat. Conf. on Pattern Recognition, Vienna, Austria.