Pattern Recognition Letters 11 (1990) 643-648 North-Holland
September 1990
On connectivity issues of ESPTA Jayanta MUKHERJEE,
P.P. D A S
Department of Computer Science and Engineering, Indian Institute of Technology, Kharagpur-721302, India
B.N. CHATTERJI Department of Electronics and Electrical Communication Engineering, Indian Institute of Technology, Kharagpur-721302, India Received 28 November 1989 Revised 7 May 1990
Abstract: In this paper we review the connectivity properties of our 3-D thinning algorithm ESPTA (Extended Safe Point Thinning Algorithm [2]) and its other versions. We present a modification of ESPTA, called MESPTA, which preserves the connectivity of the image while maintaining its 3-D shape. Key words: Thinning, SPTA, ESPTA, connectivity, neighbours.
I. Introduction Gong and Bertrand [1] have correctly pointed out a counterexample to our 3-D thinning algorithm E S P T A [2] to show that E S P T A may not preserve the connectivity of an 18-connected image. The purpose of this note is to elaborate the following: (1) To pin point the mistake in [2] and to suggest corrective measures to ensure the 18-connectivity preservation (though with considerable degradation in shape). (2) To suggest a modification M E S P T A of E S P T A which preserves the 26-connectivity of a 26-connected image and maintains the quality of a thinned shape as obtained from ESPTA. This can be used in place of ESPTA.
2. Preliminary modifications to ESPTA: ESPTA-
M1 and ESPTA-M2 As shown by the counterexample, E S P T A does not preserve the 18-connectivity. Hence the theorem
given in [2] does not stand• Actually it is assumed in the theorem that 8-connectivity has been ensured in all three orthogonal planes• But this assumption is not valid in E S P T A which checks 8-connectivity in only two orthogonal planes• It is however important to note that if really the SPTA conditions are guaranteed in all three orthogonal planes then the 3-D image will remain 18-connected. ESPTA, however, can be easily modified to ensure 18-connectivity. To guarantee 18-connectivity of a thinned output from E S P T A we need to ensure a safe-point test in all three orthogonal planes simultaneously. So in a modified version of ESPTA, called ESPTA-M1, we invoke only one pass in every iteration. In that single pass once we are at a dark boundary point p, we test the following safe-point condition: S = (?/0 + So)" (n2 + $2)" (?/4 + $4) • (?/6 + $6)" (/'/8 + S8f)" (08 + S8b)
where n o • n 2 • n 4 • n 6 • u 8 • 08 = false l i.e., p is some edge-point) and Si's are defined as in [2, p. 170].
0167-8655/90/$03.50 © 1990 - - Elsevier Science Publishers B.V. (North-Holland)
643
Volume 11, Number 9
PATTERN RECOGNITION LETTERS
Back
Mid
frame
frame
Front
frame
September 1990
here is simultaneously a left, bottom and front edge-point. It is a bottom ($6 = false) and front (Ssf = false) safe-point as well. But since it is unsafe acording to the left criterion ($4 = true), in E S P T A it is deleted. However, the modified version, ESPTA-M1 will retain this point as it is a bottom (front) safe-point. Now it is easy to see that the theorem in [2] holds with the modified S expression because 8-connectivity has been preserved in all three orthogonal planes. Hence, Theorem 1. ESPTA-M1 preserves the 18-connec-
* denotes
a dark
tivity o f an 18-connected image.
point
Figure 1. The counterexample given in [1].
S = false implies that p is safe, else p will be removed. So if p is an edge-point o f type, say left, and not an edge-point of any other type, we have n0=n2 = n6= u 8 = 08 -- true and S=$4 as in the previous algorithm. However, in cases where p is an edge-point simultaneously o f two types, say left and bottom, S becomes $4"$8b. So p will be marked safe when it is either a left safe-point or a b o t t o m safe-point or both. In our earlier version such cases were coded as S=S4+S8b and being non-safe by one type meant deletion. The above idea is best illustrated by the given counterexample (Figure 1). The point p in concern
(a)
It is worthwhile to note at this point that though the above modification can preserve the 18-connectivity, it forces less regular removal of boundary points compared to the 3-pass method of [2]. Hence the shape of the thinned output degrades heavily with simultaneous checking. We present a comparative picture of the thinned images in Figure 2 (output of ESPTA) and Figure 3 (output o f ESPTA-M1) for the images given in Figures 5(a) and 6(a) of [2, p. 171]. To improve the quality of the skeletal shape we appreciate that it is necessary to remove left/right, b o t t o m / t o p and front/back edge-points separately in three different scans as was done in [2]. Because of the simultaneous testing of all safe-conditions, the edge-points start getting removed in a hap-
(b)
Figure 2. The thinned output from ESPTA of figures shown in 5(a) and 6(a) of [2]. MESPTA also produces similar outputs for these figures of [2]. 644
Volume 11, Number 9
P A T T E R N R E C O G N I T I O N LETTERS
September 1990
(a)
(b) Figure 3. The thinned output from ESPTA-M1.
hazard fashion. SPTA, the core algorithm on which this 3-D version is based, being heavily sequential cannot tolerate the resultant abberations. And hence the degradation. Thus, in an attempt to achieve both the advantages of 3-pass iteration and 18-connectivity we propose a further improvement on E S P T A and call it ESPTA-M2. In ESPTA-M2, three passes are used, one for every opposite pair of edge-points, but before removal it is tested whether a current non-safepoint is a safe-point of some other type or not. The safe-point test in this case, say in the left/right pass and for a left edge-point, changes to
S 4 = S 4 • ( n 2 + $ 2 ) . (n6 + $6) • (Us +
Ssf)" (v8 + Ssb).
Note that it is not required here to test for rightsafety because a left-and-right edge-point is always left-safe. If it is safe by some other type, it is not deleted to ensure the 18-connectivity. On the other hand, since removal is again performed type by type in every iteration the quality o4 the thinned image is expected to improve. For the same two images mentioned above we show the results with this variation in Figure 4. It is immediate to see that the present results, though better than those obtained by ESPTA-M1
(a)
(b) Figure 4. The thinned output from ESPTA-M2. 645
Volume 11, Number 9
PATTERN RECOGNITION LETTERS
September 1990
(Figure 3), is not at all comparable with the outputs of the original E S P T A (Figure 2). So in an attempt to preserve both the connectivity of the image and the quality of its shape, we present a final modification of ESPTA, called M E S P T A (Modified ESPTA), in the following section.
Back
*
*
Mid
frame
frame
3. Modified Extended Safe Point Thinning Algorithm (MESPTA) Before going into the details of M E S P T A we need to analyse E S P T A in further depth. The counterexample (Figure 1) has already shown that E S P T A may 18-disconnect an 18-connected image. But still that image remains 26-connected. So the potential question is: Does E S P T A maintain the 26-connectivity of an 18-connected image? No, it does not. We prove it in the next theorem and the corollary. (Actually the theorem will also be used for MESPTA.)
Theorem 2. I f the neighbourhood of a dark boundary point p & 18-connected, then the deletion o f p by E S P T A will maintain the 26-connectivity of the neighbourhood. Proof. For the sake of the p r o o f assume that p is a left edge-point and $4 is true. So p will be deleted by ESPTA. Clearly p is not a left safepoint in the two orthogonal planes in which n 4 and p are common (see Figure 4 of [2]). So n o must be dark. Now, of the eighteen 18-neighbours of p, all the fourteen that lie in these two orthogonal planes must remain 18-connected because they are 8-connected in the planes to n 0. This is ensured by the truth o f $40) and S~2) [2, p. 170]. This leaves us with only four 18-neighbours of p, viz., u 2, 02, u6 and 06. If one or more of them are present, then in the absence of p, they remain 26-connected to n O•
Next consider the eight corner points of the 3 × 3 × 3 window, that is, points Ol, 03, 05, 07, ul, u3, u5 and u7. These are the 26-neighbours of p which are not 18-neighbours. In the absence of p n o remains 26-connected to four corner points Ol, Vv, Ul, u7 (if they at all exist). The other four corner points 03, 05, u3, us, if present, must have at 646
Front
* denotes
a dark
frame
point
Figure 5. An image which will get disconnected by ESPTA. Note that the neighbourhood is 26-connected but not 18-connected.
least one 18-neighbour since the neighbourhood is 18-connected. Hence the neighbourhood remains 26-connected even after the removal of p. [] Corollary 1. I f there exists a 26-neighbour o f p which is not 18-connected to p, then ESPTA may remove p to disconnect the neighbourhood (and hence the image).
Proof. Consider the image in Figure 5. p will be removed by ESPTA to disconnect the image. [] So when ESPTA is given an 18-connected image, at some iteration it may produce a pair of boundary points p and q which are only 26-connected (Theorem 2) and later p (or q) may be removed to disconnect the image (Corollary 1). In MESPTA, then, we need to evolve a strategy to stop the deletion of such p (or q) in the partially thinned image. For this purpose we need to introduce six oblique planes in the neighbourhood of p besides the three orthogonal planes. It may be noted that in the neighbourhood, the point p and one of its six-neighbours actually belong to two orthogonal planes and also two oblique planes containing the 26-neighbours (but not 18-neighbours) of p. These oblique planes are: (1) n3, 03, o8, 07, nT, u7, Us, u3; (2) nl, Vl, 08, 05, ns, u5, Us, ul; (3) n 4, 05, 06, 07, n0, Ul, U2, U3;
Volume 11, Number 9
PATTERN RECOGNITION LETTERS
(4) n4, u3, 02, 01, no, /27, b/6, ~/5; (5) /72, 03, 04, 05, /'/6, /27, Uo, /~/1;
(6)
n2, vl, Uo, 07, 176, u5, /-/4, U3"
Consider a left edge-point p (n4 = white). We observe that n4 and p belong to two orthogonal planes (as shown earlier) and also to two oblique planes (3) and (4). The left safe-point test, in this case, is carried out in all these four planes simultaneously. So, S 4 : 811, . S4(2) . 8413, . S~4)
September 1990
In other words, if there exists at least one 26-neighb o u t o f p which is not 18-connected to p, i.e., the n e i g h b o u r h o o d is only 26-connected. Hence C18 = (01 + 02+ 08+ 00+ no+n~ +n2) (03-1- 02+ 08+ u4 + n4 + n 3 + n 2) (05+ 06+ 08+ o4+//4+175+/'/6) (07+ 06+ t)8+
0o+17o+n6+1/7)
(ill + 122+/AS + U0 + 1/0 + 1/I + 1/2) (f13 + U2+ U8 + U4+ n4 + n3 + n2)
where
(f15 + u 6 + u8 + u 4 + n4 + n5 + n6)
SI 1) = no" (nl + n 2 + n6+n7) • (1/2 + n3)" (n6 + fls)
o r t h o g o n a l plane,
S4~2) = no" (Vo + u8 + Uo + us) • (v8 + 04)" (us + ~/4) o r t h o g o n a l plane,
• (vz + 03)" (u6 + ~/5) oblique plane (4), $4(4) = n o • (06 -l- 07 -t' b/1 Jr- /'/2) oblique plane (3).
Other Si's are defined analogously• N o w let us introduce a 18-neighbourhood criterion (a b o o l e a n value) Cl8 of p. Cj~ = true, = false,
if the n e i g h b o u r h o o d of p is 18-connected. otherwise.
(a)
Using C18, the safe-point test in M E S P T A for a left edge-point is defined as follows: S 4 = $4(1) . S(2). (C18 if-S~ 3) . S~4)).
$4(3) = 170" (01 q- 02 q-//6 q- td7)
• (v6 + 05)' (u2 + a3)
•037+u6+u8+uo+no+n6+177)-
T h a t is, the safe-point test is carried out in (two) o r t h o g o n a l planes only if the n e i g h b o u r h o o d is 18-connected, whereas it is p e r f o r m e d both in (two) o r t h o g o n a l as well as (two) oblique planes if the n e i g h b o u r h o o d is only 26-connected. Other safe-point tests are written in a similar form. It is encouraging to see that the results of M E S P T A are as good as the original E S P T A (Figure 2). In the next t h e o r e m we establish the connectivity issue o f M E S P T A .
(b)
Figure 6. The thinned output from MESPTA if the simplified strategy is used. 647
Volume 11, Number 9
PATTERN RECOGNITION LETTERS
Theorem 3. M E S P T A preserves the 26-connec-
tivity of a 26-connected image. Proof. Consider two cases for the p r o o f where p is a left edge-point being tested for deletion. Case 1: C18=true. In this case the neighbourhood is 18-connected and $4=$4(1). $4(2). Hence by E S P T A and T h e o r e m 2, if $4 is true then p is removed and yet the neighbourhood of p remains 26-connected. Case 2:C18 =false. In this case the neighbourhood is 26-connected and S 4 = $4(1). $4(2)- $4(3). $4(4). So the removal of p m a y seem to disconnect the neighbourhood by disconnecting one of its 26- (but not 18-) neighbours of p, i.e., Ol, 03, 05, 07, ul, u3, u5 and UT. Now if p is deleted then $4(3)= 8 4(4) : true. So no remains 8-connected to four corner points ol, 07, ul, u7 (if they at all exist) in the oblique plane. The other four corner points 03, 05, u 3, u 5, if present, must have at least one 18-neighbour, else p would have been marked safe in the corresponding oblique plane. Hence the image remains 26-connected even after the removal of p. [] A straightforward simplification of the above safe-point strategy, however, m a y be in view, like S 4 : $4(1) . 54(2) . S (3) . S4(4).
It is easy to see that this strategy is stronger from the point of view of deletion as compared to the strategy used in M E S P T A for S 4 : S 4 q - S (1). 84(2). C18.
Hence the connectivity will be ensured in this case
648
September 1990
too. But obviously the use of this strategy removes less points and generates a rather irregular thinned image (Figure 6).
4. Conclusions In this paper we have analysed E S P T A in depth to see why it disconnects a given 18-connected image. After a few elementary revisions of E S P T A (which degrades the quality of the output at the benefit of connectivity), we have formulated the Modified E S P T A (MESPTA). It preserves the 26-connectivity of the input image and produces the same quality of output as ESPTA. So we can now recommend M E S P T A in place of E S P T A to be used for 3-D thinning.
Acknowledgements We are grateful to Dr. W.X. Gong and Dr. G. Bertrand for pointing out the counterexample, to Dr. P.A. Devijver for bringing it to our notice and to the anonymous referee for the constructive comments on an earlier version of the paper.
References [1] Gong, W.X. and G. Bertrand (1990). A note on "Thinning of 3-D images using the Safe Point Thinning Algorithm (SPTA)". Pattern Recognition Letters 11, 499-500. [2] Mukherjee, J., P.P. Das and B.N. Chatterji (1989). Thinning of 3-D images using the Safe Point Thinning Algorithm (SPTA), Pattern Recognition Letters 10, 167-173.