Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Kong t., rosenfeld_a._-_topological_algorithms_for_digital_image_processing.(nh,_1996)(293s)

82

Published on

Kong t., rosenfeld_a._-_topological_algorithms_for_digital_image_processing.(nh,_1996)(293s) …

Kong t., rosenfeld_a._-_topological_algorithms_for_digital_image_processing.(nh,_1996)(293s)
gonzalo santiago martinez

Published in: Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
82
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
0
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. PREFACE Objects in three dimensions, and their two-dimensional images, are approximated dig- itally by sets of voxels ("volume elements") or pixels ("picture elements"), respectively. Digital geometry is the study of geometric properties of digitized objects (or digitized images of objects); it deals both with the definitions of such properties and with algo- rithms for their computation. In particular, digital topology deals with properties of a "topological" nature (particularly, properties that involve the concepts of connectedness or adjacency, but do not depend on size or shape), and with algorithms that compute or preserve such properties. Topological properties and algorithms play a fundamental role in the analysis of two- and three-dimensional digital images. This book deals with basic topological algorithms; it presents their underlying theory and also discusses their applications. An object is always understood to be (arcwise) connected, and the same is therefore true for images of the object obtained from any viewpoint. Thus if a three- (or two-) dimensional digital image can be segmented into "object" and "background" voxels (or pixels), the connected components of the object voxels or pixels are the individual objects (or their images). Connected component labeling is the process of assigning a distinct label to the voxels (pixels) that belong to each distinct object. The first chapter, by Shapiro, defines the problem of connected component labeling and gives sequential and parallel solutions, including efficient sequential algorithms (due to Lumia et al.) for labeling connected components in both two- and three-dimensional digital images. An algorithm for constructing the graph representing the pairwise adjacencies of the components is also presented. An appendix to this chapter, coauthored by the editors, provides a simple proof of the correctness of Lumia's algorithms. The second chapter, coauthored by Hall and the editors, discusses shrinking algorithms, which reduce the sizes of the components in an image. Shrinking to a topological equivalent reduces the number of object pixels while preserving the topology of the image (i.e., not changing the connectivity properties of the objects or the background). In shrinking to a residue, holes in objects are not preserved, but each object is shrunk to a single isolated pixel (called a residue) which may then be deleted. The chapter discusses parallel algorithms for both kinds of shrinking, but focuses on shrinking to a residue. Many important classes of two-dimensional "objects" are composed mostly or entirely of elongated parts; for example, alphanumeric characters are composed of strokes. The representation of such an object by a set of pixels can be simplified by a process known as thinning, which reduces the elongated parts to one-pixel-thick arcs or closed curves, without changing the connectivity properties of the object or of its background. (Note that elongatedness is not a topological property, but thinning is a topology-preserving process.) The result of thinning a two-dimensional object is usually called the skeleton of the object. The third chapter, by Arcelli and Sanniti di Baja, reviews a variety of skeletonization methods, with emphasis on the adequacy with which the branches (constituent arcs or curves) of a skeleton represent the elongated parts of the original object. It is easy to insure that a skeletonization process preserves topology if the process is sequential (e.g., it deletes pixels from an object one at a time), but more difficult if the process is highly parallel; the fourth chapter, by Hall, discusses parallel thinning algorithms and methods of proving that they preserve topology. Neither of these chapters treats thinning of three-
• 2. dimensional objects, which is a more complicated subject; note that three-dimensional objects can have two kinds of elongated parts, "stick-like" (which can be thinned to arcs or curves) and "plate-like" (which can be thinned to one-voxel-thick "sheets"). The use of thin ("sheet-like") connected sets of voxels to represent surfaces in three- dimensional Euclidean space, such as planes and spheres, is considered in the fifth chapter, by Cohen-Or, Kaufman and Kong. They state precise conditions (some of which are due to Morgenthaler and Rosenfeld) under which a set of voxels might be regarded as an adequate representation of a mathematically defined surface, such as a plane specified by an equation. Assuming that voxels are defined as unit cubes, surfaces can also be represented by sets of voxel faces (rather than by sets of voxels). This representation is quite natural for surfaces that arise as boundaries of three-dimensional objects, and is readily generalized to boundaries of n-dimensional "hyperobjects". The sixth chapter, by Udupa, describes algorithms for extracting, labeling, and tracking boundaries represented in this way, in any number of dimensions. The seventh chapter, by Herman, develops a general theory of boundaries in abstract digital spaces, and shows that basic properties of connectedness and separatedness of the interiors and exteriors of boundaries can be established in this general framework. Fundamental soundness properties of algorithms such as those described in Udupa's chapter can be deduced from special cases of results in Herman's chapter. Because of the wide variety of topics treated in the seven chapters, we have not at- tempted to standardize the notation and terminology used by their authors. However, each chapter is self-contained and can be read independently of the others. Some of the basic terminology and fundamental concepts of digital topology are reviewed in the appendix, which also briefly describes important areas of the field and provides a bibliog- raphy of over 360 references. The notations and terminologies used in this book will serve to introduce its readers to the even wider variety that exists in the voluminous literature dealing with topological algorithms. T. Yung Kong Queens, New York Azriel Rosenfeld College Park, Maryland
• 4. label, calculating properties of each region, calculating the spatial relationships among the regions, and applying a decision procedure to classify regions or sets of regions of interest. In both the binary case and the more general case, the analysis begins with an operation called connected component labeling that groups adjacent image pixels that have the same label into regions. In the general case, many different relationships among the regions can be calculated. The most common relationship is spatial adjacency, which can be represented by a graph structure called a region adjacency graph. This chapter describes the algorithms required to perform connected component labeling and to construct the region adjacency graph. 2. C O N N E C T E D C O M P O N E N T L A B E L I N G Let us call the foreground pixels of a binary image the black pixels and the background pixels the white pixels. Connected component analysis consists of connected component labeling of the black pixels followed by property measurement of the component regions and decision making. The connected component labeling operation changes the unit of analysis from pixel to region or segment. All black pixels that are connected to each other by a path of black pixels are given the same identifying label. The label is a unique name or index of the region to which the pixels belong. A region has shape and position properties, statistical properties of the gray levels of the pixels in the region, and spatial relationships to other regions. 2.1. S T A T E M E N T OF T H E P R O B L E M Once a gray level image has been thresholded to produce a binary image, a connected component labeling operator can be employed to group the black pixels into maximal connected regions. These regions are called the (connected) components of the binary image, and the associated operator is called the connected components operator. Its input is a binary image and its output is a symbolic image in which the label assigned to each pixel is an integer uniquely identifying the connected component to which that pixel belongs. Figure 1 illustrates the connected components operator as applied to the black pixels of a binary image. Two black pixels p and q belong to the same connected component C if there is a sequence of black pixels (pcPi, • • • ,Pn) of C where po = p, Pn = q^ and pi is a neighbor of Pi-i (see Figure 2) for z = 1 , . . . , n. Thus the definition of a connected component depends on the definition of neighbor. When only the north, south, east, and west neighbors of a pixel are considered to be in its neighborhood, then the resulting regions are called 4-connected. When the north, south, east, west, northeast, northwest, southeast, and southwest neighbors of a pixel are considered to be in its neighborhood, the resulting regions are called 8-connected. Whichever definition is used, the neighbors of a pixel are said to be adjacent to that pixel. The border of a connected component of black pixels is the subset of pixels belonging to the component that are adjacent to white pixels (by whichever definition of adjacency is being used for the black pixels). Rosenfeld (1970) has shown that if C is a component of black pixels and D is an adjacent component of white pixels, and if 4-connectedness is used for black pixels and
• 5. 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 1 (a) 1 1 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 3 3 3 1 1 1 0 0 3 3 0 0 0 0 0 3 3 (b) 2 2 2 2 0 3 0 0 0 0 2 0 3 0 0 2 2 2 0 0 0 Figure 1. Application of the connected components operator to a binary image; (b) Symbolic image produced from (a) by the connected components operator. • • • • • • • • (a) (b) Figure 2. (a) Pixels, •, that are 4-neighbors of the center pixel x; (b) pixels, •, that are 8-neighbors of the center pixel x. 8-connectedness is used for white pixels, then either C surrounds D (D is a hole in C) or D surrounds C (C is a hole in D). This is also true when 8-connectedness is used for black pixels and 4-connectedness for white pixels, but not when 4-connectedness is used for both black pixels and white pixels and not when 8-connectedness is used for both black pixels and white pixels. Figure 3 illustrates this phenomenon. The surroundedness property is desirable because it allows borders to be treated as closed curves. Because of this, it is common to use one type of connectedness for black pixels and the other for white pixels . The connected components operator is widely used in industrial applications where an image often consists of a small number of objects against a contrasting background; see Section 4 for examples. The speed of the algorithm that performs the connected components operation is often critical to the feasibility of the application. In the next three sections we discuss several algorithms that label connected components using two sequential passes over the image. All the algorithms process a row of the image at a time. Modifications to process a rectangular window subimage at a time are straightforward. All the algorithms assign new labels to the first pixel of each component and attempt to propagate the label of a black pixel to its black neighbors to the right or below it (we assume 4-adjacency with a left-to-right, top-to-bottom scan order). Consider the image shown in Figure 4. In the first row, two black pixels separated by three white pixels are encountered. The first is
• 6. 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 (a) 0 0 1 0 0 0 0 0 0 0 a a a a a a a 2 a a a 1 b 4 a a a 3 a a a a a a a (b) a a a a a a a 1 a a a 1 a 1 a a a 1 a a a a a a a a a a a a a a 1 a a a 1 b 1 a a a 1 a a a a a a a (c) (d) Figure 3. Phenomena associated with using 4- and 8-adjacency in connected component analyses. Numeric labels are used for components of black pixels and letter labels for white pixels, (a) Binary image; (b) connected component labeling with 4-adjacency used for both white and black pixels; (c) connected component labeling with 8-adjacency used for both white and black pixels; and (d) connected component labeling with 8-adjacency used for black pixels and 4-adjacency used for white pixels. assigned label 1; the second is assigned label 2. In row 2 the first black pixel is assigned label 1 because it is a 4-neighbor of the already-labeled pixel above it. The second black pixel of row 2 is also assigned label 1 because it is a 4-neighbor of the already-labeled pixel on its left. This process continues until the black pixel marked A in row 4 is encountered. Pixel A has a pixel labeled 2 above it and a pixel labeled 1 on its left, so that it connects regions 1 and 2. Thus all the pixels labeled 1 and all the pixels labeled 2 really belong to the same component; in other words, labels 1 and 2 are equivalent. The differences among the algorithms are of three types, as reflected in the following questions. 1. What label should be assigned to pixel A? 2. How does the algorithm keep track of the equivalence of two (or more) labels? 3. How does the algorithm use the equivalence information to complete the processing? 2.2. THE CLASSICAL ALGORITHM The classical algorithm, deemed so because it is based on the classical connected compo- nents algorithm for graphs, was described in Rosenfeld and Pfaltz (1966). This algorithm makes only two passes through the image but requires a large global table for recording equivalences. The first pass performs label propagation, as described above. Whenever a situation arises in which two different labels can propagate to the same pixel, the smaller
• 7. 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 2 2 2 A (a) (b) Figure 4. Propagation process. Label 1 has been propagated from the left to reach point A. Label 2 has been propagated down to reach point A. The connected components algorithm must assign a label to A and make labels 1 and 2 equivalent. Part (a) shows the original binary image, and (b) the partially processed image. label propagates and each such equivalence found is entered in an equivalence table. Each entry in the equivalence table consists of an ordered pair, the values of its components being the labels found to be equivalent. After the first pass, the equivalence classes are found by taking the transitive closure of the set of equivalences recorded in the equiva- lence table. Each equivalence class is assigned a unique label, usually the minimum (or oldest) label in the class. Finally, a second pass through the image performs a translation, assigning to each pixel the label of the equivalence class of its pass-1 label. This process is illustrated in Figure 5, and an implementation of the algorithm is given below. procedure CLASSICAL "Initiahze global equivalence table." EQTABLE := CREATE( ); "Top-down pass 1" for L := 1 to NROWS do "Initiahze aU labels on row L to zero." for P := 1 to NCOLS do LABEL(L,P) := 0 end for; "Process the row." for P := 1 to NCOLS do if I(L,P) = 1 then begin A := NEIGHBORS({L,P)); if ISEMPTY(A) then M := NEWLABEL( ) else begin M := MIN(LABELS(A)); for X in LABELS(A) and X <> M do ADD(X, M, EQTABLE) end for; end
• 8. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (a) 10 12 12 12 12 12 12 12 10 12 12 7 7 7 7 7 7 12 7 12 3 7 12 3 8 8 8 8 8 7 13 12 3 8 8 8 8 8 7 13 12 3 3 7 13 12 2 2 2 3 3 2 9 9 9 9 9 7 13 12 2 2 2 2 2 2 5 5 7 13 12 2 2 2 2 13 12 2 2 11 13 12 2 4 4 2 6 6 11 11 13 12 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 12 2 2 2 2 12 12 12 12 1 12 1 12 1 12 (b) Figure 5. Classical connected component labeling algorithm: Part (a) shows the initial binary image, and (b) the labeling after the first top down pass of the algorithm. The equivalence classes found are 1: { 1,12,7,8,9,10,5 } and 2: { 2,3,4,6,11,13 }.
• 9. LABEL(L,P) := M; end for end for; "Find equivalence classes." EQCLASSES := RESOLVE(EQTABLE); for E in EQCLASSES do EQLABEL(E) := MIN(LABELS(E)) end for; "Top-down pass 2" for L := 1 to NROWS do for P := 1 to NCOLS do if I(L,P) = 1 then LABEL(L,P) := EQLABEL(CLASS(LABEL(L,P))) end for end for end CLASSICAL The notation NEIGHBORS((L,P)) refers to the already-encountered 1-valued neighbors of pixel (L,P). The algorithm referred to as RESOLVE is simply the algorithm for finding the connected components of the graph defined by the set of equivalences (EQTABLE) defined in pass 1. The nodes of the graph are region labels, and the edges are pairs of labels that have been found to be equivalent. The procedure, which uses a standard depth-first search algorithm, can be stated as follows: procedure RESOLVE(EQTABLE); list_of_components := nil; for each node N in EQTABLE if N is unmarked then begin current-component := DFS(N,EQTABLE); add_to_list(Ust-of_components,current-component) end end for; return LIST_OF_COMPONENTS end RESOLVE In this procedure, Ust-of-components is a list that will contain the final resultant equiv- alence classes. The function DFS performs a depth-first search of the graph beginning at the given node N and returns a list of all the nodes it has visited in the process. It also marks each node as it is visited. A standard depth-first search algorithm is given in Horowitz and Sahni (1982) and in most other data structures texts. In procedure CLASSICAL, determination of the smallest equivalents of the labels in- volves examining the labels in each equivalence class after all the equivalence classes have been explicitly constructed. However, the smallest equivalent labels can be found a little more efficiently by using the fact that if the labels in EQTABLE are processed in ascend- ing order, then N is the smallest equivalent of each label visited by DFS(N,EQTABLE).
• 10. The complexity of the classical algorithm for an n x n image is 0{n'^) for the two passes through the image, plus the complexity of RESOLVE which depends on the number of equivalent pairs in EQTABLE. The main problem with the classical algorithm is the global table. For large images with many regions, the table can become very large. On some machines there is not enough memory to hold the table. On other machines that use paging, the table gets paged in and out of memory frequently. For example, on a VAX 11/780 system with 8 megabytes of memory, the classical algorithm ran (including I/O) in 8.4 seconds with 1791 page faults on one 6000 pixel image, but took 5021 seconds with 23,674 page faults on one 920,000-pixel image. This motivates algorithms that avoid the use of the large global equivalence table for computers employing virtual memory. 2.3. T H E L O C A L T A B L E M E T H O D : A SPACE E F F I C I E N T T W O - P A S S A L G O R I T H M One solution to the space problem is the use of a small local equivalence table that stores only the equivalences detected from the current row of the image and the row that precedes it. Thus the maximum number of equivalences is the number of pixels per row. These equivalences are then resolved, and the pixels are relabeled in a second scan of the row; the new labels are then propagated to the next row. In this case not all the equivalencing is completed by the end of the first (top-down) pass, and a second pass is required for both finding the remainder of the equivalences and assigning the final labels. The algorithm is illustrated in Figure 6. Note that the second pass is bottom-up. We will give the general algorithm (Lumia, Shapiro, and Zuniga, 1983) and then describe, in more detail, an efficient run-length implementation. procedure LOCAL_TABLE_METHOD "Top-down pass" for L:=l to NROWS do "Initialize local equivalence table for row L." EQTABLE := CREATE( ); "Initialize all labels on row L to zero." for P := 1 to NCOLS do LABEL(L,P) := 0 end for; "Process the row." for P := 1 to NCOLS do if I(L,P) = 1 then begin A := NEIGHBORS((L,P)); if ISEMPTY(A) then M := NEWLABEL( ) else begin M := MIN(LABELS(A) ); for X in LABELS(A) and X <> M do ADD (X,M, EQTABLE) end for end
• 11. 7 5 5 5 5 5 5 1 7 5 1 7 7 7 7 7 5 1 5 1 •2 5 1 2 8 8 8 8 8 5 2 1 2 8 8 8 8 8 5 2 1 2 2 2 2 5 2 1 2 2 2 2 2 2 5 5 5 5 5 5 2 1 2 2 2 2 2 2 5 5 5 2 1 2 2 2 1 2 2 2 2 1 2 4 4 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 Figure 6. Results after the top-down pass of the local table method on the binary image of Figure 5. Note that on the rows where equivalences were detected, the pixels have different labels from those they had after pass 1 of the classical algorithm. For example, on row 5 the four leading 3s were changed to 2s on the second scan of that row, after the equivalence of labels 2 and 3 was detected. The bottom up pass will now propagate the label 1 to all pixels of the single connected component. LABEL(L,P) := M; end end for; "Find equivalence classes detected on this row." EQCLASSES := RESOLVE(EQTABLE); for E in EQCLASSES do EQLABEL(E) := MIN(LABELS(E)) end for; "Relabel the parts of row L with their equivalence class labels." for P := 1 to NCOLS do if I(L,P) = 1 then LABEL(L,P) := EQLABEL(CLASS(LABEL(L,P))) end for end for; "Bottom-up pass" for L := NROWS-1 to 1 by - 1 do "Initiahze local equivalence table for row L." EQTABLE := CREATE( ); "Process the row." for P := 1 to NCOLS do
• 12. 10 if LABEL(L,P) <>0 then begin LA := LABELS(NEIGHBORS(L,P)); for X in LA and X <> LABEL(L,P) ADD (X,LABEL(L,P), EQTABLE) end for end end for "Find equivalence classes." EQCLASSES := RESOLVE(EQTABLE); for E in EQCLASSES do EQLABEL(E) := MIN(LABELS(E)) end for "Relabel the pixels of row L one last time." for P := 1 to NCOLS do if LABEL(L,P) <> 0 then LABEL(L,P) := EQLABEL(CLASS(LABEL(L,P))) end for end for end LOCAL_TABLE_METHOD Note that the set NEIGHBORS((L,P)) of already-processed 1-valued neighbors of pixel (L,P) is different in the top-down and bottom-up passes. The complexity of the local table method for an n x n image is also O(n^) -f n times the complexity of RESOLVE for one row of equivalences. However, in comparison with the classical algorithm, the local table method took 8.8 seconds with 1763 page faults on the 6000-pixel image, but only 627 seconds with 15,391 page faults on the 920,000-pixel image, which is 8 times faster. For an even larger 5,120,000-pixel image, the local table method ran 31 times faster than the classical method. 2.4. A N E F F I C I E N T R U N L E N G T H I M P L E M E N T A T I O N OF T H E LOCAL T A B L E M E T H O D In many industrial applications the image used is from a television camera and thus is roughly 512 x 512 pixels, or 256K, in size. On an image half this size, the local table method as implemented on the VAX 11/780 took 116 seconds to execute, including I/O time. But industrial applications often require times of less than one second. To achieve this kind of efficiency, the algorithm can be implemented on a machine with some special hardware capabilities. The hardware is used to rapidly extract a run-length encoding of the image, and the software implementation can then work on the more compact run- length data. Ronse and Devijver (1984) advocate this approach. A run-length encoding of a binary image is a list of contiguous (typically, horizontal) runs of black pixels. For each run, the location of the starting pixel of the run and either its length or the location of its ending pixel must be recorded. Figure 7 shows the run- length data structure used in our implementation. Each run in the image is encoded by the locations of its starting and ending pixels. (ROW, START_COL) is the location of the starting pixel and (ROW, END_COL) is the location of the ending pixel. PERM_LABEL
• 13. 11 is the field in which the label of the connected component to which this run belongs will be stored. It is initialized to zero and assigned temporary values in pass 1 of the algorithm. At the end of pass 2, PERMXABEL contains the final, permanent label of the run. This structure can then be used to output the labels back to the corresponding pixels of the output image. 1 1 1 1 1 1 1 1 1 (a) 1 1 1 1 1 1 1 2 3 4 5 ROW-START 1 3 5 0 7 ROW-END 2 4 6 0 7 (b) 1 2 3 4 5 6 7 ROW 1 1 2 2 3 3 5 START-COL 1 4 1 5 1 5 2 END-COL 2 5 2 5 3 5 5 PERM-LABEL 0 0 0 0 0 0 0 (c) Figure 7. Binary image (a) and its run-length encoding (b) and (c). Each run of black pixels is encoded by its row (ROW) and the columns of its starting and ending pixels (START-COL and END.COL). In addition, for each row of the image, ROW-START points to the first run of the row and ROW_END points to the last run of the row. The PERM-LABEL field will hold the component label of the run; it is initialized to zero. Consider a run P of black pixels. During pass 1, when P has not yet been fully pro- cessed, PERMXABEL(P) will be zero. After P has been processed and found to be adjacent to some other run Q on the previous row, it will be assigned the current label of Q, PERM-LABEL(Q). If it is found to be adjacent to other runs Qi, Q2, • • •, QA' also on the previous row, then the equivalence of PERM-LABEL(Q), PERM-LABEL(Qi), PERMXABEL(Q2),..., PERM-LABEL(QK) must be recorded. The data structures used for recording the equivalences are shown in Figure 8. The use of simple linked lists to store equivalences makes the assumption that there will be very few elements in an equivalence class that is based on only two rows of the image. For storing, accessing, and
• 14. 12 dynamically updating large equivalence classes, the union-find algorithm (Tarjan, 1975) may be preferable. 1 2 3 Previous row Current row 1 2 3 4 ROW 1 1 1 2 START_C0L 4 20 30 7 END_COL 10 24 38 35 PERM_LABEL 1 2 3 1 ^ 1 2 3 LABEL 1 1 1 NEXT 3 3 0 ^—' 1 EQ_CLASS 1 Figure 8. Data structures used for keeping track of equivalence classes. In this example, run 4 has PERMXABEL 1; this is an index into the LABEL array that gives the equiva- lence class label for each possible PERM_LABEL value. In the example, PERM-LABELS 1, 2, and 3 have all been determined to be equivalent, so LABEL(l), LABEL(2), and LA- BEL(3) all contain the equivalence class label, which is 1. Furthermore, the equivalence class label is an index into the EQ-CLASS array that contains pointers to the begin- nings of the equivalence classes; these are linked lists in the LABEL/NEXT structure. In this example, there is only one equivalence class, class 1, and three elements of the LABEL/NEXT array are linked together to form this class. In our algorithm, PERM_LABEL(P), for a given run P, may be zero or nonzero. If it is nonzero, then LABEL(PERM_LABEL(P)) may be zero or nonzero. If it is zero, then PERM_LABEL(P) is the current label of the run and there is no equivalence class. If it is non-zero, then there is an equivalence class and the value of LABEL(PERM_LABEL(P)) is the label assigned to that class. All the labels that have been merged to form this class will have the same class label; that is, if run P and run P' are in the same class, we should have LABEL(PERM.LABEL(P)) = LABEL(PERM_LABEL(P')). When such an equivalence is determined, if each run was already a member of a class and the two classes were different, the two classes are merged. This is accomplished by linking together each prior label belonging to a single class into a linked list pointed to by EQ-CLASS(L) for class label L and linked together using the NEXT field of the LABEL/NEXT structure. To merge two classes, the last cell of one is made to point to the first cell of the other, and the LABEL field of each cell of the second class is changed to reflect the new label of the class. In this implementation the minimum label does not always become the label of the equivalence class. Instead, a single-member class is always merged into and assigned the label of a multimember class. This allows the algorithm to avoid traversing the linked list
• 15. 13 of the larger class to change all its labels when only one element is being added. When both classes are single-member or both are multimember the label of the first class is selected as the equivalence class field. The equivalencing procedure, MAKE_EQUIVALENT, is given below. procedure MAKE_EQUIVALENT (II, 12); "II is the value of PERM_LABEL(R1) and 12 is the value of PERM_LABEL(R2) for two different runs Rl and R2. They have been detected to be equivalent. The purpose of this routine is to make them equivalent in the data structures." case LABEL(Il) = 0 and LABEL(I2) = 0: "Both classes have only one member. Create a new class with II as the label." begin LABEL(Il) := II; LABEL(I2) := II; NEXT(Il) := 12; NEXT(I2) := 0; EQ_CLASS(I1) := II end; LABEL(Il) = LABEL(I2): "Both labels already belong to the same class." return; LABEL(Il) <> 0 and LABEL(I2) = 0: "There is more than one member in the class with label II, but only one in the class with label 12. So add the smaller class to the larger." begin BEGINNING := LABEL(Il); LABEL(I2) := BEGINNING; NEXT(I2) := EQ_CLASS(BEGINNING); EQ_CLASS(BEGINNING) := 12 end; LABEL(Il) = 0 and LABEL(I2) <> 0: "There is more than one member in the class with label 12, but only one in the class with label II. Add the smaller class to the larger." begin BEGINNING := LABEL(I2); LABEL(Il) := BEGINNING; NEXT(Il) := EQ_CLASS(BEGINNING); EQ_CLASS(BEGINNING) := II end; LABEL (II) <> 0 and LABEL (12) <> 0: "Both classes are multimember. Merge them by Unking the first onto the end of the second, and assig|n label II." begin BEGINNING := LABEL(I2);
• 16. 14 MEMBER := EQ_CLASS(BEGINNING); EQ-LABEL := LABEL(Il); while NEXT(MEMBER) <> 0 do LABEL(MEMBER) := EQ_LABEL; MEMBER := NEXT(MEMBER) end while; LABEL(MEMBER) := EQ_LABEL; NEXT(MEMBER) := EQ_CLASS(EQ_LABEL); EQ_CLASS(EQ_LABEL) := EQ_CLASS(BEGINNING); EQ_CLASS(BEGINNING) := 0 end end case; end MAKE_EQUIVALENT Using this procedure and a utility procedure, INITIALIZE_EQUIV, which reinitializes the equivalence table for the processing of a new line, the run length implementation is as follows: procedure RUNJLENGTHJMPLEMENTATION "Initialize PERM-LABEL array." for R := 1 to NRUNS do PERM_LABEL(R) := 0 end for; "Top-down pass" for L := 1 to NROWS do P := ROW_START(L); PLAST := ROW_END(L); if L = 1 then begin Q := 0; QLAST := 0 end else begin Q := R0W_START(L-1); QLAST := R0W_END(L-1) end; if P <> 0 and Q <> 0 then begin INITIALIZE_EQUIV( ); "SCAN 1" "Either a given run is connected to a run on the previous row or it is not. If it is, assign it the label of the first run to which it is connected. For each subsequent run of the previous row to which it is connected and whose label is different from its own, equivalence its label with that run's label." while P< PLAST and Q < QLAST do "Check whether runs P and Q overlap." case ENDXOL(P) < START_COL(Q): "Current run ends before start of run on previous row" P := P +1; END_COL(Q) < START_COL(P): "Current run begins after end of run on previous row."
• 17. 15 Q:=Q + i; else : "There is some overlap between run P and run Q." begin PLABEL := PERM_LABEL(P); case PLABEL = 0: "There is no permanent label yet; assign Q's label." PERMXABEL(P) := PERM_LABEL(Q); PLABEL <> 0 and PERM_LABEL(Q) <> PLABEL; "There is a permanent label that is different from the label of run Q; make them equivalent." MAKE_EQUIVALENT(PLABEL, PERM_LABEL(Q)); end case; "Increment P or Q or both as necessary." case END_COL(P) > END_COL(Q): Q := Q+1; END_COL(Q) > END_COL(P); P := P + 1; END_COL(Q) = END_COL(P): begin Q := Q+1; P := P+1 end; end case end end case end while; P := ROW_START(L); end "SCAN 2" "Make a second scan through the runs of the current row. Assign new labels to isolated runs and the labels of their equivalence classes to all the rest." if P <> 0 then while P < PLAST do begin PLABEL := PERM_LABEL(P); case PLABEL = 0: "No permanent label exists yet, so assign one." PERM_LABEL(P) := NEWXABEL( ); PLABEL <> 0 and LABEL(PLABEL) <> 0: "P has permanent label and equivalence class; assign the equivalence class label." PERM_LABEL(P):=LABEL(PLABEL); end case; P := P + 1 end end while
• 18. 16 end for "Bottom-up pass" for L := NROWS-1 to 1 by -1 do P := ROW_START(L); PLAST := ROW-END(L); Q := R0WJSTART(L+1); QLAST := R0W-END(L+1); if P <> 0 and Q <> 0 then begin INITIALIZE-EQUIV( ); "SCAN 1" while P < PLAST and Q < QLAST do case END-COL(P) < START_COL(Q): P := P+1; END_COL(Q) < START_COL(P): Q := Q+1 else : "There is some overlap; if the two adjacent runs have different labels, then assign Q's label to run P." begin if PERM_LABEL(P) <> PERM_LABEL(Q) then begin LABEL(PERM_LABEL(P)) := PERM-LABEL(Q); PERM_LABEL(P) := PERM_LABEL(Q) end; "Increment P or Q or both as necessary." case END_COL(P) > END_COL(Q): Q := Q + 1 END-COL(Q) > END_COL(P): P := P+1 END_COL(Q) = END-COL(P): begin Q := Q+1; P := P+1 end end case; end end case end while "SCAN 2" P := ROW_START(L); while P < PLAST do "Replace P's label by its class label." if LABEL(PERM_LABEL(P)) <> 0 then PERMXABEL(P) := LABEL(PERM_LABEL(P)); end while end end RUN_LENGTHJMPLEMENTATION
• 19. 17 There is another significant difference between procedure RUN_LENGTH_ IMPLE- MENTATION and procedure LOCAL_TABLE_METHOD, in addition to their use of different data structures. Procedure LOCAL_TABLE_METHOD computes equiv- alence classes using RESOLVE both in the top-down pass and in the bottom-up pass. Procedure RUNXENGTHJMPLEMENTATION updates equivalence classes in the top-down pass using MAKEJEQUIVALENT, but in the bottom-up pass it only propagates and replaces labels. This gives correct results not only in procedure RUNXENGTHJMPLEMENTATION but also in procedure LOCAL_TABLEJV[ETHOD. (This was proved in Lumia, Shapiro, and Zuniga, 1983.) 2.5. A 3 D C O N N E C T E D C O M P O N E N T S A L G O R I T H M The images handled by our algorithms so far are two-dimensional images. Both the definition of connected components and the algorithms can be generahzed to three- dimensional images, which are sequences of two-dimensional images called layers. The generalization of the definition results straightforwardly from the generalization of the concept of a neighborhood. Suppose that a 3D image consists of NROWS rows by NCOLS columns by NLAYERS layers. Then the neighborhood of a voxel (in 3D we use this term instead of "pixel") consists of voxels from neighboring rows, neighboring columns, and neighboring layers. Kong and Rosenfeld (1989) define three standard kinds of 3D neigh- borhoods: the 6-neighborhood, the 18-neighborhood, and the 26-neighborhood. These are illustrated in Figure 9. Using these 3D neighborhoods, the definition of a 3D con- nected component is identical to the definition of a 2D connected component. That is, two black voxels p and q belong to the same connected component C if there is a sequence of black voxels (po,Pi5 • • • iPn) oi C where po = P^ Pn = ^, and pi is a neighbor of pi-i for i — 1,... ,n. z / A / ~/ Z p V- / v A 7 tPiru mkHm Mj (a) (b) (c) Figure 9. (a) Voxels, •, that are 6-neighbors of voxel p; (b) voxels •, that are 18-neighbors of voxel p; (c) voxels, •, that are 26-neighbors voxel p. The local table method of computing connected components was generalized to 3D by Lumia (1983). The 3D algorithm can be summarized as follows:
• 20. 18 1. Label the 2D connected components in each layer in such a way that different labels are used in different layers. 2. Propagate the label equivalences from the first to the last layer, using the same basic process as in the two-dimensional local table algorithm, except that the propagation is now between the layers rather than between the rows. Repeat this process going from the last layer to the first layer. Figure 10 illustrates the 3D connected components algorithm on a simple 3-layer image. If the local table method is used in each layer, its complexity for an n x n x n image is O(n^) + (n^ times the complexity of RESOLVE for each row) -f (n times the complexity of RESOLVE for each layer). 2.6. P A R A L L E L C O N N E C T E D C O M P O N E N T S A L G O R I T H M S The use of parallel architectures can speed up the execution of most image processing algorithms. For example, a simple point or neighborhood operation performed on a SIMD (Single Instruction Multiple Data) architecture with one processor per pixel (or voxel) can be completed in a constant amount of time on an image of any size. The connected components operator cannot be executed in the same way, because it has to propagate labels over entire components whose sizes are arbitrary. Different parallel architectures lead to different algorithms. Danielsson and Tanimoto (1983) described and analyzed a number of different algorithms for different architectures. The most common algorithm is parallel propagation on a SIMD machine. The idea of the algorithm is to start with a set of seed pixels, at least one per region of interest. Each seed pixel gets a unique label. At each iteration of the algorithm, the label of a pixel is propagated to its neighbors, using some suitable method for resolving conflicts as in the sequential algorithms. When there is no further change to the image at some iteration, the process is complete. A simple example of this procedure is an algorithm that begins by assigning a unique label to each pixel of the image and then, at each iteration, replaces the value of a pixel by the minimum of the values of itself and its neighbors. Manohar and Ramapriyan (1989) present other, more advanced algorithms. If there is one processor for each pixel of the image, the complexity of the parallel propagation algorithm is 0 ( D ) , where D is the number of iterations needed to propagate a label from each pixel to every other pixel in the same component. Each iteration takes a constant amount of time, since it involves a neighborhood of constant size. When the components are convex we have D < n ior an n x n image. If the components can be nonconvex, D can be O(n^). If the machine has only mxm processors, m <Cn, the image can be divided into n^/m^ windows, each of size mxm, and the parallel algorithm can be applied to each window; equivalences must also be propagated between adjacent windows. This approach can be used either on a SIMD machine or on a distributed multiprocessor machine. Danielsson and Tanimoto showed that using a pyramid architecture can speed up par- allel algorithms, and presented a components algorithm for a SIMD pyramid machine. In such a machine, the base is an array of 2^ x 2^ nodes; the first (bottommost) level above the base has one node (the parent) for each square block of four nodes in the base; the second level above the base has one node for each square block of four nodes in the first
• 21. 19 1 1 Layer 1 1 1 1 1 1 L 1 1 Layer 2 1 1 1 1 1 Layer 3 1 1 1 1 1 1 1 a) Input binary 3-layer image 6 5 6 6 5 6 6 5 4 3 4 4 3 4 2 2 2 2 2 2 1 1 b) Image labels after the two-dimensional connected components algorithm has been run on each layer separately, using labels that decrease from layer 1 to layer 3. 6 5 6 6 5 6 6 5 6 5 6 6 6 5 6 6 6 6 6 6 1 1 c) Image labels after the top-down pass of the three-dimensional part of the al- gorithm 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 1 1 d) Image labels after the bottom-up pass of the three-dimensional part of the algorithm. These are the final component labels. Figure 10. Illustration of the Lumia 3D connected components algorithm.
• 23. 21 D D 1 (a) D 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (b) D 0 1 2 3 4 4 5 1 1 2 3 4 4 1 2 3 2 2 2 2 2 2 3 3 3 3 3 4 4 5 (c) (d) Figure 11. (a) Seed pyramid for propagation; (b) AND pyramid from binary image; (c) results of labeling; (d) labeling chronology (numbers indicate iterations at which labeling occurred).
• 26. 24 Diagonal Adjacencies procedure DIAGADJ(L,RAG); oldvalp := I(L-1,1); oldvalc := I(L,1); for P := 2 to NCOLS do begin newvalp := I(L-1,P); newvalc := I(L,P); if (newvalp <> oldvalc) then ADD_TO_RAG(newvalp,oldvalc,RAG); if (newvalc <> oldvalp) then ADD_TO_RAG(newvalc,oldvalp,RAG); oldvalp := newvalp; oldvalc := newvalc end end for end DIADJ Checkout procedure CHECKOUT(L,RAG); curval := unused Jabel; "Mark labels of pixels that appear on the current row." for P = 1 to NCOLS do begin newval := I(L,P); if newval < > curval then begin mark(newval,RAG); curval := newval end end end for; "Find labels still in the internal graph structure, but which did not appear on the current row." for R := 1 to NREGIONS do if INSTRUCTURE(R) and not MARKED(R) then begin OUTLIST(R,RAG); FREELIST(R,RAG) end else UNMARK(R) end for end CHECKOUT Final Output procedure FINALOUT(RAG); "Write out the remaining regions and their adjacencies." for R := 1 to NREGIONS do if instructure(R,RAG) then begin outlist(R,RAG); freelist(R,RAG) end end for end FINALOUT
• 27. 25 The algorithm makes one pass over the image. Whenever it detects an adjacency that is different from the most recently detected one, it attempts to add the new adjacency to the graph structure. This involves hashing to the entry for a region and adding the adjacency to an ordered, linked list, if it is not already present. While the theoretical worst case complexity is O(n^) for an n x n image, for practical purposes, the algorithm executes in (9(n^) time, since most regions have a small number of neighboring regions. The required size of the hash table in memory is dependent on the maximum number of regions that can be active at once, which is bounded by n, the number of pixels in a row of the image. 4. S O M E A P P L I C A T I O N S The connected components operator is a very basic operator that is used in many differ- ent applications. It was a part of the so-called "SRI Vision Module", a package developed at SRI International for analysis of binary images (Agin, 1980). The module consists of thresholding, connected component labeling, property computation, and statistical pat- tern recognition. Variants of this sequence can be used for such diverse tasks as character recognition, where the components are characters or pieces of characters; surface-mounted device board inspection, where the components are the devices; and surface inspection, where the components are holes in or scratches on the surface. Character recognition is a major field in its own right. While printed characters in stan- dard fonts are now recognized by commercial machines, handprinted character recognition is not yet as reliable, and handwritten character recognition is still a research problem. A major problem with handwritten character recognition and, to some extent, handprinted character recognition is the segmentation of words into letters. The connected components (extracted after a sequence of image processing operations, ending with a thresholding operation) may represent parts of characters, whole characters, or groups of characters. Another major application area where connected component algorithms are important is medical imaging. When a CT scan has been segmented into components represent- ing organs and their surrounding bone and tissue, it may be necessary to use both the properties of the components themselves and the properties of their neighboring regions to identify the organs. Thus both the connected components operator and the region adjacency graph algorithm are useful. Blob detection and recognition are also important in military applications such as target detection and aerial image analysis. The concepts described in this chapter are also useful in more advanced areas of com- puter vision. For example, in motion detection, we may first detect components in a sequence of images and then determine their correspondences from one image to the next to determine the motions of the objects in the scene. Similarly, there are stereo algorithms that use component matching. Thus connected components and their analysis are of very wide interest to the computer vision community.
• 28. 26 REFERENCES 1 G. Agin, "Computer Vision System for Industrial Inspection and Assembly," IEEE Transactions on Computers, Vol. 14, 1980, pp. 11-20. 2 P.-E. Danielsson and S.L. Tanimoto, "Time Complexity for Serial and Parallel Prop- agation in Images", in Architecture and Algorithms for Digital Image Processing, A. Oosterlinck and P.-E. Danielsson, (eds.). Proceedings of the SPIE, Vol. 435, 1983, pp. 60-67. 3 E. Horowitz and S. Sahni, Fundamentals of Data Structures, Computer Science Press, Rockville, MD, 1982. 4 T.Y. Kong and A. Rosenfeld, "Digital Topology: Introduction and Survey", Computer Vision, Graphics, and Image Processing, Vol. 48, 1989, pp. 357-393. 5 R. Lumia, L.G. Shapiro, and 0. Zuniga, "A New Connected Components Algorithm for Virtual Memory Computers," Computer Vision, Graphics, and Image Processing, Vol. 22, 1983, pp. 287-300. 6 R. Lumia, "A New Three-Dimensional Connected Components Algorithm", Computer Vision, Graphics, and Image Processing, Vol. 23, 1983, pp. 207-217. 7 M. Manohar and H.K. Ramapriyan, "Connected Component Labeling of Binary Im- ages on a Mesh Connected Massively Parallel Processor," Computer Vision, Graphics, and Image Processing, Vol. 45, 1989, pp. 143-149. 8 C. Ronse and P.A. Devijver, Connected Components in Binary Images: The Detection Problem, Research Studies Press, Letchworth, England, 1984. 9 A. Rosenfeld, "Connectivity in Digital Pictures," Journal of the Association for Com- puting Machinery, Vol. 17, 1970, pp. 146-160. 10 A. Rosenfeld and J.L. Pfaltz, "Sequential Operations in Digital Picture Processing," Journal of the Association for Computing Machinery, Vol. 14, 1966, pp. 471-494. 11 R.E. Tarjan, "Efficiency of a Good but not Linear Set Union Algorithm", Journal of the Association for Computing Machinery, Vol. 22, 1975, pp. 215-225.
• 30. 28 Algorithms for producing a component labeling of Y relative to ^ in G are easily derived from the "classical" graph component labeling algorithm referred to in Section 2.2. We now outline one such algorithm. Suppose Y consists of k nodes 2/1,2/2,..., yk- For each ?/,, let P{yi) be the set of all the nodes in {yj j < i} that are adjacent to ?/,• in G, and let ^x{yi) be the set of all the nodes in X that are adjacent to ?/,• in G. If initially Label[a:] = i{x) for all a; G ^ then, when the following algorithm terminates, a component labeling of Y relative to -^ in G is given by i'{y) = Label[t/] for all y in Y: InitializeEqui valenceTable(); FOR i :=1T0 k DO IF P{yi) U Nx{yi) = 0 THEN Lahe[yi] := NewLabel() ELSE BEGIN Label[2/i] := Label[FirstMemberOf(P(2/i) U 7Vx(yi))]; FOREACH u IN RestOf(P(yi) U Nx{yi)) DO MakeEquivalent(Label[w],Label[?/i]) END; FOR z := 1 TO k DO Label[2/t] := UniqueEquivClassRepresentative(Label[2/t]); 2. A Generalization of Lumia's Algorithm Let G be a graph whose set of nodes has been partitioned into subsets Ri,R2,... ,Rn-, called rows, in such a way that adjacent nodes of G always lie either in the same row or in consecutive rows. We regard any 2-d binary image array in which 4- or 8-adjacency is used on the I's as such a graph G: the I's are the nodes of G, and we take Ri to be the set of I's in the ith row of the image array. Similarly, we regard any 3-d binary image array in which 6-, 18- or 26-adjacency is used on the I's as such a graph. In this case we tak^ Ri to be the set of I's in the ith. layer of the image array. It follows from Theorem 1 below that the following two passes will produce a labeling of the nodes of G such that two nodes have the same label if and only if they belong to the same component of G. Pass 1 Let RQ = ^ and let £0 be the empty labeling. For z = 1,2,..., n (in that order) let £{ be a component labeling of Ri relative to the labeling ^,_i of i?,_i in G, such that every label used by ii is either a label used by ^,_i or a new label that is not used by any £j, j < i. At the end of pass 1, each node of G has a label: if y £ Ri, then we regard £i{y) as the label of y. Pass 2 For z = n, n — 1,..., 2 (in that order) apply the following rule to row Rii R Whenever a node y € Ri is adjacent to a node x G Ri-i with a different label, all nodes in Ri-i that have the same label as x are given t/'s label. Rule R assumes that no node in Ri with a label different from i/'s label can be adjacent to a node in Ri-i with the same label as x. Equivalently, it assumes that two nodes
• 31. 29 yi^y2 ^ Ri must have equal labels if there exist two (not necessarily distinct) nodes a:i,a;2 G Ri-i with equal labels such that yi is adjacent to xi and y2 is adjacent to X2. The possibility of performing pass 2 depends on the validity of this assumption for each row Ri when rule R is about to be applied to that row, and will be established in the third paragraph of the proof of Theorem 1. Application of rule R to row Ri does not change any label in Ri] it can only change labels in row i?t_i- Note that if two nodes in Ri^i have equal labels before application of rule R to Ri, then they have equal labels afterwards. T H E O R E M 1 R is always possible to perform pass 2 after pass 1. After pass 2, two nodes of G have the same label if and only if they belong to the same component of G. Proof Consider how the nodes are labeled at the end of pass 1. At this time two nodes in Ri have the same label if and only if they lie in the same component of Ri relative to the labeling of Ri-i. We first deduce from this that the following conditions hold at the end of pass 1: 1. Within each row, two nodes have equal labels if they are adjacent in G. 2. Within each row Ri where z > 1, two nodes yi and ?/2 have equal labels if there exist two (not necessarily distinct) nodes 0:1,0:2 G Ri-i with equal labels such that yi is adjacent to xi and ?/2 is adjacent to X2 in G. 3. Equally labeled nodes always belong to the same component of G. Conditions 1 and 2 hold, since they are together equivalent to the condition that two nodes of Ri have equal labels if they are adjacent relative to the labeling of Ri-i. Equally labeled nodes in the row Ri must he in the same component of G (e.g., by Lemma 1, whose hypotheses are satisfied when X = RQ = (/}, Y = Ri, £ is the empty labeling ^o, and £' = ii). Based on this, we see by induction on i (using Lemma 1 with X = Ri-i, Y = Ri, i ~ ii-i, and i' = ii) that, for each row Ri, equally labeled nodes in Ri must lie in the same component of G. It follows from this and the second condition in the definition of a component labeling relative to i that two equally labeled nodes in consecutive rows also must lie in the same component of G. The same is true of two equally labeled nodes in different, nonconsecutive, rows Ri and Rj, for if such nodes exist then there must exist a node with the same label in each of the rows between Ri and Rj. (This is because in pass 1 every label used in a row is either one of the labels used in the preceding row or a new label that is not used in any previous row.) Hence condition 3 holds at the end of pass 1. Next, we verify that it is always possible to perform pass 2 after pass 1. As we observed above (just after the statement of pass 2) we need to show that condition 2 always holds for Ri when rule R is about to be applied to Ri in pass 2. We know condition 2 holds for all rows after pass 1. Thus it suffices to check that application of rule R to a row Rj in pass 2 preserves the validity of condition 2 for the rows i?i, 2 < i — 1, which are the rows to which rule R will subsequently be applied. Application of rule R to Rj cannot affect the validity of condition 2 for the rows Ri^ i < j — 2, since no labels in these rows are changed. Application of rule R to Rj also preserves the validity of condition 2 for the row Ri, i = j — 1, since no labels in Rj-2 are changed and nodes in Rj-i that have equal
• 32. 30 labels before must have equal labels afterwards. This confirms that it is always possible to perform pass 2 after pass 1. Conditions 1 and 3, which hold for all rows after pass 1, are preserved when rule R is applied to any row. Condition 1 is preserved because nodes with equal labels before application of rule R to a row have equal labels afterwards. Condition 3 is preserved because in rule R the nodes in Ri-i with the same label as x^ which are given ?/'s label, must belong to the same component as x (by condition 3), and must therefore belong to the same component as y and all other nodes with t/'s label. Thus conditions 1 and 3 still hold at the end of pass 2. Consider the labels of any two adjacent nodes at the end of pass 2. One of the following must be true: • The nodes lie in the same row, in which case they must have the same label by condition 1. • The nodes lie in consecutive rows Ri-i and Ri for some z, in which case they must have the same label as a result of the application of rule R to Ri. This shows that after pass 2 adjacent nodes always have the same label and so, since condition 3 holds, two nodes have the same label if and only if they belong to the same component. • Each of the algorithms presented in Sections 2.3, 2.4 and 2.5 labels the I's of a 2-d or 3-d binary image array in a way that is an instance of pass 1 above. It then performs a bottom-up pass whose effect on the labels is the same as that of pass 2. Note that in the algorithm of Section 2.3, the following condition is satisfied at the start of the bottom-up pass: • For 1 < z < n, whenever y G Ri is adjacent to x € Ri-i-, ^'s label is less than or equal to ar's label. A consequence of this is that in rule R, during pass 2, ?/'s label would always be the minimum of the labels of x and y.
• 33. Topological Algorithms for Digital Image Processing T.Y. Kong and A. Rosenfeld (Editors) © 1996 Elsevier Science B.V. All rights reserved. 31 SHRINKING BINARY IMAGES Richard W. Hall* T. Y. Kong^ Azriel Rosenfeld^ "Department of Electrical Engineering, University of Pittsburgh, Pittsburgh, PA 15261 ^Department of Computer Science, Queens College, City University of New York, Flushing, NY 11367 *^Center for Automation Research, University of Maryland, College Park, MD 20742 Abstract The general problem of shrinking binary images is addressed with emphasis on the problem of shrinking to a residue. Past work in this area is reviewed, fundamental limits are discussed and open questions are identified. Emphasis is given to techniques which can be used to verify correct performance of shrinking algorithms, including successful algorithm termination and connectivity preservation. New connectivity preservation tests are developed for parallel 2D reductive-augmentative algorithms and the application of these tests is demonstrated for a variety of shrinking algorithms. A new 2D completely parallel single-operator shrinking algorithm is developed using connectivity preservation requirements to guide the design process. Issues in 3D shrinking are also reviewed. 1. I N T R O D U C T I O N The "shrinking" of binary images to similarly connected representations that have smaller foregrounds (i.e., fewer Ts) has found application as a fundamental preprocessing step in image processing. Two forms of such shrinking have been of greatest interest: (1) The image is transformed to a "topologically equivalent" image that has fewer I's; (2) connected components of the I's are shrunk to isolated single-pixel residues (which may then be deleted). Figure 1 illustrates these two kinds of processes. Figure la is an example of shrinking to a topological equivalent; it illustrates the effect of a typical thinning algorithm. The result is a thin closed curve of I's along the approximate midline of the set of I's in the input image. In Figures lb, d, and e, which are also examples of shrinking to a topological equivalent, the input images are transformed to smallest topological equivalents (i.e., topological equivalents having the smallest numbers of I's). In this case the resulting set of I's need not (and in Figure lb cannot) be contained in the original set of I's. Shrinking to a topological equivalent will be briefly discussed in Section 2.6. The special case of thinning is addressed in detail in two other chapters in this volume, by Arcelli and Sanniti di Baja and by Hall. However, the main subject of this chapter is shrinking to a residue, in which every simply-connected component of the I's (and possibly every component of the I's) of the input image is transformed to an isolated single-pixel residue, which again may or may not belong to the original set of I's. This is illustrated in Figures Ic-e. Residues may be
• 34. 32 deleted after they are produced; at that time they can also be detected, counted, etc., by some other process. Shrinking to a residue will often be referred to simply as shrinking. This type of process has no additional geometric constraints. (As illustrated in Figure Ic, the process may not even preserve all of the topological properties of the input image: when a component of I's that is not simply connected is shrunk to a residue, one or more holes must be eliminated.) Shrinking to a residue has been used as a preliminary step in counting the components of I's in an image [53], and to generate "seed" pixels for labeling connected components of I's [1, 10]. A related type of process is (morphological) erosion, which is of fundamental importance in mathematical morphology [26, 55] and has been used extensively in image processing as a means of smoothing boundaries, removing small or thin components, etc. [26, 52]; see also the chapter by Arcelli and Sanniti di Baja in this volume. However, erosion differs from shrinking in that it removes I's without regard to connectivity preservation. It will not be treated in this chapter. 2. BASIC CONCEPTS, TERMINOLOGY AND NOTATION 2.1. 2D Images. We write E for the set of all pixels. E is in 1-1 correspondence with the set of points in the plane that have integer coordinates. (In this chapter we only consider images based on a rectangular tessellation. However, much of this work is readily extended to images based on a hexagonal tessellation [22].) An image, /, assigns to each pixel in E a value from the set {0,1}, but only a finite number of pixels may have value 1; 1-valued pixels are called I's (of / or in /) and 0-valued pixels are called O's. When discussing a particular image, its set of I's is referred to as the foreground] its set of O's is referred to as the background. Elementary terms of digital topology such as i-adjacenty i-neighbor, i-connected, simply i-connected, i-path, simple i-arc and i-component, where i = 4 or 8, are used in the same sense as defined in the introduction to digital topology in the appendix to this volume. To avoid connectivity "paradoxes" the foreground and background are usually understood to have 8-connectivity and 4- connectivity, respectively [49]; this combination is referred to as 8-4 connectivity. The dual 4-8 definition could also be used, but the 8-4 definition seems to be more often used by the image processing community. The variables m and n are used to denote the foreground and background adjacency relations, respectively; thus (m, n) could be (8,4) or (4,8), but is usually (8,4) in practical applications. Unless otherwise indicated, a lower case letter other than m and n denotes a pixel, the value of a pixel, or an integer; sets of pixels and paths are usually denoted by uppercase letters. We identify the Boolean values true and false with the integers 1 and 0 respectively. The symbols V and A denote Boolean OR and AND, and x' denotes the complement of a Boolean value x. We will say two sets, X and F , meet iiXOY is non-empty. In discussing illustrations of regions of an image, < 5 > will refer to the set of all pixels labeled s. Also, in illustrations that show I's and do not show O's, pixels at blank positions are O's unless otherwise indicated. If O's are shown explicitly, the values of pixels at blank positions are irrelevant or unspecified.
• 35. 33 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (a) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (b) 1 (c) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (d) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (e) Figure 1. Diagrams a, b, d and e show examples of shrinking to a topological equivalent; c, d, and e show examples of shrinking to a residue. Blanks are O's of the input and the output binary images; the -'s are O's of the output image that were I's in the input image. An algorithm for shrinking to a residue may also delete the residues in c, d and e.
• 36. 34 For i = 4 or 8, Ni{p) denotes the set consisting of p and its i-adjacent neighbors, and N*{p) = Ni(p) — {p}. When we refer to specific pixels in Ns{p) we may use the notation given in Figure 2, where po = p. (We will extend this notation to 3D images in Section 6.) We say that p = 1 is a border 1 if N*{p) contains a 0 (i.e., if p is n-adjacent to a 0); p is called an interior 1 otherwise. Cm(p) denotes the number of distinct m-components of I's in Ng{p) that are m-adjacent to p. We say a 1, p, is m-simple if p is a border 1 and Cmip) = 1. Pi Ps P7 P2 Po P6 P3 P4 Ps Figure 2. Notation for the pixels in Ns{p); Po = P The following straightforward computation (first noted in [27]) can be used to determine if p is 8-simple. p is 8-simple iff Ng{p) satisfies the following condition, where the Boolean results in brackets are treated as integers (1 or 0) for the addition operations: P2 A (P3 Vp4)] + bi A (P5 Vpe)] + [p; A (P7 Vps)] + bs A (pi Vpa)] = 1. (Other similar criteria are found in [2, 53, 61].) 2.2. Operators and Operator Application. This chapter deals with algorithms which shrink binary images by applying sequences of operators. In this section we give general definitions of an operator and an operator application. Before giving our general definition of an operator, we discuss the special cfise of a 3 x 3 operator. Let O be any Boolean function of nine Boolean arguments VQ^V^V2-, • - ",V% such that O has value 0 when all nine of its arguments have value 0. Then we say O is a 3 x 3 operator. For any image / and pixel p, we define the value of O at p in I to be the value of the Boolean function when each argument Vi is given the value (1 or 0) of the pixel Pi (see Figure 2) in /. Some simple examples of 3 x 3 operators are: a) "Pgj the operator which gives each pixel p the value of its left-hand neighbor in the image (so that it "shifts" pixel values to the right). b) Po A PjJ ^^lis operator gives a pixel p the value 1 iff its value in the image was 1 and the value of the pixel above it was 0—i.e., iff p was a "north border" 1. ^o^|V^ ;thisc) VQ t j VA ; this operator gives p the value 1 iff its value in the image Wcis 1 and the values of all of its 8-neighbors were 0—i.e., iff p was an "isolated" 1. d) VQ this is the "identity" operator which gives each pixel the same value as it had in the image.
• 37. 35 Operators are commonly specified by stating the conditions under which they change the value of a pixel from 0 to 1 and from 1 to 0. For example, the operator (b) above might be specified as the operator which never changes a 0 to a 1, and which changes a 1 to a 0 iff its north neighbor is a 1. We need a generalization of the concept of a 3 x 3 operator that will admit operators whose value at a pixel p depends on the values of pixels which are not necessarily in Ns{p). To define the value of such an operator at a pixel, we extend the numbering of pixels given by Figure 2 to a numbering of all pixels in the image relative to a given pixel p. For any odd positive integer i and pixel p, let Nixi{p) denote the i x i neighborhood of p. This is the upright i x i square of pixels with p at its center. (The notation Ar,xt(p) should not be confused with the notation Ni(p) defined in Section 2.1. Although Ns{p) = Nsxsip), Niip) is not equal to iV,x,(p) for any i.) Let P9,pio, • • • ,P24 be the pixels in Nsxsip) — ^3x3(p) in clockwise order starting with the pixel in the top left-hand corner. More generally, for any odd integer i let p,-2,p,-2+i,... ,p(,+2)2-i be the pixels in iV(,+2)x(»+2)(p) - ^»xt(p) in clockwise order starting with the pixel in the top left-hand corner. Now we can give our general definition of an operator. An operator is a Boolean function of a finite number of Boolean arguments 'Po,'^ij - -Vk (where k can be any non-negative integer), with the property that the function ha,s value 0 when all of its arguments have value 0. As in the 3 x 3 case discussed above, for any image / and pixel p we define the value of the operator at p in I to be the value of the Boolean function when each argument Vi is given the value of the pixel p, in /. Note that in examples (a), (b) and (d) above, the value of the operator depends only on the values of a proper subset of its arguments—{Vg}, in case (a); {'Po,'p2}5 in case (b); {VQ}, in case (d). The support of an operator O is defined to be the set of O's arguments whose values sometimes affect the value of the Boolean function. We will ignore any arguments of an operator which are not in the operator's support, in the sense that we will consider Oi and O2 to be the same operator if they have the same support and Oi has the same value as O2 for all possible values of the arguments in their support. For each pixel p, the set of pixels p, that correspond to arguments in O's support is called the support of O at p. For example, the supports at p of the operators (a), (b), (c) and (d) above are respectively {ps}, {PJP2}, ^sip), and {p}. Note that for any two pixels q and r, the support of an operator at r is just a translate of the support of the operator at q. We say that the support of an operator O is a k-pixel support if it consists of just k elements. For any odd positive integers j and A:, we say that the support of O is a j x k support^ and that O is a j x A; operator, if the support of O at any pixel p is a subset of the j X k neighborhood of p (i.e., the upright j x k rectangle of pixels centered at p). The radius of an operator O is the smallest non-negative integer p for which O is a {2p + l) X (2/9 -f 1) operator. We apply an operator O to a pixel p in an image / by changing the value of p in / to the value of O at p in /. O is called a reductive operator if its application never changes a 0 to a 1—i.e., if the value of O at a pixel p is 0 whenever p is a 0. O is called an augmentative operator if its application never changes a 1 to a 0—i.e., if the value of O at p is 1 whenever p is a 1. An operator which does not fall into either of these categories is called a reductive-augmentative operator. Such an operator sometimes changes a 0 to
• 38. 36 a 1 and sometimes changes a 1 to a 0. We apply an operator O to a set of pixels R in an image / by simultaneously changing the value of each r € -R in / to the value of O at r in /. (An image / has only finitely many I's. Application of O to /? in / produces an image—i.e., only finitely many pixels are given the value 1—even if il is an infinite set, because the operator O is required to have value 0 when all of its arguments have value 0.) Operator application as defined here is often called parallel application. A completely parallel application of O is an application of O to E, the set of all pixels. Sequential application of an operator O to a finite set D of pixels in an image means application of O to the pixels in D, one at a time in some order. Evidently, the result of sequential application may depend on the set D and on the order in which O is applied to the pixels in D. For example, consider the operator VQ V Vs which gives a pixel p the value 1 iff either p or its left-hand neighbor is 1, and let Z) be as shown in (a) below. Sequential application of Vo V Vs to this D in raster scan order gives the result shown in (b), while sequential application in reverse raster order results in (c). Note that parallel application of VQ W Vgto D also results in (c). 00000 00000 00000 00100 00111 00110 00000 00000 00000 (a) (b) (c) When I's in an image are changed to O's by an application or a sequential application of the operator O, those I's are said to be deleted. When O's in an image are changed to I's by an application or a sequential application of O, those I's are said to be added. The process of deleting I's is sometimes called reduction, and the process of adding I's is sometimes called augmentation. If application of O to a pixel p in an image I would change p's value from 1 to 0, then we may say that O deletes p from 7, or changes p from I to 0 in 7; we may also say that p satisfies deletion conditions for O in 7, or is deletable by O from I. Conversely, if p would be changed from 0 to 1 by application of O to p in 7, then we may say that O adds p to 7, or changes p from 0 ^o 1 in 7; we may also say that p satisfies addition conditions for O in 7, or is addable by O to I. Both O and its support are said to be local if O's radius is small (e.g., if the radius is 1 tTTTT or 2). Note that if O is the "translate right by k units" operator, which gives each pixel the value of the pixel that is k units to its left, then O's support has just one element, but O's radius is k and so O is not local if k is large. Local operators are highly desirable in both sequential and parallel computer imple- mentations. The reason is that when applying any operator O at a pixel p it is necessary to obtain the values of all pixels in O's support at p. If O is local then these values can be obtained in a sequential implementation with low time cost, and in a parallel imple- mentation with low time cost and low interconnection complexity. Parallel application of local operators can be implemented particularly effectively on sufficiently large parallel mesh computers [11, 12, 14, 33, 39, 47].
• 39. 37 2.3. Image Transformations. Image Algorithms. Single-Operator, Sequential, Parallel and Completely Parallel Image Algorithms. An image transformation is a function which maps images to images. The identity image transformation maps every image to itself. We use the term proper image transformation to mean an image transformation that is not the identity. For any operator O and any set of pixels i?, we write [O : R] for the image transformation T such that, for all images /, T(I) is the image obtained by (parallel) application of O to i? in /. Not all image transformations T can be expressed in the form [O : R]. However, if a proper image transformation T is expressible in this form then the operator O and the set of pixels R are uniquely determined, and R is non-empty. In other words, if [O : R] = [O' : R'] is proper then O = O' and R = R! ^ 9. The radius of an image transformation T is the least integer ^ > 0 such that, for every pixel p and image /, the value of p in T{I) depends only on the values in / of the pixels in N(2p+i)x{2p-^i){p)' If no such integer p exists, then we say the radius of T is infinity. If O is an operator with radius ^, and R is any non-empty set of pixels, then the radius of the image transformation [O : R] is also p. If Ti, 72,..., Tjt are image transformations with finite radius then the radius of their composition Tk o Tk-i o ... o Ti is at most Pi -- P2 -{• " • -- pk, where pi is the radius of T,. An image transformation T will be called reductive if for all images I the set of 1 's of the image T(I) is a subset of the set of I's of /. An image transformation [O : i?], i? ^ 0, is reductive if and only if O is a reductive operator. Next, we define the concept of image algorithm that will be used in this chapter. Let X be the set of all non-empty finite sequences of images. A termination condition is a Boolean function T : T —> {true,false}. Our image algorithms are determined by a sequence of proper image transformations of the form [O : R] and a termination condition. Specifically, let Oi, O2,03,... be a sequence of operators and i2i, 7^2, i?3,.. • a sequence of non-empty sets of pixels, where the sequences are either both infinite, or both finite with the same number of terms. Let T be a termination condition. In the case where the sequences of O's and /2's are finite, suppose further that T{s) is true for all image sequences 5 of length A; -|-1, where k is the length of the sequences of O's and /2's. An image algorithm associated with the sequence of proper image transformations [Oi : ^i], [O2 : R2], [O3 : R3],... and termination condition T is an algorithm whose behavior can be specified as follows: i :=0; INPUT an image /Q; WHILE NOT r((/o,..., /.)) DO i:=i--l] li := [O.- : i^](/,_i) END WHILE; OUTPUT li Here [O, : /2,](/,_i) denotes the image obtained by (parallel) application of O, to Ri in the image /,_i. The actions performed at the i'** iteration of the WHILE loop constitute the
• 40. 38 i*"^ iteration of the image algorithm. During execution of the algorithm, the value of i is called the iteration number. Note that the iteration number is /: — 1 when the termination condition is evaluated for the k^^ time. The value of T((/o,...,/,)) will rarely depend on all of the images in the sequence (/Q, ...,/,). In fact, the value of T((/o,...,/,)) will frequently depend only on the final image /,. In the rest of this chapter the term image algorithm will always mean an image al- gorithm that is associated with some sequence of proper image transformations [Oi : Ri]^ [O2 : RT], [O3 : R3],... and some termination condition T, The O's here are called the iteration operators of the algorithm, and O, is its t*** iteration operator. If each of the O's is the same operator, then the algorithm is called a single-operator image al- gorithm. The sequence of image transformations [Oi : i?i],[02 : /^2lj[03 ' RZIJ-- is called the transformation sequence of the algorithm. Each member of this sequence is called an iteration transformation of the algorithm; [O, : Ri] is called the i^^ iteration transformation. For any given input image, the number of iterations required for an image algorithm to terminate (i.e., the number of iterations which are completed before the termination condition is satisfied) is called the iteration count of the algorithm for that input image. Later in this chapter we will have occasion to compare the "speeds" of image algorithms by comparing their iteration counts. Let A be an image algorithm that terminates for all input images. For any image /, we write A(7) to denote the image that is output when A terminates, if I is input by A. The image transformation defined by A is the image transformation that maps each image / to the image A(/). Image algorithms with different transformation sequences or different termination con- ditions are considered to be different. Note that it is possible for image algorithms with different transformation sequences to define the same image transformation. For example, let Ig be the image with no I's, and let O;^ be the "zero" operator which gives every pixel the value 0. Let Tg be the termination condition that is satisfied if and only if the final image in its argument sequence is 7^. Then every image algorithm whose termination condition is 7^ and whose transformation sequence includes [O^ : E] at some iteration defines the same image transformation—the transformation that maps all images to 7^. The radius of an image algorithm is the maximum of the radii of its iteration oper- ators. In the event that there is no maximum, we say the radius of the algorithm is infinity. However, most image algorithms of practical interest have a finite radius. When considering image algorithms that terminate for all input images, it should be borne in mind that the radius of the image transformation defined by any such algorithm is likely to be much greater than the radius of the algorithm. In fact the image transformation defined by an image algorithm of finite radius quite commonly has a radius of infinity. A reductive image algorithm is an image algorithm all of whose iteration operators are reductive. Such an algorithm never adds a 1 at any iteration, regardless of the input image. Similarly, an augmentative image algorithm is an image algorithm all of whose iteration operators are augmentative. An image algorithm which is neither reductive nor augmentative is called a reductive-augmentative image algorithm. Let A be an image algorithm with transformation sequence [Oi : 72i], [O2 : 7^2]) [O3 • R3], — If each of the R*s consists of just one pixel, then A is said to be sequential. If
• 41. 39 each of the /2's contains more than one pixel, then A is said to be parallel. If each of the R's is the set E of all pixels, then A is said to be completely parallel. 2.4. Periodic Image Algorithms. Subiteration and Subfield Algorithms. Many of the image algorithms that have been considered in the literature belong to the class of periodic image algorithms, which we now define. A sequence ai,a2,a3,... is said to be periodic if it is an infinite sequence and there exists an integer TT > 1 such that a,+^ = a, for all positive integers i. In this case we call the least such integer TT the period of the sequence. For finite image sequences s and 5*, let s*s denote the sequence of images obtained by catenating the sequences 5* and 5, so that the initial and final images in s*s are respectively the initial image in s* and the final image in s. Say that a termination condition T : J —• {true, false} is monotonic if T{s) implies T{s*s) for all 5,5* G X. Simple and common examples of monotonic termination conditions are the conditions T for which the Boolean value of T((/o,...,/,)) depends only on the final image /,. Some image algorithms can terminate only when the iteration number is a multiple of a certain integer a. In our terminology, if T is the termination condition of an image algorithm of this kind then T{s) can only be true when the length of the sequence s is ka + 1 for some integer k. Such a termination condition is evidently not monotonic, but it may have a related property which we now define. For any integer a > 1, say that a termination condition T is a-monotonic if T{s) implies T(s'*s) for all 5,5* G X such that the length of 5* is a multiple of a. A termination condition is monotonic if and only if it is 1-monotonic. A monotonic termination condition is a-monotonic for every integer a > 1. (More generally, an a- monotonic termination condition is A;a-monotonic for every integer k >1.) An image algorithm A is said to be periodic if there is some integer TT > 1 for which both of the following conditions are satisfied: 1. A's transformation sequence is periodic, and TT is an integer multiple of the period of that sequence. 2. A's termination condition is 7r-monotonic. For any such algorithm, the least integer TT > 1 for which these conditions hold is called the period of the algorithm. Let A be any periodic image algorithm with period TT > 1. The sequence of TT iterations from the (A: — l)7r -|- 1"' through the kw*^ is called a cycle of A or, more precisely, the k^^ cycle of A. If A's transformation sequence is Ti, T2, T3,... then the composition Tk^ o ... o T()t-i)7r+i of the image transformations applied in a cycle is called the cyclic image transformation of A. (By condition 1 in the definition of a periodic image algorithm, this does not depend on A;.) A periodic image algorithm with period 1 must evidently be a single-operator algorithm, and must be completely parallel if there are to be no pixels whose values can never be changed by the algorithm. Single-operator completely parallel image algorithms have sometimes been called fully parallel. A completely parallel periodic image algorithm A with period greater than 1 is some- times called a subiteration algorithm [4, 18, 41, 50, 52, 56, 62] or, more precisely, a
• 42. 40 iT'Suhiteration algorithm where TT is the period of A. The reason for this terminology is that, since the operator application at each iteration is completely parallel, the algo- rithm's cyclic image transformation has the same effect as a single completely parallel application of some operator; in other words, the algorithm's cyclic image transformation is equivalent to [O* : E] for some operator O*. Thus the iterations within a cycle of A can be viewed as "subiterations" of a single "macro-iteration" in which O* is applied to E. Let A be a periodic image algorithm with transformation sequence [Oi : i?i], [O2 : ^2], [O3 : /Ja],..., for which the sequence /2i, i?2j ^3, • • • has period irR> I. (TTR need not be the period of A, but it must be a divisor of the period of A.) A is called a suhfield algorithm or, more precisely, a Tr^-subfield algorithm [16, 18, 47] if every pixel lies in just one of the sets J?i,..., R^j^ (so that {/li,..., Rm} is a partition of S). Each of these R's is then called a subfield of the algorithm. Note that only pixels in one of the subfields can change state at any given iteration. In most of the 2-subfield algorithms that have been considered in the past, the subfields partition E in a way that is analogous to the partition of an infinite checkerboard into black squares and white squares. More generally, it is usual for all the subfields of a subfield algorithm to be congruent to each other, and to have the property that for any two pixels p, g G E the translation which maps p to q also maps the subfield containing p onto the subfield containing q. The following two propositions are useful for proving that a subfield algorithm termi- nates for all input images. Let p be a pixel and let [O : R] be the iteration transformation applied at some iteration of an image algorithm A. Then that iteration is called a p-on iteration of A if p G i?, and is called a p-off iteration of A if p ^ R. Proposition 2.1 When an image algorithm is executed: 1. If a pixel p has the same value at the end of every p-on iteration, starting with the i"* p-on iteration, then its value never changes after the end of the i"^ p-on iteration. 2. If a pixel p has the same value at the beginning of every p-on iteration, starting with the i"* p-on iteration, then its value never changes after the beginning of the i*^ p-on iteration, except possibly at the last p-on iteration before termination. Proof. The value of p cannot change at p-off iterations. To prove the first assertion, suppose p has a given value at the end of every p-on iteration, starting with the i*^. If p has the opposite value at the beginning of the j*^ p-on iteration for some j > i, then p must have had that value at the end of the previous p-on iteration, contradiction. To prove the second assertion, suppose p has a given value at the beginning of every p-on iteration, starting with the i***. If p has the opposite value at the end of the j*^ p-on iteration for some j > *, and this is not the last p-on iteration, then p would still have that value at the beginning of the next p-on iteration, contradiction. D Proposition 2.2 Let q be any pixel. Then, when a subfield algorithm is executed, if a pixel p h€is the same value at the beginning of every q-on iteration, starting unth the i*^ q-on iteration, then p's value never changes after the beginning of the i*^ q-on iteration, except possibly at the last p-on iteration before termination.
• 43. 41 Proof. If p and q belong to the same subfield, then the ^-on iterations are the same as the p-on iterations, so the result follows from Proposition 2.1. Now let p and q belong to different subfields. Then ^-on iterations are p-off iterations, so that p does not change in value from the beginning of a ^-on iteration to the beginning of the next p-on iteration. In particular, p's value at the beginning of a ^-on iteration is the same as its value at the beginning of the next p-on iteration, if there is one before the algorithm terminates. So the result again follows from Proposition 2.1. D 2.5. Foreground and Background Connectivity Preservation by Reductive Im- age Algorithms. Connectivity preservation properties of a reductive image algorithm can be character- ized in several equivalent ways. In this section we present an approach which formed the basis for early connectivity preservation proofs for parallel thinning algorithms [50, 56]. We first define two conditions on a reductive image transformation T and an input image /: FCl. No m-component of the I's of / contains two or more m-components of the Ts of T{I) (i.e., no m-component of the I's of / is split by T). FC2. Every m-component of the Ts of / contains an m-component of the I's of T{I) (i.e., no m-component of the I's of / is completely eliminated by T). If T and I satisfy ¥Qk (where A: = 1 or 2), then we may also say that T satisfies FCk for the input image I. The image transformation T is said to preserve foreground connectivity for the input image I if both FCl and FC2 are satisfied. We say a reductive image transformation satisfies ¥Ck (where A: = 1 or 2) if it does so for every input image /. A reductive image transformation is said to preserve foreground connectivity if it satisfies both FCl and FC2 or, equivalently, if it preserves foreground connectivity for every input image /. Definition 2.3 For k = I or2, a reductive image algorithm A is said to satisfy FCA; if A terminates for all input images and the image transformation defined by A satisfies FCk. Similarly, a reductive image algorithm A is said to preserve foreground connectivity if A terminates for all input images and the image transform.ation defined by A preserves foreground connectivity {or, equivalently, if A satisfies both of FCl and FC2). A sufficient condition for a reductive image algorithm A that terminates for all input images to preserve foreground connectivity is that each iteration transformation of A should preserve foreground connectivity. We now prove a partial converse of this. Proposition 2.4 Let A be a periodic reductive image algorithm that preserves foreground connectivity. Let I be an image such that when A is executed with I as the input image, the algorithm does not terminate before the end of the first cycle. Then the cyclic image transformation of A preserves foreground connectivity for the input image I. Proof. Let T be A's cyclic image transformation. Suppose T does not preserve foreground connectivity for the input image /. This cannot be due to a violation of FC2 (i.e., complete elimination by T of a component of the I's of / ) , for in that case execution of
• 44. 42 A with input / would eliminate the same component of the I's of /, since A is reductive (contrary to the hypothesis that A preserves foreground connectivity). Hence T violates FCl for the input image /: application of T splits a component C of the I's of / into two or more components. Let Ci,C2 C C be two different components of the I's of the resulting image T{I). Consider the execution of A with T{I) as the input image. The algorithm terminates after k iterations, for some integer A: > 0. Let TT be the period of A. Then execution of A with input / must terminate after TT + A; iterations unless it terminates earlier, since the first TT iterations transform / to T(/), and A's termination condition is 7r-monotonic. Thus when A is executed with input /, it terminates after 'K -- ki iterations, for some k < k. Consider the output image A(/). The sets of pixels C and C2 cannot both contain a 1 of A(/), for otherwise A would not satisfy FCl for the input image I—the component C of the I's of / would be split by A. Hence one of C and C2—Ci, say—does not contain any 1 of A(/). Since k < k and A is reductive, C also does not contain any 1 of A(T(/)). Hence the application of A to the image T(/) completely eliminates the component C of the Ts of T{I)^ and so A does not satisfy FC2 for the input image T(/). This contradiction proves the proposition. D Even when an image algorithm A preserves foreground connectivity, some iteration transformation of A may fail to preserve foreground connectivity for some input images. This is because it is possible that none of the images for which the z'^ iteration transfor- mation of A fails to satisfy FCl or FC2 can ever be the output of the previous i — iterations. Another possibility is that whenever a component is split at some iteration of A, all but one of the resulting pieces are completely deleted at subsequent iterations. We now give examples of these two possibilities. Suppose, for definiteness, that m = 8. Consider the following three operators: Let Oo be the reductive operator that deletes a 1, p, iff its neighborhood is as follows: 0 0 0 0 0 1 p 0 0 0 0 0 When the image transformation [Oo : E] is applied to an image, any 8-component of the I's that consists of two east-west adjacent pixels is reduced to a single pixel, but the image is otherwise unchanged. Let Ofc be the reductive operator that deletes a 1, p, iff its neighborhood matches either of the following: 0 0 0 0 0 0 0 0 0 p 1 0 0 1 p 0 0 0 0 0 0 0 0 0 Note that the image transformation [Oj : E] does not satisfy FC2, since any 8-component of the I's that consists of two east-west adjacent pixels is completely eliminated. The image is otherwise unchanged. Let Oc be the operator that deletes a 1, p, iff its neighborhood matches either of the following:
• 45. 43 0 0 0 0 0 0 0 0 0 0 0 1 1 p 1 0 0 1 p 0 0 0 0 0 0 0 0 0 0 0 Note that [Oc : S] does not satisfy FCl, since any 8-component of the I's that consists of a row of four pixels is split. The only other change in the image is that any 8-component of the I's that consists of two east-west adjacent pixels is reduced to just one pixel. Let Ai be a completely parallel image algorithm which always terminates in exactly two iterations, whose transformation sequence is [Oa, E], [Ob, E]. Note that the image can only change at the first iteration. Ai(/) is the same as / except that all 8-components of the Ts that consist of two east-west adjacent pixels are reduced to single pixels. Thus Ai preserves foreground connectivity despite the fact that [Ot: E] does not satisfy FC2. For the second counterexample, let A2 be a completely parallel image algorithm which always terminates in exactly two iterations, whose transformation sequence is [Oc, E], [Oft, E]. A2(/) is the same as / except that all 8-components of the I's that consist of two east-west adjacent pixels or a row of four pixels are reduced to single pixels. Thus A2 preserves foreground connectivity, although [Oc : E] does not satisfy FCl and [Ob : E] does not satisfy FC2. Background connectivity preservation can be defined in a similar way to foreground connectivity preservation. Specifically, we say that a reductive image transformation T preserves background connectivity if both of the following conditions are satisfied for all images /: BC3. No n-component of the O's of T{I) contains two or more n-components of the O's of / (i.e., no two n-components of the O's of / are merged by T). BC4. Every n-component of the O's of T{I) contains an n-component of the O's of / (i.e., no new n-component of O's is created by T). We say that an image algorithm A preserves background connectivity if A terminates for all input images and the image transformation defined by A preserves background connectivity. For another view of connectivity preservation see Kawai's analysis in [30, 31] where a criterion based on the adjacency tree image description is utilized. 2.6. Reductive Shrinking to a Topological Equivalent. The connectivity preservation conditions stated in the previous section are important in the theory of shrinking to a topological equivalent. Reductive image algorithms for shrinking to a topological equivalent must satisfy all four of the conditions FCl, FC2, BC3, BC4; in other words, they must preserve foreground and background connectivity. However, such algorithms are not the main concern of this chapter, and will only be considered briefly. Let O be the reductive operator which deletes a 1, p, iff p is m-simple. Perhaps the most obvious non-trivial examples of image algorithms that preserve foreground and background connectivity are the sequential image algorithms that repeatedly apply the operator O sequentially, in a conventional raster scan order, to a set of pixels Z), until one such sequential application deletes no I's. Figure 3 shows two examples of the progress of
• 46. 44 1 12 19 24 29 34 2 13 20 25 30 35 3 14 • • • 36 4 • • 5 • • 6 • • 7 • • 8 15 • • • 37 9 16 21 26 31 38 10 17 22 27 32 39 11 18 23 28 33 40 41 42 43 44 45 46 47 48 49 50 51 (a) 10 9 8 7 6 5 4 3 2 1 10 10 10 10 10 10 10 10 10 10 10 12 12 12 12 12 12 • 11 10 11 10 9 8 7 6 5 4 3 2 1 (b) Figure 3. Sequential deletion of 8-simple I's in raster scan order. The numbered pixels and •'s are the Ts of the input images; the •'s are the I's of the output images. In (a), 51 of the 65 original I's are deleted, by a single sequential application of O to Z) in conventional raster scan order; the numbers in (a) indicate the order in which the I's are deleted. In (b), 40 of the 41 original I's are deleted, by 12 sequential applications of O to Z), all in conventional raster scan order; each number in (b) indicates the sequential application (or "pass") during which the corresponding 1 is deleted.
• 47. 45 such an algorithm for {m,n) = (8,4). In each example, Z) is a set of pixels that contains all the I's of the input image The example in Figure lb shows that reductive image algorithms cannot in general reduce images to smallest topological equivalents, since in some cases the set of I's of a smallest topological equivalent cannot be a subset of the original set of Ts. It might be possible to solve the problem of shrinking to a smallest topological equivalent using a reductive-augmentative image algorithm. However, such algorithms have received little attention in this context. Reductive image algorithms that satisfy the connectivity preservation conditions are also unable to delete all interior I's. For example, consider p in the following image (due originally to Arcelli [3]), where p is a 1 and unlabeled pixels are O's: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 p 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 In this image no set of I's can be deleted without violating one or more of the FC and BC connectivity preservation conditions. 2.7. m-Residues. Shrinking Algorithms. Universal Shrinking Algorithms. An m-isolated 1 in an image / (i.e., a 1 whose m-neighbors are all O's), or a set consisting only of an m-isolated 1, is called an m-residue in /. We now give a precise definition of the term shrinking algorithm. Our definition will depend on a concept of foreground connectivity preservation which is related to the con- cept defined in Definition 2.3 above, but which (1) allows deletion of m-residues, and (2) applies to reductive-augmentative image algorithms as well as reductive image algorithms. The new concept will be referred to as foreground connectivity preservation with allowance for deleted residues. This will be precisely defined in due course. Definition 2.5 A shrinking algorithm is an image algorithm A that satisfies the following conditions: 1. A preserves foreground connectivity with allowance for deleted residues. 2. For all images I, every m-component of the 1 '5 of A{I) either is an m-residue in A(7) or is not simply m-connected; and the number of m-components of the latter kind is at most equal to the number of m-components of the I's of I that are not simply m-connected. One definition of foreground connectivity preservation with allowance for deleted residues will be given in Definition 3.1, but this definition will apply only to reductive
• 48. 46 image algorithms. A more general definition is needed for reductive-augmentative image algorithms, and will be given in Definition 4.1. A universal shrinking algorithm is a shrinking algorithm that satisfies the following stronger version of condition 2: 2'. For all images /, every 1 of A(/) is an m-residue in A(7). Thus a universal shrinking algorithm must reduce an m-component of I's to an m-residue even if the m-component is not simply m-connected. It is an open question whether universal reductive shrinking algorithms of finite radius exist. We show below that there is no periodic universal reductive shrinking algorithm. For any set of pixels Z) C S, a D-image is an image in which all the I's lie in D. A (universal) shrinking algorithm for D-images is defined in the same way as a (universal) shrinking algorithm, except that "For every image 7" in condition 2 or 2' above is replaced by "For every Z)-image 7". 3. REDUCTIVE SHRINKING Rosenfeld [49] showed that, for m = 8 or 4, every simply m-connected component of the I's of any image must contain an m-simple 1 if it is not an m-residue. This will also follow from Proposition 3.11 below, in the case m = 8, and Proposition A.4 in Appendix A, in the CcLse m = 4. Hence there are single-operator reductive shrinking algorithms whose iteration operator has a 3 x 3 support: the operator which deletes p if and only if p is m-simple could be the iteration operator of such an algorithm. (Moreover, an image algorithm which repeatedly applies this operator sequentially to a finite set of pixels 7), in any order, is a single-operator sequential shrinking algorithm for £>-images.) In the case m = 8, we will show that a 3 x 3 operator support is the smallest possible for a single-operator reductive shrinking algorithm whose iteration transformation preserves foreground connectivity except for possible deletion of m-residues. We also show that the operator support for a single-operator completely parallel reductive shrinking algorithm must contain at least 19 pixels, and exhibit a completely parallel shrinking algorithm that attains this lower bound. Analogous results for the case m = 4 are given in Appendix A. In another direction, we will show that there is no periodic reductive universal shrinking algorithm regardless of whether m = 8 or 4: periodic reductive image algorithms cannot shrink all m-components of I's to m-residues, though they can successfully shrink simply m-connected components of I's. 3.1. FCIR and FC2R; Foreground Connectivity Preservation with Allowance for Deleted Residues. In this section we give a definition of foreground connectivity preservation with al- lowance for deleted residues, but only for reductive image algorithms. This is enough to complete the definition of shrinking given above, in the case when the algorithm is reductive. Image transformations that delete m-residues cannot satisfy the FC2 condition of fore- ground connectivity preservation. An image transformation [O : R] which satisfies FC2 except that it may delete m-residues is said to satisfy FC2R. An image transformation
• 49. 47 [O : R] which satisfies FCl and FC2R is said to preserve foreground connectivity with possible deletion of residues. Note that any image transformation [O : R] that preserves foreground connectivity is also an image transformation that preserves foreground con- nectivity with possible deletion of residues. Foreground connectivity preservation with allowance for deleted residues is an analog of this concept, for image algorithms. Loosely speaking, a reductive image algorithm preserves foreground connectivity with allowance for deleted residues if the algorithm satisfies the conditions FCIR and FC2R below, which are obtained by applying FCl and FC2 "after restoring all deleted m-residues to the output image". (All image algorithms that satisfy FCIR will also satisfy FCl, and all image algorithms that satisfy FC2 will also satisfy FC2R.) FCIR and FC2R will be precisely defined for image algorithms in Definition 3.1, using the concept of an r-image which we now introduce. An image with deleted residues^ or i-image, is a pair (/, D) where / is an image and D is a set of O's of / none of which is m-adjacent to any 1 of /. D is called the deleted residue set of (IjD). I's, O's and m-residues in / are also referred to as I's, O's and m-residues •m{I,D). Intuitively, we think of D as the set of all m-residues that have so far been deleted by an image algorithm. The restored residues image of an r-image (/,-D), denoted by {I^D)^, is the image whose set of Ts consists of the I's of / and all the pixels in D. An T'image transformation is a function which maps r-images to r-images. For any r-image transformation T, the restored residues image transform,ation associated with T, written T^, is the image transformation such that, for every image /, T""(/) = T((/, 0))"". If O is any reductive operator and R any set of pixels, then the r-image transformation associated with the image transformation [O : i?], denoted by [O : RY, is defined as follows. Let (I,D) be any r-image. The set of I's of [O : /?]'((/, D)) is just the set of I's of [O : R]{I). The deleted residue set of [O : RY{{I, D)) is the union of D with the set of all m-residues in / (if any) that are deleted by [O : R] from /. Note that [O : RY{(I, D)) is completely determined by [O : /?]*•((/, 0)). Indeed, the two differ only in their deleted residue sets, and the former's deleted residue set is the union of the latter's deleted residue set with D. Let A be any reductive image algorithm that terminates for all input images. For all integers i > 1, let [O,- : Ri] be the i^^ iteration transformation of A. The T-image transformation associated with A, denoted by A*^, is defined in a fairly obvious way, as follows. Let (7, D) be an any r-image, and let j be the number of iterations of A that occur before algorithm termination when A is executed with input I. Then A'^((7, D)) = [Oj : RjY o [Oj_i : Rj.iY o ... o [Oi : i?i]'((/,i))). Again, A"((/,D)) is completely determined by A'^((/, 0)), and differs from it only in its deleted residue set, which is the union of the latter's deleted residue set with D. The image transformation (A')"", also written A"^, is called the restored residues image transformation of A. Note that this is a reductive image transformation. Definition 3.1 For k = lor2,a reductive image algorithm A is said to satisfy FCfcR if A terminates for all input images and its restored residues image transformation A" satisfies FCk. Similarly, a reductive image algorithm A is said to preserve foreground connectivity with allowance for deleted residues if A terminates for all input images and its restored residues image transformation A"" preserves foreground connectivity {or,
• 51. 49 Lemma 3.4 For i = 1,2,... /c^ pi he the radius of the i^^ iteration operator of an image algorithm A. For k = 1,2,... let rk = pi -- Pi -- --- -^ Pk- Let p be a pixel, k a positive integer and I and I' images such that the values of all pixels in N^2rk-i-i)x{2rk+i)(p) ^'"'^ ^^^ same in I as in I'. Then the value of p after k iterations of A is the same when A is executed with input I as when A is executed with input I'. Proof. For i = 1,2,... let [O, : Ri be the t'** iteration transformation of A. Then the radius of [O, : R^ is at most /),, by part 1 of Lemma 3.3, and so the radius of the composite image transformation Tk = [Ojt : Rk]o.. .o[Oi : Ri] is at most rjb, by part 2 of Lemma 3.3. As the values of all pixels in -/V(2rfc+i)x(2rfc+i)(p) are the same in / as in /', it follows from the definition of the radius of Tk that p's value in Tk{I) is the same as its value in Tk{r), as asserted. • 3.2. Some Properties of Reductive Shrinking Algorithms. In this section we establish some elementary properties of reductive shrinking algo- rithms, and prove that there is no periodic reductive universal shrinking algorithm. We first prove a result which implies that for any reductive shrinking algorithm there exist input images for which the algorithm takes arbitrarily many iterations to terminate. (In Appendix B, we prove an analogous result for reductive "shrinking algorithms" that satisfy FCl and FC2 rather than FCIR and FC2R.) Proposition 3.5 Let A be a reductive shrinking algorithm, let h and k be non-negative integers and let p be a pixel. Then there is an image I such that: 1. The set of l^s of I and all of its m-connected subsets are simply m-connected. 2. All I'sofI lie outside N^2h+i)x{2h+i){p)- 3. When A is executed with input I, it takes more than k iterations to term,inate and after k iterations there are still at least two 1 '5 in the image. Proof. Let r be the sum of the radii of the first through k^^ iteration operators of A. Let Bi and B2 be two columns of 2r -|- 4 pixels, both well outside N^2h+i)x{2h+i){p), such that B2 is a translate of Bi to the west by r + 2 pixels. For i = 1 and 2, let 7, be the image whose set of I's is Bi. Conditions 1 and 2 both hold for I = I and I = I2. We claim that condition 3 must hold either for 7 = /i or for I = I2. Suppose otherwise. For i = I and 2 let 6* be the m-residue in A"^(7,), and suppose 6* becomes an m-residue during the k^^ iteration when A is executed with input 7,. Then ki < k foT i = 1 and 2, since condition 3 does not hold for 7 = 7,. Let J be an image whose set of I's is a simple m-arc consisting of Bi U B2 and the I's in an m-path outside ^^(2/i+i)x(2/i+i)(p) U iV(2r+3)x(2r+3)(^^) U A^(2r+3)x(2r+3)(&^) from an endpoiut pixel of ^1 to an endpoint pixel of B2. For every pixel in the 3 x 3 neighborhood of 6*, all the pixels in its (2r -f-1) x (2r -f 1) neighborhood have the same values in J as in 7,. However, the sum of the radii of first through kf^ iteration operators of A is at most r, since ki < k. So it follows from Lemma 3.4 that when A is executed with J as the input image neither of the 6*'s can become an m-residue before the kf^ iteration. Hence this execution of A cannot terminate until after the (max(A:o7 ^1))'** iteration (by condition 2 in the definition
• 52. 50 of a shrinking algorithm). Moreover, each of b^ and b^ will by that time have become an m-residue (which may then have been deleted). This violates FCIR because the set of I's of J is m-connected; the contradiction justifies our claim and proves the proposition. • Using Proposition 3.5, we obtain stronger versions of Propositions 2.4 and 3.2 for re- ductive shrinking algorithms: Proposition 3.6 Let A be a periodic reductive shrinking algorithm. Then the cyclic restored residues image transformation of A preserves foreground connectivity. Proof. Let T be the cyclic restored residues image transformation of A. Let J be any image. Then we claim there is an image / such that: L When A is executed with / as its input image, A does not terminate before the end of its first cycle. 2. If T preserves foreground connectivity for the input image /, then T also preserves foreground connectivity for the input image J. By Proposj^tions 2.4 and 3.2, condition 1 implies that T preserves foreground connectivity for the input image /. Condition 2 then implies that T preserves foreground connectivity for the input image J. Thus if the claim is valid (for every image J), then the present proposition is true. It remains to justify the claim. Let TT be the period of A. Let r be the sum of the radii of all the iteration operators in a cycle of A. By Proposition 3.5 there is an image J' whose set of Ts: (a) is simply m-connected; (b) has no m-connected subset that is not simply m-connected; (c) lies outside the (2r -f 1) x (2r -|-1) neighborhoods of all I's of J; and (d) is such that when A is executed with input J' there still exist two I's p and q in the image after TT — 1 iterations. Let I be the image whose I's are the I's of J together with the I's of J'. Consider the execution of A with / as the input image. All pixels in the (2r-|-l) x (2r-}-l) neighborhoods of p and q have the same values in / as in J'. So it follows from property (d) of J' and Lemma 3.4 that neither p nor q is deleted at any iteration before the TT'^. Hence condition 2 of our definition of a shrinking algorithm and property (b) of the I's of J' imply that A cannot terminate before the TT*^ iteration. Thus / satisfies condition 1 above. By Lemma 3.3, the radius of T is at most r. As all pixels in the (2r -|- 1) x (2r -}- 1) neighborhoods of the I's of J have the same values in / as in J, all pixels that are I's of J have the same values in T{I) as in T(J). It follows that / also satisfies condition 2 above. • Corollary 3.7 Let A be any single-operator completely parallel reductive shrinking algo- rithm, and let O be A^s iteration operator. Then A^s iteration transformation [O : E] preserves foreground connectivity with possible deletion of residues. Proof. A's cyclic restored residues image transformation does not delete m-residues, but is otherwise the same as A's iteration transformation. It follows that A's cyclic
• 53. 51 restored residues image transformation preserves foreground connectivity if and only if A's iteration transformation preserves foreground connectivity with possible deletion of residues. Hence the corollary follows from the proposition. • Proposition 3.8 There is no periodic reductive universal shrinking algorithm. Proof. Suppose A is a periodic universal reductive shrinking algorithm with period TT. Let r be the sum of the radii of the iteration operators used in each cycle of A. Let D be a set of pixels in the form of the outline of a diamond, if m = 8, or an upright square, if m = 4, such that the sides of D are much longer than r. Let Ir be an image whose set of I's consists of three copies D^D2<, D3 of D, each of which is much farther than r from the other two. For all integers i > 1, let [O, : Ri] be the i*^ iteration transformation of A. As A is a universal shrinking algorithm, there is a least integer j < ir such that [Oj : Rj] changes Ir. Let p^ he a. 1 of Ir that is deleted by [Oj : Rj] from Ir. Let T be A's cyclic restored residues image transformation. As [Oj : Rj] deletes p^ from 7r, and p^ is not an m-residue in Ir (indeed, there are no m-residues in 7^), T also deletes p^ from 7^. Proposition 3.6 implies that T preserves foreground connectivity. To complete the proof, we obtain a contradiction of this. Specifically, we construct an image 7A such that an m-component of the I's of 7A is split by T. By symmetry we may assume p^ is in Di. Since T preserves foreground connectivity, it satisfies FC2. It follows that there are pixels p^ G D2 and p^ G D3 each of which is a 1 in T{Ir). Let u and v be non-adjacent pixels of Di that are farther than r away from p^. Now modify Ir in two steps as follows. First delete from Di the "open m-arc" joining u to v that does not contain p^. Then join w to 7)2, and v to D3, by disjoint simple m-arcs of I's that remain farther than r away from p^^p^ and p^; the simple m-arcs must also be so chosen that if p^ were deleted from the resulting image then D2 and D3 would lie in different m-components of the I's. Let 7A be the resulting image. Note that the set of I's of 7A is ?7i-connected. By Lemma 3.3 the radius of T is at most r. Since all pixels in ^(2r+i)x(2r+i)(p^) have the same values in 7A as in 7^, and since T deletes p^ from 7^, T must delete p^ from 7A. Again, since all pixels in N^2r+i)x{2r+i){p^) and N^2r+i)x{2r+i){p^) have the same values in 7A as in 7r, T deletes neither p^ nor p^ from 7A. Thus T splits the only m-component of the I's of 7A. This contradiction proves the proposition. D 3.3. Minimal Operator Supports for Single-Operator Reductive Shrinking Al- gorithms in the Case m = 8. We now show that for m = 8 a 3 x 3 support is the smallest possible for any single- operator reductive shrinking algorithm all of whose iteration transformations preserve foreground connectivity with possible deletion of residues. In fact we will show that, for any reductive shrinking algorithm whose iteration transformations preserve foreground connectivity with possible deletion of residues, the union of the supports of the algorithm's operators at any pixel p includes all the pixels in Ns{p). This follows from the following proposition:
• 54. 52 Proposition 3.9 Let m = 8. Letp be an arbitrary pixel and let q be any ^-neighbor of p. Then for all integers h>0 there exists an image Ih with 0{h) 1 '5 that has the following properties: 1. The set of 1 '5 of I^, is simply S-connected. 2. Ih is unchanged by every image transformation [O : R] that preserves foreground connectivity with possible deletion of residues in which O has radius at most h and O 's support at p does not include q. Proof. By symmetry we may assume that q is either the south or the south-east neighbor of p. We shall suppose first that q is the south neighbor of p. Evidently it suffices to prove the proposition for h > b. The following three diagrams of images are for the case h = b. For any given h > 5 vre consider analogous images with more I's; the northernmost, easternmost and southernmost I's in Images 1 and 2 must be at an 8-distance of h from p. In Images 1 and 2, p = 1. In the image Ih^ p = p* = 1. Note that in the image Ih the set of I's is simply 8-connected. 1 1 1 1 1 1 1 1 1 1 p p 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Image 1 Image 2 Let [O : i2] be any foreground connectivity preserving image transformation in which O has radius at most h and O's support at p does not include q. We need to show that Ih is unchanged by [O : i?]. Let PN and Ps be east-west 4-paths each of which consists of 2/i -f 1 pixels, where the central pixel of Pjv 'sh--2 pixels north of the northernmost 1 in Image 1, and the central pixel oi Ps IS h--2 pixels south of the southernmost 1 in the image. Let / be the image whose I's are the pixels in PN and Ps. Since [O : /?] satisfies FC2R, there are pixels pjq and ps in Pfj and P5, respectively, that are not deleted by [O : /?] in /. Let rjq be an endpoint pixel of P^ that is at least h pixels away from pjv, and let rs be an endpoint pixel of Ps that is at least h pixels away from ps- Let Q^ be an 8-path from
• 55. 53 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 P 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 The image Ih Tjv to the northernmost 1 of Image 1, and Qs an 8-path from rs to the southernmost 1 of Image 2, such that: (i) QN is not 8-adjacent to Qs] (ii) neither 8-path is 8-adjacent to any 1 in Image 1 other than the 1 that is its endpoint pixel; (iii) the intermediate pixels of QN and Qs are all at an 8-distance of at least h--1 from pN, ps and p. Consider the effect of [O : R] on the image /' whose I's are those in Image 1 together with the pixels in PN, QN, PS and Qs. Since the pixel values in the {2h -f 1) x (2h -f 1) neighuorhoods of pN and ps are the same in /' as in /, neither pN nor ps is deleted. Therefore p is not deleted (for otherwise [O : R] would violate FCl). As the pixel values in the {2h -|-1) x (2h -f 1) neighborhood of p are the same in I' as in Image 1, [O : i?] also does not delete p in Image 1. Since the support of O at p does not include the south neighbor of p, [O : R] also cannot delete p in the image shown in Image 2. Consequently, [O : R] deletes neither p nor p* in the image Ih. No other 1 can be deleted by [O : R] in this image without violating FCl by disconnecting p from p*. Hence the image Ih is unchanged by [O : i?], as required. To prove the Proposition in the case when q is the south-east neighbor, modify Images 1 and 2, and //i, by shifting all I's in the rows below p one pixel to the right. D Corollary 3.10 Let m = 8. Let A be any reductive shrinking algorithm each of whose iteration transformations preserves foreground connectivity with possible deletion of residues. Then the union of the supports of A '5 iteration operators at any pixel p includes all the pixels in the 3 x 3 neighborhood of p. Corollary 3.10 is not true if m = 4, as we show in Appendix A. As we saw at the beginning of Section 3, a 3 x 3 support suffices for a single-operator reductive shrinking algorithm. However, 3 x 3 does not suffice if the algorithm is also required to be completely parallel. Indeed, Rosenfeld showed [49] that even j x 3 and 3 X A; supports are not adequate. We will now give a completely parallel single-operator
• 56. 54 reductive shrinking algorithm for m = 8 whose operator has a 19-pixel support; we will then show (Theorem 3.12) that this support is the smallest possible for the operator of such an algorithm. Algorithm RH At each iteration apply the following reductive operator, in parallel, to all pixels. A pixel p=l is deleted if all of the following hold: a. Cs{p) = 1. b. One or both of the following conditions is satisfied: 1 . 1>2 = 0; 2. Ng{p) contains exactly one 1. c. p's neighborhood does not match any of the following: 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 O O p O O p O O O p O O l p O 0 0 0 0 0 0 0 0 0 0 0 0 0 Terminate when no I's are deleted at some iteration. We mentioned above that RH assumes m = 8. Conditions (a) and (b) are closely related to the classical parallel thinning algorithm in [50], but they delete only north border 8-simple pixels and endpoint pixels. Condition (c) preserves exactly one 1 in each two-pixel 8-component. Results in [50], or the Ronse tests [22, 48] presented in the first author's chapter on thinning in this volume, can be used to confirm that FCl and FC2 are satisfied by the algorithm's iteration transformation and hence also by the algorithm itself. (Since 8-residues are not deleted by the algorithm, FCl and FC2 are equivalent to FCIR and FC2R.) To prove that a completely parallel single-operator reductive image algorithm shrinks each simply m-connected m-component of the I's of every input image to an ?7i-residue, we only need to show that if G is a simply m-connected m-component of the I's of an image / and |G| > 2, then G must contain at least one pixel that is deletable by the algorithm's operator from /. For RH, this follows from the following proposition: Proposition 3.11 Let G be a simply ^-connected ^-component of the 's of an image I such that G > 2. Then G contains at least two pixels that satisfy both condition (a) and condition (6) of RH in I. Proof. If G has only one north border pixel in /, then G is a vertical line segment (i.e., the set of pixels of a north-south 4-path) and so has two endpoint pixels, both of which satisfy conditions (a) and (b) of RH in /. Otherwise, let p and q be two north border pixels of G in / such that the shortest 8-path from pio q within G is as long as possible, say of length L Let X be either one of p and g, and let y be the other. We will show there is a pixel x* such that: 1. Either x* = .T, or x and x* are respectively the northern and southern endpoint pixels of a vertical line segment in G.
• 57. 55 2. X* satisfies conditions (a) and (b) of RH in /. This will prove the proposition, since condition 1 and the fact that p and q are north border pixels imply that p* ^ q*. If X is 8-simple in / then x* = x satisfies conditions 1 and 2, and we are done. Now suppose X is not 8-simple in /. Then since G is simply 8-connected, G — {x} is not 8- connected (e.g., by the 8-case of Proposition 7 of [49, p. 151]). Let G* be an 8-component oiG — {x} that does not contain y. Let /' be the image obtained from / by deleting x, and let r be a north border pixel of G* in /'. Any 8-path in G from r to y must pass through x hence its length is greater than i. Thus our definition of p and q implies that r cannot be a north border pixel in /. As r is a north border pixel in /' but not in /, r must be the south neighbor of x. Thus G* can have only one north border pixel in /', and so must be a vertical line segment if it contains more than one pixel; moreover, x is the north neighbor of the northernmost pixel of G* (which is the unique north border pixel of G* in /'). Let x* be the southernmost pixel of G*. Then x* satisfies conditions 1 and 2, as required. • The support of the operator used in RH consists of 19 pixels. We shall now show that in the case m = 8 this support is in fact the smallest possible for the operator of a completely parallel single-operator reductive shrinking algorithm. Theorem 3.12 Let m = 8. Let A he any single-operator completely parallel reductive shrinking algorithm. Then the support of A's operator at any pixel p contains at least 19 pixels. If it contains just 19 pixels, then it consists of the nine pixels in the 3 x 3 neighborhood ofp, together with the set< s> shown below or a rotation of this set around p by a multiple of 90°, or a reflection of this set in a horizontal, vertical, or diagonal line through p. s s s s s s . . . s s . p . s s . . . . Proof. Let O be A's operator. We know from Corollary 3.7 that A's iteration trans- formation [O : E] must satisfy FCl and FC2R. We know from Corollary 3.10 that O's support at any pixel p includes all nine pixels in the 3 x 3 neighborhood of p. Let Rp denote the part of the support of O at p that is outside the 3 x 3 neighborhood of p. We will prove that the support at p must contain at least 19 pixels by showing that Rp contains at least 10 pixels. We will also prove that if Rp contains just 10 pixels, then it is as specified above. Consider the application of [O : E] to an image with just two I's, which are 4-adjacent to each other. Since [O : E] satisfies FC2R but A must reduce the two-pixel component of the I's to an 8-residue, just one of the I's is deleted. We may assume that if the I's are east-west neighbors then only the western 1 is deleted, and that if they are north-south neighbors then only the northern 1 is deleted. (We can always interpret "north" in such a way that this is true.)
• 58. 56 For each pixel p, let W{p) denote the set of 8-neighbors of p such that p is not deleted by the application of [O : E] to any image whose set of I's consists just of p and one pixel in W{p). The assumption made in the previous paragraph implies that the western and northern 4-neighbors of p lie in W{p) but the eastern and southern 4-neighbors do not. Next, consider the application of [O : E] to an image with just two I's, which are northeast-southwest 8-neighbors of each other. Again, one of the I's is not deleted. Let O be a J X ib operator, and let O* be the k x j operator obtained by "reflecting O in the northwest-southeast line through the central pixel of the neighborhood". Then either O or O* leaves the southwestern 1 undeleted. We may assume O has this property, since O's support satisfies the conclusion of the theorem if 0*'s support does. This assumption implies that the northeastern 8-neighbor of p lies in W(p) but the southwestern 8-neighbor does not. Now consider the application of [O : E] to an image with just two I's, which are northwest-southeast 8-neighbors of each other. We distinguish two cases: (a) the south- eastern 1 is not deleted; (b) the northwestern 1 is not deleted. The following diagrams show the set W(p) in each case. Pixels in W(p) are labeled w. w w w .WW w p . w p . w Case (a) Case (b) Let r be the radius of O and let p be an arbitrary pixel. The support of O at p is contained in the (2r -|-1) x (2r -|-1) neighborhood of p. Consider all 8-paths of length at least r (i.e., 8-paths consisting of at least r -- pixels) such that: (i) p is the first pixel on the path. (ii) The second pixel on the path lies in W{p). (iii) The 8-distance from p is strictly increasing along the path. Conditions (i) and (iii) imply that the r -|- P' pixel on the path lies on the border of the (2r -f 1) X (2r -I-1) neighborhood of p. We claim that every such 8-path must contain a pixel in Rp. For suppose otherwise. Let c and d be two pixels whose (2r H-1) x (2r -|-1) neighborhoods are disjoint and not 4-adjacent to each other. By hypothesis there exist 8-paths Pc and Pd of length > r that satisfy (i), (ii) and (iii) for p = c and p = d respectively, and which do not meet Re and Rd. Let Qcd be a simple 8-arc whose endpoint pixels are the r -|-1'* pixel of Pc and the r -- P' pixel of Pj, such that all intermediate pixels of Qcd (if there are any) lie outside the (2r -|-1) x (2r -|-1) neighborhoods of c and d. It is not hard to see that such a simple 8-arc must exist, because of our choice of c and d. Now consider application of [O : E] to the image whose set of I's consists of the first r pixels on each of Pc and Pj, and the pixels on Qcd- By our definitions of Pc? Pd and r, the only I's of this image that lie in the support of O at c or at d are c and d themselves, and the two I's in W{c) and W{d). So, by the definition of W{p)^ neither c nor d is deleted by this application of [O : E]. No other 1 is deleted, for otherwise FCl would be violated.
• 59. 57 Hence this image is unchanged by [O : E], contrary to the hypothesis that A reduces every simply 8-connected component of I's to an 8-residue. This contradiction justifies our claim. Note that we must therefore have r > 1, because the claim would evidently be false if r < 1. Suppose case (a) applies. There exist 10 8-paths of length > r satisfying conditions (i), (ii), and (iii) such that no two of the paths have a pixel in common outside the 3 x 3 neighborhood of p. Indeed, Figure 4 shows 10 such 8-paths, whose last six pixels are shown in boldface roman type. (Figure 4 assumes r < 7, but the 8-paths can be extended for larger values of r.) Each of these paths contains a pixel in Rp, and no two of these pixels can be the same; this shows that in case (a) Rp contains at least 10 pixels. g f X e d d c g g f X e d d c c g g f X e d d c c g g f X e d d c c ggfxeddcc hhhhygfedcuhbhb hhhhhht(;ti;ti;bbbbbb i i i i i i w p . a a a a a a i i i i z } . . . a a a a a J J j i i j j j j Figure 4. Case (a) of Theorem 3.12 (r < 7). The last six pixels on the 10 paths used to show that Rp contains at least 10 pixels are: a a a a a a ; b b b b b b ; . . . ; j j j j j j - The last six pixels on the 10 additional paths Pq are: SL a a a a a]h u b b b b] c u c c c c] dddddd]exxTxx;fxxxxx]gygggg]hyhhhh;iziiii]}zjjjj. Suppose Rp contains just 10 pixels. Then every pixel in Rp lies on one of the 10 paths. Figure 4 shows that if q is any one of the 10 pixels labeled s in the figure accompanying the statement of the theorem, then there is an 8-path Pq of length > r satisfying (i), (ii) and (iii) that contains 9, such that q is the only pixel on Pq outside the 3x3 neighborhood of p that lies on any of the 10 original paths (so that q is the only pixel on Pq that can lie in Rp). Since each of the paths P, must contain a pixel in Rp, it follows that the 10 pixels labeled s are all in Rp. This completes the proof in case (a). Similarly, as illustrated in Figure 5, in case (b) we can find 13 8-paths of length r that satisfy (i), (ii) and (iii) such that no two of the paths have a pixel in common outside the 3 x 3 neighborhood of p. So in case (b) the set Rp contains at least 13 pixels and O's
• 60. 58 support contains at least 22 pixels. f e d c f e d c f e d c f e d c f e d c f e d c g g g g g g • ^"^ b b b b b b h h h h h h t i ; p . a a a a a a i i i i i i . . u ; n n n n n n j k m j k m j k m j k m j k m j k m Figure 5. Case (b) of Theorem 3.12 (r < 7). The last six pixels on the 13 paths used to show that Rj, contains at least 13 pixels are: a a a a a a ; b b b b b b ; . . . ; n n n n n n . The single-operator hypothesis in Theorem 3.12 is necessary. In fact, there are 2- subiteration reductive shrinking algorithms for m = 8 that use only 3 x 3 operators, as shown by the following example: At the i*** iteration of the algorithm, if i is odd, delete p if its 8-neighborhood matches one of the following: 1 0 0 0 p 0 0 0 0 0 1 0 0 p 0 0 0 0 0 0 1 0 p 0 0 0 0 0 0 0 0 p 1 0 0 0 If i is even, delete p if it is an 8-simple north border 1 that is 8-adjacent to at least two I's, or if its 8-neighborhood matches one of the following: 0 0 0 1 p 0 0 0 0 0 0 0 0 p 0 1 0 0 0 0 0 0 p 0 0 1 0 0 0 0 0 p 0 0 0 1 Terminate after the i^^ iteration if i > 2 and no 1 was deleted at the i — 1*' and i'^ iterations. It is readily confirmed (e.g., using the Ronse tests mentioned above in connection with RH) that this algorithm preserves foreground connectivity for m = 8. (In fact, it also
• 61. 59 1 1 1 1 1 1 l a 1 c 1 p q =^ 1 p q 1 6 I d 1 1 1 1 1 1 (a) (b) Figure 6. In (a) p = q = a = b = 1 and the m-residue {p} is enclosed by a closed curve. In (h) p = q = c = d = I and the image has been transformed so that the m-residue (which is now {^}) is no longer enclosed by the closed curve. preserves background connectivity.) We know from Proposition 3.11 that in every image each simply 8-connected 8-component G of the Ts contains at least two I's which satisfy conditions (a) and (b) of RH, unless G is an 8-residue. Since every 1 that satisfies (a) and (b) also satisfies the deletion condition of the operator used at one of the two subiterations, the algorithm shrinks each simply 8-connected 8-component of the I's of every input image to an 8-residue. Analogs for m = 4 of the results in this section are given in Appendix A. 4. REDUCTIVE-AUGMENTATIVE SHRINKING As we mentioned earlier, it is an open question whether there exists a universal reductive shrinking algorithm of finite radius. However, all of the reductive-augmentative shrinking algorithms presented below are universal shrinking algorithms (of finite radius). A reductive-augmentative shrinking algorithm can shrink an m-component of I's that is not simply m-connected to an m-residue by shrinking the hole(s) in the component. For example, a closed curve surrounding a hole can be deformed into smaller and smaller closed curves and finally into an m-residue. However, in reductive-augmentative shrinking the m-residue resulting from a particular m-component of the I's need not be a pixel of the original m-component. In Section 4.3 we will show how an m-residue can be identified as arising from a certain m-component of the I's of the input image by attaching labels to the pixels. All known universal shrinking algorithms delete m-residues, and there is reason to believe that deletion of m-residues is unavoidable. Suppose, for example, that m = 8. Consider an image whose set of I's consists of a simple closed 8-curve surrounding an 8-residue p, as illustrated in Figure 6a. If a shrinking algorithm does not delete p, then how can it reduce the surrounding closed 8-curve to an 8-residue without merging it with p? The algorithm might break the curve at some pixel, but then it would probably split 8-components of the I's of other images. Alternatively, the algorithm might transform Figure 6a to Figure 6b by changing a and h from 1 to 0 and c and d from 0 to 1. This transformation could be performed by a 7 x 7 operator, but it does not handle all possible ways in which 8-residues might be enclosed by closed 8-curves.
• 62. 60 4.1. Example of a Reductive-Augmentative Shrinking Algorithm. We now present Levialdi's single-operator completely parallel universal shrinking algo- rithm for m = 8 [38], which is easy to implement on a mesh computer. A very similar algorithm which assumes m = 4 was given somewhat earlier by Beyer [9], but never pub- lished. (An informal discussion of Beyer's algorithm, which can be viewed as a "dual" of Levialdi's algorithm, can be found in Minsky and Papert's book on perceptrons [44, pp. 147 - 8].) Levialdi's algorithm uses a reductive-augmentative iteration operator whose support at a pixel p consists of just four pixels: p and its south, west, and southwest neigh- bors. It reduces each 8-component of the Ts to an 8-residue in an asymmetric way. The northeastern corner of each 8-component's circumscribing upright rectangle remains at the same position from iteration to iteration, while the rectangle itself shrinks, until the 8-component is reduced to an 8-residue in that position. Algorithm LEV At each iteration apply the following reductive-augmentative operator, in parallel, to all pixels. a. A pixel p = 1 is changed to 0 if pe = Pr = Ps = 0. b. A pixel p = 0 is changed to 1 if pe = ps = 1. Terminate when all I's in the image are 8-residues. LEV'S iteration operator will be denoted by OLEV- The support of OLEV at a pixel p is {p}U < 5 > in the following diagram: s p . s s . Augmentation condition (b) allows holes to be filled. Deletion condition (a) tends to delete I's along a 135° line which moves in the northeast direction. (During execution of LEV, both reduction and augmentation tend to occur in the northeast direction.) An example of LEV's operation is given in Figure 7, where LEV terminates in five iterations. A proof of the correctness of LEV was given in [51]. We will give another proof of this below. Before considering the proof, note that it is not immediately obvious how foreground connectivity preservation should be defined for a reductive-augmentative image algorithm such as LEV. Consider, for example, what happens when LEV's iteration transformation [OLEV - 2] is applied to the image a q b where a, b and c are I's but all other pixels, including 9, are O's. All of the I's are deleted and q is changed to a 1. Thus the 8-components {a, 6} and {c} of I's are completely deleted, and a new foreground 8-component {q} is created. In what sense can we say
• 63. 61 1 1 1 1 1 1 1 • 1 1 • 1 • 1 1 1 . 0 1 . • 1 • o 1 o 1 o o 1 1 • o 1 • o o 1 o • o 1 • o • o o • 0 0 • • O O • 0 0 - 0 0 Figure 7. Example of LEV's operation. Image 0 is the input image, and for i = 1 - 5 image i is the image after i iterations. In images 1 - 5 , the -'s are O's which were I's in the input image, and the o's are O's which were O's in the input image but were changed to I's at some iteration. that foreground connectivity has been "preserved"? Of course, the deletion of {c} is appropriate since it is an 8-residue; but we need to establish a basis on which we can say that {9} is the successor component to {a, 6}. In the following sections we will give a solution to this problem, and also give a method that can be used to verify the correctness of many reductive-augmentative shrinking algorithms. To illustrate the method, we will use it to verify the correctness of LEV. 4.2. Oneness Sets and Augmentation Sets. We now define a concept which will be used to relate I's added by a reductive- augmentative operator to the components of I's which existed previously. For any operator O and pixel p, a set of pixels W is called a oneness set of p under O if W has the following two properties: 1. O has value 1 at p in the image whose set of I's is W. 2. O has value 0 at p in every image whose set of I's is a proper subset of W. Equivalently, a oneness set of p under O is a minimal set of pixels W that has property 1. Every oneness set of p under O is a subset of the support of O at p (and must be a proper subset of the support unless it is the only oneness set of p under O). For an image transformation [O : R] and pixel p, a set of pixels W is called a oneness set of p under [O : R] if one of the following is true: 1. p ^ /? and ly = {p}. 2. p £ R and VK is a oneness set of p under O.
• 64. 62 It follows that ly is a oneness set of p under O if and only if VT is a oneness set of p under ( 0 : E ] . A oneness set is said to be active in an image / if all its pixels are I's of I. A oneness set of p is called an augmentation set of p if it does not contain p. (Thus O is a reductive operator if and only if there are no augmentation sets of p under O.) The oneness sets of p under LEV's iteration operator OLEV are {pe^Ps}, {p^Pe}? {p^Ps} and {p^pr}. Only the first of these sets is an augmentation set. Recall that the "translate right by k units" operator gives each pixel the value of the pixel that is A; units to its left. The unique oneness set of p under this operator consists of the pixel that is k units to the left of p. This is an augmentation set. As another example, consider the well-known reductive-augmentative operator used in Conway's game of Life. This operator's value at p is 1 if and only if p is a 1 and either two or three of its 8-neighbors are I's, or p is a 0 and exactly three of its 8-neighbors are Ts. A pixel p has exactly C(9,3) oneness sets under this operator, namely the subsets of Ns{p) that consist of just three pixels. C(8,3) of the oneness sets are subsets of Ng{p) and are augmentation sets. Oneness and augmentation sets have the following fundamental properties: • Suppose O has value 1 at p in an image /. Then at least one oneness set of p under O is active in /. • Suppose p is a 0 of / that is changed to 1 by O in /. Then at least one augmentation set of p under O is active in 7. This is because in both cases the set of all 1 's of 7 has property 1 in the above definition of a oneness set of p under O, and must therefore contain a minimal subset with property 1. The minimal subset is a oneness / augmentation set of p under O that is active in 7. However, even if all of the oneness sets of p under O are active in 7, O may still have value 0 at p in 7. For example, consider the reductive-augmentative operator Ox which has value 1 at p in 7 if and only if one of the following conditions holds in 7: • All eight of the 8-neighbors of p are I's. • One of the"corner" 8-neighbors pi,P3,P5 and pr of p is a 1 but the other seven 8-neighbors of p are O's. The oneness sets of p under this operator are the sets {p,}, i = 1,3,5 or 7. Even if all four of these oneness sets are active in 7, Ox may have value 0 at p in 7. 4.3. ^-Images and ^-Image Transformations. Regular Operators. Reductive- Augmentative Image Algorithms that Preserve Foreground Connectivity with Allowance for Deleted Residues. In this section we give a definition of foreground connectivity preservation with al- lowance for deleted residues for reductive-augmentative image algorithms. The definition (Definition 4.1 below) will be based on assignments of component labels to the I's of images. The concept of labeling is introduced only to facilitate the statement of this definition. Our notion of an image algorithm remains the same as before, and does not involve labeling of I's. Moreover, we will soon state a number of local tests that do
• 65. 63 not involve component labels, but which are sufficient conditions for an image algorithm to preserve foreground connectivity with allowance for deleted residues. A preliminary version of some aspects of this work appeared in [24]. To deal with possible deletion of m-residues, we will also equip an image with a set of labels of previously deleted m-residues. This is the "labeled analog" of the deleted residue set of an r-image (as defined in Section 3.1). It is a set of labels rather than a set of labeled pixels because the same pixel may be deleted as an m-residue more than once during execution of a reductive-augmentative image algorithm such as LEV—a pixel which is deleted as an m-residue might be changed back to a 1 at some subsequent iteration and later deleted as an m-residue again. A labeled image with residue labels^ or i-image, is a triple i = (/, / , L) where 1. / is an image. 2. / is a function whose domain is the set of I's of / . 3. Z is a finite set. / is called the underlying image of i, and / is called the labeling function of i. If p is any 1 of / , then f{p) is called the label of p in i. Each element of L is called a deleted residue label of L. Each element of {/(/?) | p is a 1 of / } U L is called a label that occurs in i. Vs and O's of I are also referred to as I's and O's of t. A consistently labeled ^-image is an ^-image (I,f,L) such that: 1. For all Vsp and q of / , f{p) = f{q) if and only if p and q lie in the same m-component of the I's of/. 2. For all I's p of / , f{p) ^ L. We emphasize that this is just a notion used in evaluating algorithm correctness. Labelings that satisfy conditions 1 and 2 are not available to shrinking algorithms (or other image algorithms) as we have defined them. An i'image transformation is a function which maps each ^-image to an ^-image. An £- image transformation T is said to preserve foreground connectivity if, for every consistently labeled ^-image i, T{i) is also a consistently labeled ^-image, and the set of labels that occur in T{i) is the same as the set of labels that occur in t. In other words, an £- image transformation T preserves foreground connectivity if and only if the following four conditions hold for all consistently labeled ^-images t: FCIL. I's of T{i) having the same label belong to the same m-component of the I's of T{i). FC2L. Every label that occurs in c also occurs in T{i). FC3L. I's of T{i) that have distinct labels do not belong to the same m-component of l ' s o f r ( 0 . FC4L. Every label that occurs in T{L) also occurs in t (i.e., no "new" label is generated).
• 66. 64 When FCA:L holds for an ^-image transformation T and an ^-image t, we say that T satisfies ¥CkL for the input i-image c. We say that the ^-image transformation T satisfies FCA;L if T satisfies FCA;L for every consistently labeled input ^-image i. Let O be an operator and let il be a set of pixels. The l-image transformation associated with the image transformation [O : i2], denoted by [O : RY, will now be defined. [O : RY{{IJ,L)) = {rjL*) where /* = [O : R](I), L* is the union of L with the set of all m-residues in I that are deleted by [O : /?], and /* is defined as follows. Let p be any 1 of /* and let Wp be the union of the oneness sets of p under [O : R that are active in /. Then if /[H^p] consists of just one label, we define /*(p) to be the unique label in /[Wp]. But if /[Wp] does not consist of just one label, then we define f*[p) = fW^ (i.e., p is given the "new" label {^1,^2? • • • >^)b}j where the ^,'s are all the labels in /[VTp]). Notice that if p is a 1 of /* and p ^ R, then p must also be a 1 of / and, since {p} is the unique oneness set of p under [O : il], f*{p) = /(p). We say that [O : R] satisfies FCfcL if [O : RY does so. We say that [O : R] preserves foreground connectivity with allowance for deleted residues if [O : RY preserves foreground connectivity. Assuming /? ^ 0, it is readily confirmed that the following is a necessary and sufficient condition on O for [O : R] to satisfy FC4L: • Whenever O has value 1 at p in an image /, the oneness sets of p under O that are active in / all lie within a single m-component of the I's of /. An operator O is said to be regular if it satisfies this condition. Note that if O is regular, then it follows from the condition 1 in the definition of a oneness set of p under O that every such set must be 7n-connected. Three examples of regular reductive-augmentative operators are: • LEV'S iteration operator OLEV (assuming m = 8). • The "translate right by k units" operator. • The operator Ox defined in Section 4.2. The operator used in Conway's game of Life is not regular, since some of its oneness sets are not 8-connected. Note that our definition of a regular operator does not involve the concept of an i- image. For any regular operator O we now state conditions, which also do not involve the concept of an £-image, that are necessary and sufficient for [O : R] to satisfy FCIL, FC2L and FC3L. However, these are conditions on the image transformation [O : /?], whereas regularity is a condition on the operator alone. Let O be a regular operator. Then: • [O : /?] satisfies FClL if and only if, for all images /, two Ts of [O : R]{I) belong to the same m-component of the I's of [O : R]{I) whenever their active oneness sets under [O : i?] in / lie in the same m-component of the I's of /. • [O : i?] satisfies FC2L if and only if, for all images /, whenever C is an m-component of the I's of / that is not an m-residue, there is a 1 of [O : R]{I) one of whose oneness sets under [O : R] is contained in C.
• 67. 65 • [O : /2] satisfies FC3L if and only if, for all images /, whenever two Vs of [O : R]{I) belong to the same m-component of the I's of [O : R]{I), their active oneness sets under [O : R] in I lie in the same m-component of the I's of /. Let A be any image algorithm that terminates for all input images. For all positive integers i, let [O, : Ri] be the i*"^ iteration transformation of A. The i-image transfor- mation associated with A, denoted by A', is defined as follows. Let t = (I, f, L) be any ^-image, and let j be the number of iterations of A that occur before algorithm termina- tion when A is executed with / as the input image. Then A'(A) = [Oj : RJY O [OJ_I : An image algorithm is said to be regular if each of its iteration operators is regular. Definition 4.1 For A; = 1 - 4, an image algorithm A is said to satisfy FCA:L if A terminates for all input images and A'5 i-image transformation A' satisfies YCkL. A regular image algorithm A is said to preserve foreground connectivity with allowance for deleted residues if A terminates for all input images and A' preserves foreground connectivity {or, equivalently, if A satisfies all of the conditions FCA;L). It is not difficult to verify that when A is a regular reductive image algorithm, the definition of foreground connectivity preservation with allowance for deleted residues given here is consistent with Definition 3.1. 4.4. Condition L. Verification of Foreground Connectivity Preservation. If A is any image algorithm that terminates for all input images, then an important sufficient condition for A to preserve foreground connectivity with allowance for deleted residues is that each of A's iteration transformations should do so. In the next three sec- tions we will give local tests which can be used to verify that A's iteration transformations have this property. Our tests are applicable to iteration transformations [O : R] where the operator O satisfies the following condition: L. The operator O is regular, and every augmentation set of a pixel under O is m-adjacent to that pixel. Condition L is evidently satisfied by all regular reductive operators (since they have no augmentation sets), and when m = 8 it is also satisfied by all regular 3 x 3 operators. (In particular, LEV's iteration operator OLEV satisfies L for m = 8.) L is equivalent to the condition that every oneness set of a pixel under the operator must contain or be m-adjacent to that pixel. Thus if an operator O satisfies L then, for any image / and pixel p, every active oneness set of p under O in / lies in the same m-component of the I's of / as p. It follows that, for any such operator O, when [O : RY is applied to any consistently labeled ^-image i all I's of ^ that are not deleted have the same label in [O : i?]'(^) as they had in i. For each of the conditions FCIL, FC2L and FC3L, we will give a local test which is sufficient to insure that an image transformation [O : R] satisfies that condition, provided that O satisfies condition L. It is not necessary to give such a test for FC4L, since [O : R] satisfies FC4L whenever O is regular. An important property of our local tests for FCA;L is that they do not involve the concepts of £-image and pixel label.
• 68. 66 We first define a term which will be used in the statements of the local tests for FCIL and FC2L. Definition 4.2 Let p be a I of an image I, O an operator that satisfies condition h, and R a set of pixels. A pixel p* is said to he m-contiguous to p under application of [O : I{ to / ifp* is m-adjacent to p and satisfies one of the following conditions: • p* is a 1 in I that is not deleted by [O : R] from I. • p* is a 0 in I that is changed to 1 by the application of [O : R] to I, and one of the active augmentation sets of p* under O in I contains p. Note that if p* is m-contiguous to p under application of [O : R] to /, then p* must be a 1 of [O : R](I). Moreover, for every consistently labeled ^-image L whose underlying image is /, the label of p* in [O : RY{i) is the same as the label of p in t. To illustrate this definition, suppose m = 8 and [O : R] is LEV's iteration transforma- tion, so that O = OLEV and R is the set E of all pixels. Let p be a 1 of an image /, and let the neighbors of p be named as in the following diagram: V W X b p y c b z If I/; is a 1 of [OLEV - S](^) then w is 8-contiguous to p under application of [OLEV : S] to /. For in that case if i/; is a 0 of / then w^s unique active augmentation set in / must be {v,p}, which contains p. By a symmetrical argument, if j/ is a 1 of [OLEV : 5]](/) then y is 8-contiguous to p under application of [OLEV ' S] to /. But it is readily confirmed that each of the other six 8-neighbors of p will only be 8-contiguous to p under application of [OLEV : S] to / if it is a 1 both of / and of [OLEV : S](-^)- For example, if x is a 0 of / then x cannot be 8-contiguous to p under application of [OLEV '• S] to I—if x is changed to 1 by application of [OLEV : U] to / (which would happen if w and y were I's of /) then the unique active augmentation set of X under OLEV in / is {w^y}^ and this set does not contain p. 4.5. FCIL Verification. We now state our local test for FCIL. FCIL Local Test: Both of the following conditions hold for every image /: 1. If p is a 1 of / that is deleted by [O : R] from /, then every pair of m-neighbors of p that are m-contiguous to p under application of [O : R] to / are joined by an m-path of I's of [O : R](I). 2. If p and q are two m-adjacent I's of / both of which are deleted by [O : R] from /, and p* is an m-neighbor of p that is m-contiguous to p under application of [O : R] to /, then there is an m-neighbor q* of q that is m-contiguous to q under application of [O : R] to /, such that p* and q* are joined by an m-path of I's of [O : R]{I).
• 69. 67 Note that condition 2 holds trivially if p* is m-contiguous to q under application of [O : /I] to /. (For in that case the m-path of length 0 consisting of just the pixel p* is an m-path of I's of [O : /?](/) from p* to an m-neighbor of q that is m-contiguous to q,) Proposition 4.3 Let O he an operator that satisfies condition L. Let [O : R] be an image transformation that satisfies the FCIL Local Test. Then [O : R] satisfies FCIL. Proof. Suppose the application of [O : Rf to a consistently labeled ^-image t = (/, /, L) violates FCIL. Consider the set of m-paths P with the following properties: (1) The two endpoint pixels of P are I's of [O : R](I) that belong to different m-components of the I's of [O : i?](/); (2) the intermediate pixels of P are I's of /; (3) each endpoint pixel of P is 771-contiguous to its neighbor on P under application of [O : R] to /. An m-path P satisfying (1 - 3) exists. To see this, first observe that, since FCIL is violated by the application of [O : RY to t, there exist a pair of pixels u and v which belong to different m-components of the I's of [O : RY{t) but have the same label / in [O : RYU)- For z = u or v, if z is a 1 in / then let z* = z, and if z is a 0 in / then let z* be an m-neighbor of z that lies in an active augmentation set of z under O in /. In the second case z* exists since O satisfies condition L. In both cases z* is a 1 of / that is labeled / in ^ (in the first case this follows from condition L). As t is consistently labeled, the I's labeled I m t constitute an m-component of the I's of /. Hence there is an m-path P* of I's of / from u* to v*. U u and v are I's in / (so that u* = u and v* = v), then P = P* is the desired path satisfying ( 1 - 3 ) . If either u or v is (or both are) 0 in 7, we obtain P by adjoining u to the u* end of P* if u is a 0 in 7, and adjoining v to the v* end of P* if t; is a 0 in 7. Let Po be a shortest m-path satisfying (1 - 3). By (1), |Po| > 3. Every intermediate pixel of Po must be a 0 in [O : P](7). For if any of these pixels were a 1 in [O : P](7) then a shorter m-path satisfying ( 1 - 3 ) would exist between it and an endpoint pixel of Po not belonging to the same m-component of the I's of [O : P](7). Let a,b and c be the first three pixels on PQ. If |Po| = 3, so that Po = (a,6, c), then it follows from the first condition of the FCIL Local Test, with p = 6, that there is an m-path of I's of [O : 72](7) from a to c, contradicting property (1) of our set of paths. Hence |Po| > 3. Now each of b and c is a 1 of 7 that is deleted by [O : R] from 7. By the second condition of the FCIL Local Test (applied with p = b^ p* = a and q = c) there is an m-path of I's of [O : R]{I) from a to a pixel c*, where c* is an m-neighbor of c that is m-contiguous to c under application of [O : R] to 7. Hence the m-path obtained by replacing the first two pixels (i.e., a and b) in in Po with c* is a shorter m-path than PQ that satisfies (1 - 3), contradiction. D To illustrate the use of the FCIL Local Test, we apply it in the case where [O : R] is LEV'S iteration transformation. Here m = 8. Suppose p is a 1 of an image 7 that is deleted from 7 by [OLEV ' S]. Then c and both 6's are O's of 7 in the following diagram: V W X b p y c b z
• 70. 68 The 6's and c are not 8-contiguous to p under application of [OLEV '• S] to /: the 6's are not changed to 1 (as c is 0 in / ) , and even if c is changed to 1 its active augmentation set would not contain p. Suppose the first condition of the FCIL Local Test fails to hold. Then two of u, it;, x, y and z must be 8-contiguous to p under application of [OLEV • ^] to / (which implies they are I's of [OLEV : S](^))j but they must not be joined by an 8-path of Ts of [OLEV : 5]](/). But if v is a 1 in [OLEV : S](/) then w is also a 1 in [OLEV '• 5]](/), and if z is a 1 in [OLEV : S](7) then y is also a 1 in [OLEV : S](/). (For if v is a 1 in [OLEV : S](/) then V must also be a 1 in /, since the 6's are O's of /; and since both p and v are I's in /, w is also a 1 in [OLEV - 5]](/). The assertion regarding z and y is similarly valid.) This is inconsistent with the claim in the previous paragraph. Hence the first condition of the FCIL Local Test must hold. To verify the second condition of the FCIL Local Test, suppose ^ is an 8-neighbor of p which, like p, is a 1 of 7 that is deleted from / by [OLEV - S]. Since ^ is a 1 of 7, g cannot be c or one of the 6's in the above diagram. Since p is a 1 of 7, g also cannot be w, y or X in the above diagram (otherwise it would not be deleted), so q must he v or z. Let p* be an 8-neighbor of p that is 8-contiguous to p under application of [OLEV : S ] to 7. The following diagrams show four possibilities for q and p*: q p* q a p* q a q a h p h p h p p* b p a* c b c b c b c b p* Since ^ is a 1 of 7, in the first case (shown in the diagram on the left) p* is a 1 of [OLEV - S](7) and is 8-contiguous to q under application of [OLEV '- S] to 7. So in this case condition 2 of the FCIL Local Test holds with q* = p*. In the other three cases, a is 8-contiguous to q under application of [OLEV ' S] to 7. So in the second and third cases condition 2 of the FCIL Local Test holds with q* — a. In the fourth case p* must be a 1 of 7 to be 8-contiguous to p under application of [OLEV '- ^ to 7. Hence a* is also a 1 in [OLEV '- ^1(7) and so, as in the second and third cases, condition 2 of the FCIL Local Test holds with q* — a. There are four other possibilities for q and p*, obtainable from the four shown above by reflecting in the southwest-northeast diagonal through p. Symmetrical arguments apply to these cases. Thus LEV's iteration transformation satisfies the FCIL Local Test. 4.6. FC2L Verification. Our local test for FC2L is considerably simpler than the one for FClL: FC2L Local Test: For every image 7, whenever a 1, p, which is not an m-residue, is deleted by [O : 7?] from 7, there exists an m-neighbor of p that is m-contiguous to p under application of [O : 7?] to 7. The rationale for this test is similar to that for the C2-Object Preservation proof in [20]. Suppose O satisfies condition L and [O : i?] satisfies the FC2L Local Test. To see that [O : S satisfies FC2L, let i = (7, /, L) be any consistently labeled ^-image, and let p be any 1 of 7 that is not an m-residue in 7. If p is not deleted by [O : Fi from 7 then, since O satisfies condition L, p has the same label in [O : S^{i) as in L. If p is deleted by
• 71. 69 [O : R] from /, then since the FC2L Local Test is satisfied there is an m-neighbor p* of p that is m-contiguous to p under application of [O : R] to /; p* will have the same label in [O : RY{t) as p has in t. Now we apply the FC2L Local Test to LEV's iteration transformation. Suppose p is a 1 of an image / that is not an 8-residue but is deleted from / by LEV's iteration transformation. Then p's 8-neighborhood in / is as shown in the following diagram, where at least one of a, a*, 6, h* and c is a 1. a b c 0 p 6* 0 0 a* If a (a*) is a 1 of /, then b (6*) is either a 1 of / that is not deleted by LEV's iteration transformation, or a 0 of / that is changed to 1 by LEV's iteration transformation. In the latter case the unique active augmentation set of b (6*) in I under OLEV contains p. Thus in both cases b (6*) is 8-contiguous to p under application of LEV's iteration transformation to /, and the FC2L Local Test is satisfied. If 6, 6* or c is a 1 of /, then that pixel is not deleted from / by LEV's iteration transformation, and is therefore 8-contiguous to p under application of LEV's iteration transformation to /. Again, the FC2L Local Test is satisfied. 4.7. FC3L Verification. FC3L Local Test: For every image /, and any two m-adjacent I's ^ and q* of [O : R]{I), the active oneness sets of q and q* under [O : R] in I lie in the same m-component of the I's of /. Let O be any operator that satisfies condition L. If [O : R] satisfies the FC3L Local Test then, for any consistently labeled ^-image A, m-adjacent I's of [O : RY{C) always have the same label. This implies that [O : R] satisfies FC3L. If O satisfies condition L, then the FC3L Local Test cannot be violated in the case where the m-adjacent pixels q and q* are I's of / that are not deleted by [O : R] from /. So in stating the test we may stipulate that g be a 0 of / that is changed to 1 by application of [O : R] to 7. Thus if O satisfies L then [O : R] satisfies the FC3L Local Test if and only if both of the following conditions hold for every image I: 1. If ^ is any 0 of 7 that is changed to 1 by application of [O : R] to 7, then every 1 of 7 that is m-adjacent to q and not deleted from 7 by [O : R] lies in the same m-component of the I's of 7 as the active augmentation sets of q under O in 7. 2. If q and q* are any two m-adjacent O's of 7 that are changed to I's by application of [O : R] to 7, then the active augmentation sets of q and q* under O in 7 lie in the same m-component of the I's of 7. We will refer to these two conditions as the first and second conditions of the FC3L Local Test. Now we apply the FC3L Local Test to LEV's iteration transformation. To verify the first condition of the FC3L Local Test, suppose 9 is a 0 of an image 7 which is changed to 1 by LEV's iteration transformation. The following diagram shows 9's 8-neighborhood
• 72. 70 in /. The two I's to the south and west of q constitute ^'s unique active augmentation set in / under OLEV- b a 1 q b 1 Here the pixels at blank positions could be I's or O's. If the first condition of the FC3L Local Test fails, then there is an 8-neighbor p of q such that: (1) p is a 1 of /; (2) p is not deleted from / by LEV's iteration transformation; and (3) p does not lie in the same 8-component of the I's of / as ^'s active augmentation set under OLEV in I- It follows from (3) that p is the pixel a in the diagram, and that both 6's are O's of /. But then p is deleted from / by LEV's iteration transformation, contrary to (2). Thus the first condition of the FC3L Local Test is satisfied. To verify the second condition of the FC3L Local Test, let q and q* be two 8-adjacent O's of / that are changed to I's by LEV's iteration transformation. In the following diagram, < <f > is the active augmentation set of g in / under OLEV '• a b c d q b f e d a f It follows that the (f's are I's in /, so that q* ^ <d> q* also cannot be in < 6>, since such O's are not changed to I's by LEV's iteration transformation. If ^* is in < a > , then its active augmentation set in / under OLEV overlaps <d>. If g* is c or e then its active augmentation set in / under OLEV is < 6 > or < / >, both of which are 8-adjacent to <d>. So in all cases the active augmentation set of q* in / under OLEV lies in the same 8-component of the I's of / as ^'s active augmentation set <d>, and we are done. Note that if O satisfies condition L, and the conditions required for a 0, q, to be changed to 1 by O guarantee that N^(q) meets just one m-component of the I's of the image, then the first condition of the FC3L Local Test is satisfied. This motivates the following definition: Definition 4.4 An operator belongs toTT class Os if changing of a 0, q, to 1 requires If an operator O satisfies condition L and is of class Os, then [O : R] satisfies the first condition of the FC3L Local Test. For example, when m = 8 the first condition is satisfied if q can be changed from 0 to 1 only if its neighborhood matches one of the following: 1 1 I q 1 1 q 0 Here the pixels at blank positions could be I's or O's. Note that in the case m = 8, a 3 x 3 operator that is of class Os must satisfy condition L. What further constraint can be placed on the image transformation [O : R] to guarantee that the second condition of the FC3L Local Test is also satisfied? We first consider the case m = 8.
• 73. 71 Definition 4.5 Let m = 8. An image transformation [O : R] belongs to class CAUGS if (1) O belongs to Os, and (2) whenever any two S-adjacent O's, q and q*, are changed to 1 '5 by [O : R], Nl[q) fl N;{q*) contains a 1. Regarding condition (2) of CAUGS, note that if q and q* are 8-adjacent pixels then N%{q) n N%{q*) must match one of the following: a q a a q* a q q* a a Condition (2) is equivalent to the condition that, in each of these cases, if [O : R changes both q and q* from 0 to 1 then <a> must contain a 1. Let m = 8, let O be an operator that satisfies condition L, and suppose the image transformation [O : i?] belongs to class CAUGS. Then [O : R satisfies the second condi- tion of the FC3L Local Test (as well as the first). Indeed, let q and q* be 8-adjacent O's of an image / that are changed to I's by [O : i?]. Then, since O is of class Os-, Cs{q) = 1 and Csiq*) = 1 in /, so all I's of / in Ng(q) and Ng{q*) are in the same 8-component of the Ts of / as a 1 in Ng{q) O Ng(q*). Since the active augmentation sets of q and q* in I under O meet Ng{q) and Ng{q*) respectively (by condition L), the two sets lie in the same 8-component of the I's of /. We can also define an analog of class CAUGS for the case m = 4: Definition 4.6 Let m = 4. An image transformation [O : R] belongs to class CAUGS4 if (I) O belongs to Os, and (2) whenever any two i-adjacent O's, q and q*, are changed to 1 's by [O : R, Ns{q) U Ns{q*) must match the following or one of its rotations by a multiple of 90**. 1 1 q q* Here the pixels at blank positions could be Ts or O's. If m = 4 and O is an operator that satisfies condition L, then any image transformation [O : R] that belongs to clciss CAUGS4 satisfies both conditions of the FC3L Local Test. It may be of interest to obtain generalizations of the FCA;L Local Tests for image algorithms whose iteration operators do not necessarily satisfy condition L. The "translate right by 2 units" operator is a simple example of a regular operator that does not satisfy condition L. 4.8. Termination. To prove that a reductive-augmentative shrinking algorithm is a universal shrinking algorithm, it is not enough just to show that the algorithm's iteration transformations preserve foreground connectivity with allowance for deleted residues. It is also necessary to prove that the algorithm terminates for all input images. If all of the algorithm's iteration operators satisfy condition L, then it may be possible to do this in two steps along the following lines: For any image there must exist an upright "bounding" rectangle whose boundary consists entirely of O's, such that all the I's are
• 74. 72 BSOUTHWEST Figure 8. Example of a bounding rectangle of an image and the line BSOUTHWEST. The •'s, z and r are O's. Repeated application of LEV's iteration transformation will eventually reduce the set of I's to an 8-residue at r. The number of iterations required is exactly one less than the 4- (or "Manhattan") distance between the pixels z and r. This 4-distance is equal to the number %c defined in the text when C is the unique 8-component of the I's of this image. inside. The first step is to confirm, that none of the boundary O's of such a rectangle are changed to I's when the algorithm's iteration transformation is applied to the image, regardless of where the internal I's are. When confirmed, this shows that changes in the image during execution of the algorithm are permanently constrained to occur only inside an upright bounding rectangle of the input image. (Here we are using the fact that the iteration operators satisfy condition L.) The second step is to show that at each iteration of any hypothetical non-terminating execution of the algorithm, there is a certain pixel (e.g., the easternmost of the southernmost I's) that must be deleted at that iteration or a subsequent iteration, and which can never be changed back to a 1. This implies that it is impossible for the algorithm not to terminate. We can prove that LEV terminates for all input images in this way. Given any image /, consider an upright bounding rectangle for the set of I's (as shown in Figure 8, where all the t's are O's and there are no I's outside the rectangle). It is straightforward to show that no O's on the boundary of such a rectangle can be changed to I's by application of LEV'S iteration transformation to /, regardless of where the internal I's are. As already pointed out, this implies that when LEV is executed, the I's are permanently confined to the inside of an upright bounding rectangle of the input image. At any iteration of an execution of LEV, let BSOUTHWEST be the northwest-to- southeast diagonal that has all the I's on its northeast side and is as far northeast as possible (see Figure 8). If not all of the I's are 8-residues, then LEV's iteration transfor- mation deletes all I's that are 4-adjacent to BSOUTHWEST, so that BSOUTHWEST
• 75. 73 moves northeast by at least one pixel. The Ts that are 4-adjacent to BSOUTHWEST and are deleted at any iteration can never be changed back to I's at a later iteration. It follows that LEV must eventually terminate. It is easy to give an upper bound on the iteration count for LEV. Since BSOUTHWEST moves at least 1 pixel position to the northeast at each iteration, when all the I's in the input image are contained in a A; x A; square the worst case iteration count for LEV is 2k —2 iterations. (Assuming that each iteration takes constant time, it follows that LEV is an 0{d) algorithm where d is the distance between the two I's of the input image that are furthest apart.) In fact the exact value of LEV*s iteration count for any given input image is also quite easily determined. For each 8-component C of the I's of the input image, let ic be the smallest integer for which there exists an upright ic x ic square of pixels that contains all the pixels of C on or above its northwest-southeast diagonal. (If Ic is the image whose set of I's is C, and zc is the pixel where the lower boundary line of /c's minimal upright bounding rectangle intersects /c's BSOUTHWEST boundary line, then it is readily confirmed that ic is equal to the 4- or "Manhattan" distance between zc and the pixel where the 8-residue for C is eventually formed—i.e., the southwest neighbor of the northeast corner of the bounding rectangle. See Figure 8.) Every 8-component C of the Ts of the input image is reduced to an 8-residue in exactly ic — 1 iterations. Hence LEV terminates in exactly k — 1 iterations, where k is the maximum of ic over all 8-components C of the I's of the input image. Other shrinking algorithms have been designed with the aim of reducing the average iteration count, typically by allowing reduction and augmentation to occur in more than one direction; examples will now be given. 5. FURTHER EXAMPLES OF REDUCTIVE-AUGMENTATIVE PARAL- LEL UNIVERSAL SHRINKING ALGORITHMS 5.1. A 4-Subiteration Universal Shrinking Algorithm for m = 8. We now present an algorithm (Algorithm RPS below) that is a slightly modified version of an algorithm presented by Kameswara Rao et al. [29]. It uses the following four 3 x 3 operators: 1. The augmentative operator which changes a 0, p, to 1 if at least three of the four pixels in N4{p) are Ts, or if Ns(p) matches either of the following: 1 0 p i p i 0 1 2. The reductive operator which deletes a 1, p, if p is an 8-residue, or if Ns{p) matches any of the following: 0 0 0 p 1 0 1 p 0 0 0 0 0 0 p 0 1 0 0 0 p 0 1 0
• 76. 74 3. The augmentative operator defined as in (1), except that the two 8-neighborhoods of p are rotated 180**. 4. The reductive operator defined as in (2), except that the four 8-neighborhoods of p are rotated 180^ Algorithm RPS At the v''^ iteration (i = 1,2,3,...) apply operator (i mod 4 -}-1) from the above list, in parallel, to all pixels. Terminate when all I's in the image are 8-residues. Figure 9 shows an example of RPS operation. In a sense, RPS attempts to shrink an object symmetrically from all sides; but it does not achieve lower iteration counts than LEV in reported tests [15]. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 • 1 1 1 1 1 1 1 1 o i l 1 1 1 1 o • o Figure 9. Example of RPS operation. Image 0 is the input image, and for z = 1 - 6 image i is the image after i iterations. In images 2 - 6 , the 's are O's which were Ts in the input image, and the o's are O's which were O's in the input image but were changed to I's at some iteration. It can be shown that RPS always terminates successfully. One way to prove this is as follows. First, establish that the non-zero region of the image is permanently constrained to lie inside the upright bounding rectangle which circumscribes the I's of the input image. Then show that, at each iteration of a hypothetical non-terminating execution of RPS, a certain pixel (the easternmost of the northernmost I's of the image) must be deleted at that iteration or some subsequent iteration and can never be changed back to a 1. Similar arguments will be given in some detail for the TSF and FPS algorithms presented below. It can also be confirmed using the methods of Section 4 that RPS preserves foreground connectivity with allowance for deleted residues, for m = 8. Thus RPS is a universal
• 77. 75 shrinking algorithm. In fact, although reduction and augmentation are done at diflferent subiterations of RPS, one can show that the algorithm would preserve foreground con- nectivity with allowance for deleted residues even if reduction and augmentation were made to occur in parallel. In other words, if the two subiterations that apply operators 1 and 2 were combined into a single subiteration that simultaneously changed O's to I's under the conditions of operator 1, and I's to O's under the conditions of operator 2, and if the other two subiterations were similarly combined, then the resulting 2-subiteration algorithm would still preserve foreground connectivity with allowance for deleted residues. RPS diifers from the algorithm originally presented in [29] in that its second and fourth subiterations delete 8-residues. The original algorithm, which did not delete 8-residues, was not a universal shrinking algorithm in our sense because there are certain input images for which it would fail to shrink all 8-components of the I's to 8-residues. For example, the following image would be invariant under all four of its iteration transformations: 1 1 1 1 1 1 1 1 1 1 1 1 1 5.2. A 2-Subfield Universal Shrinking Algorithm for m = 8. The subfield approach is able to shrink from all directions at each iteration. In early applications of the subfield methodology to parallel reductive image algorithms useful for thinning [16, 47], m-adjacent pixels never belonged to the same subfield; consequently, the m-neighbors of a deleted pixel could not change in value at the same iteration. Connectiv- ity preservation was insured since only m-simple I's were deleted. However, it is desirable to use the minimum number of subfields (i.e., two) to help minimize the total number of iterations, and in this case some 8-neighbors must be allowed to change together. A 2-subfield approach to parallel thinning, presented in [18], appears to require fewer itera- tions than 2-subiteration approaches. A 2-subfield approach to parallel shrinking has also been shown to lead to a fast algorithm [15]. The following pair of subfields was used in [15, 18]; this choice of subfields allows particularly simple connectivity preservation proofs [22]. The image is partitioned like a checkerboard into two disjoint sets (subfields) as illustrated below: Vi V2 Vi V2 Vi ... V2 Vi V2 Vi V2 ... Vi V2 Vi V2 Vi ... Here < vi > and <V2> are the two subfields. Note that the 4-neighbors of each pixel belong to the opposite subfield. The following algorithm, which assumes m = 8, uses this pair of subfields. Its iteration operator is applied in parallel to each subfield at alternate iterations. This was one of several examples of a general class of 2-subfield algorithms given in [15].
• 78. 76 Algorithm TSF Activate the two subfields defined above at alternate iterations (<t;i>, <V2>, <vi>) < t;2 >, • • •)• A* ^*^^ iteration apply the following reductive-augmentative operator, in parallel, to all pixels in the active subfield. a. A pixel p = 1 is deleted if (1) p is an 8-residue or if all three of the following conditions are satisfied: (2) Cs{p) = 1, and (3) Ng{p) contains a 4-path of three or more O's, and (4) Ng(p) does not match either of the following: 1 0 0 0 0 0 0 p 0 0 p 0 0 0 0 1 0 0 b. A pixel p = 0 is changed to 1 if both of the following conditions are satisfied: (1) Cs{p) = 1, and (2) p8 = p2 = 1 or p8 = P6 = 1. Terminate when all I's in the image are 8-residues. Deletion condition (a2) helps to preserve local foreground connectivity. Cs{p) = 1 implies that p is 8-simple when p is a border pixel, but it is also satisfied when p is an interior pixel. Condition (a3) allows only border I's to be deleted, but I's can be deleted from all sides. If we leave out (a3) then holes can be created which must be "filled" with augmentations at subsequent iterations, so that the iteration count of the algorithm may increase. In fact TSF requires fewer iterations "on average" than other similar 2-subfield algorithms with different or no (a3) condition [15]. Condition (a4) guarantees that only one 1 is deleted from the isolated two-pixel diagonal 8-components 1 1 1 1 Augmentation conditions (bl) and (b2) allow holes to be filled while avoiding the merging of distinct objects. These conditions are straightforward extensions of the augmentation conditions used by LEV's iteration operator OLEV and are very similar to those used by operator 3 of RPS. In general objects tend to be augmented towards northeast and southeast corners while being eroded from all directions. An example of TSF's operation is given in Figure 10, where TSF terminates in six iterations. It is assumed in this example that the upper right-hand corner 1 of the input image lies in the subfield < vi > which is activated at the first iteration. We now prove that TSF preserves foreground connectivity with allowance for deleted residues when m = 8, assuming that it terminates for all input images. (This assumption will be justified in due course.) Let OTSF be TSF's iteration operator. The augmentation sets of each pixel p under OTSF are {p8,P2} and {ps^Pe}- Thus the augmentation sets of a pixel under OTSF consist of 4-neighbors of that pixel and lie in the opposite subfield. Let < Vi > be one of the two subfields of TSF, so that [OTSF ' < v, >] is an iteration
• 79. 77 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 • 1 1 . 1 1 1 • 1 1 1 • • 1 • 2 . . . 1 • 0 0 • • 0 0 • . . 1 • 1 1 . 0 1 3 1 1 Figure 10. Example of TSF operation. Image 0 is the input image, and for i = 1 - 5 image i is the image after i iterations. The upper right corner pixel belongs to the subfield that is active at the first iteration. In images 1 - 5 , the -'s are O's which were I's in the input image, and the o's are O's which were O's in the input image but were changed to I's at some iteration. transformation of TSF. Evidently, OTSF satisfies condition L. We now show that [OTSF : <Vi>] passes the FCA;L Local Tests. To show that [OTSF ' < '^i >] passes the FCIL Local Test, let p be a 1 of an image I that is deleted by [OTSF * < v, >] from /. Then p € < Vt >? and either p is an 8-residue in / or Cs{p) = 1 in /. Let a and b be pixels in Ng(p) that are 8-contiguous to p under application of [OTSF '• < v. >] to /. To establish condition 1 of the FCIL Local Test, we must show that there is an 8-path of I's of [OTSF • <v,>](/) from a to b. We claim that a and b must be I's of / as well as [OTSF - < v, >](/)• For suppose a, say, were a 0 of /. Then, by the definition of 8-contiguity, a must be changed to a 1 by application of [OTSF - < ^i >] to / and p must belong to an active augmentation set of a under OTSF in J- But this implies that p and a lie in opposite subfields, so that a ^ < v, >, contradicting the fact that a is changed to 1 by application of [OTSF :<Vi>]to I. Hence our claim is justified. It follows that p is not an 8-residue in /, and that Cs(p) = 1 in /. There is an 8-path of I's of / in Ng(p) from a to 6, since Cs{p) = 1 in /. Consider the shortest such 8-path; this has the property that all its intermediate pixels are 4-neighbors of p. As p €< Vi >, these 4-neighbors of p are not in the subfield < v, > and cannot be deleted by [OTSF - < v, >] from 7. It follows that the 8-path is also an 8-path of I's of [OTSF - <Vt >](7) from a to 6. Thus we have established condition 1 of the FCIL Local Test. To establish condition 2 of the FCIL Local Test, let q be an 8-neighbor of p that is also a 1 of / deleted by [OTSF : < v, >] from 7, and let p* be any pixel in Ng{p) that is 8-contiguous to p under application of [OTSF • < v, >] to 7. We need to show there is an 8-path of I's of [OTSF • < v,>](7) from p* to some pixel q* that is 8-contiguous to q under application of [OTSF • < v, >] to 7.
• 80. 78 As in the cases of a and b above, p* must be a 1 of / as well as [OTSF : < v, >](/)• Evidently p* ^ q, since p* is not deleted by [OTSF - < v« >) from /. There is an 8-path of I's of / in Ng{p) from p* to g, since C8(p) = 1 in /. Consider the shortest such 8-path. This 8-path contains at least two pixels (since p* ^ q) and has the property that all its intermediate pixels are 4-neighbors of p, which are not in the subfield < v, >. The intermediate pixels must therefore be Ts of [OTSF - < v,>](/) as well as I's of 7, just like p*. By omitting q from this 8-path, we obtain an 8-path of Vs of [OTSF - <v,>](/) from p* to the predecessor q* of q. Moreover, since ^* is a 1 of [OTSF * <Vi>]{I) as well as a 1 of /, q* is 8-contiguous to q under application of [OTSF '• < v, >] to 7, as required. This completes the proof that [OTSF • <v,>] passes the FClL Local Test. Next, we show that [OTSF • < ^^t >] passes the FC2L Local Test. Let p be a 1 of an image 7 that is deleted by [OTSF • < V, >] from 7 but is not an 8-residue of 7. We have to show that some 8-neighbor of p is 8-contiguous to p under application of [OTSF • < v* >] to 7. It is enough to show that some 8-neighbor of p is a 1 of 7 that is not deleted by [OTSF ' < v, >] from 7. If any of the 4-neighbors of p is a 1 of 7 then (since it lies in the opposite subfield to p) it is not deleted by [OTSF ' < v« >] from 7 and we are done. Now suppose all the 4-neighbors of p are O's of 7. Then since p is not an 8-residue of 7, some pixel q € {pi^Pz^Ps^P?} is a 1 of 7. No other pixel in {pi^Pz^ps^p?} is a 1 of 7, for otherwise Cs{p) > 1 in 7 and p would not be deleted by OTSF from 7 (by condition (a2)). Moreover, q cannot be pi or P7, for otherwise p would not be deleted by OTSF from 7 (by condition (a4)). Thus q is P3 or Ps- If some 8-neighbor of q other than p is a 1 of 7 then q is not deleted by OTSF from 7 because Cs{q) > 1- But if no 8-neighbor of q other than p is a 1 of 7 then q is not deleted by OTSF from 7 because of condition (a4). So in all cases q is not deleted by [OTSF • < ^i >] from 7, and we are done. To show that [OTSF • <'^i>] passes the FC3L Local Test, first note that OTSF belongs to class Os' Now let q and q* be any two 8-adjacent O's of an image 7 that are changed to I's by application of [OTSF ' <v,>] to 7. Then q and q* cannot be 4-adjacent to each other (since they are both in the subfield < v, >). Assuming without loss of generality that q* is further south than q, the two pixels must have a neighborhood that matches one of the following: q a q a q* q* Here a = 1, by condition (b2). Since a belongs to Ng{q) 0 Ng{q*), [OTSF • < v»>] belongs to class CAUGS, which implies that [OTSF • <Vt>] passes the FC3L Local Test. It remains to show that TSF terminates for all input images. Given any image, consider an upright bounding rectangle for the set of I's (as shown in Figure 11, where all the •'s are O's and there are no I's outside the rectangle). As in the case of LEV, it is straightforward to confirm that none of the O's on or outside the bounding rectangle can be changed to I's by TSF's iteration operator. So when TSF is executed with input 7, at all iterations the I's are confined to the inside of an upright bounding rectangle for the I's of 7. As in the proof that LEV always terminates, at any iteration of an execution of TSF let BSOUTHWEST be the northwest-to-southeast diagonal that has all the I's on its north- east side and is as far northeast as possible (see Figure 11). Consider the northernmost
• 81. 79 • • • • • • • 1 • • • • • - • • • • • • 1 1 • • 1 1 1 1 • BNORTHWEST 1 • 1 1 • 1 • 1 1 1 1 1 1 1 • 1 1 1 • • 1 1 1 1 1 1 • • 1 • BSOUTHWEST Figure 11. Boundary line definitions for TSF and for EPS (see Section 5.3). The •'s represent O's which form the bounding rectangle and two other boundary lines. 1, p, that is 4-adjacent to BSOUTHWEST. The pixels near p must be as follows: 0 a b c 0 p d 9 0 e The three pixels shown as O's are part of the BSOUTHWEST boundary line, and so ^ = 0 by our definition of BSOUTHWEST. By our definition of p, a = 0. Also, a, g, and the pixels shown as O's can never be changed to I's; so they remain 0 indefinitely. If p is deleted at any future iteration then it can never subsequently satisfy (b2) and be changed back to a 1. So if we can show, under the hypothesis that the algorithm does not terminate, that the pixel p must eventually be deleted, then we will be done. (For this will imply that the algorithm must in fact terminate.) The result follows from the following lemma: Lemma 5.1 During a non-terminating execution of TSF, no pixel satisfies the following condition: There is some positive integer j such that, at all iterations after the j ^ ^ , the pixel is a 1 and its northwest, west, southwest and south neighbors are 0 ^s. (a) Proof Consider any non-terminating execution of TSF. Suppose a pixel p satisfies (a). Consider the values of pixels near p at iterations after the j^^. At such iterations we label the pixels near p as follows:
• 82. 80 0 6 c 0 p d 0 0 e At the beginning of any p-on iteration after the j^^ iteration, p must fail (a2)—so that <f = 0, c = 1, and bV c= 1. Hence, by Proposition 2.2, d = 0 and e = 1 must remain true at all times after the beginning of the first p-on iteration after the j*^ iteration, and hence at all times after the j +1*' iteration. Now if c = 1 at the beginning of any d-on iteration after the j + 1'* iteration, d would have value 1 at the beginning of the next iteration, contradiction. Thus c = 0 at the beginning of all d-on iterations after the j -f 1'' iteration, implying c = 0 at all times after the beginning of the first d-on iteration after the j -f 1*' iteration, and hence c = 0 at all times after the j -|- 2**** iteration. We thus have 6 = 1 at the beginning of all p-on iterations after the j -- 2^^ iteration (since we know 6 V c = 1 at that time); hence 6 = 1 at all times after the j -- 3^ iteration. So all pixel values in Ngip) are indefinitely unchanging after the j -- 3^^ iteration, and Nsip) matches the following, with c = J = 0: X 0 1 c y 0 p d z 0 0 1 Since d satisfies (b2) but is never changed to 1, it must fail (bl) at the beginning of each d-on iteration after the j -f 3^*^ iteration. Hence y = 1 and 2r = 0 at the beginning of every d-on iteration after the j -- 3'** iteration, whence y = I and 2: = 0 at all times after the j -- 4*** iteration. Similarly, in order for c to avoid changing to 1 at any c-on iteration, we must have a: = 0 at all times after the j -- 5'^ iteration. Thus y also satisfies (a). We have shown that given any pixel p satisfying (a) there exists another such pixel that is further north than p; hence there exists still another such pixel that is even further north, and so on. This contradicts the fact that there is a bounded region of the image outside which the pixels have value 0 at all iterations (and so cannot satisfy (a)). Therefore no pixel can satisfy (a). • This completes the proof that TSF terminates for all input images. It follows that TSF is a universal shrinking algorithm. In experiments by the first author and his coworkers on artificial and natural images, the iteration counts for TSF were significantly lower than for LEV and RPS—on average, TSF required only about 66% as many iterations cis LEV and less than 50% as many as RPS. 5.3. Designing a Fully Parallel Universal Shrinking Algorithm for m = 8. In this section we will design a completely parallel single-operator universal shrinking algorithm. We will assume m = 8, and will require the algorithm's iteration operator to have a 3 X 3 support. Recall that LEV is a completely parallel image algorithm that uses a single 3 x 3 operator. However, one limitation of LEV is that its iteration operator OLEV deletes only from one side and augments only in one direction. TSF's operator deletes from all sides and augments in two directions, but TSF is not completely parallel. In designing the
• 83. 81 new algorithm we will attempt to reduce iteration counts by using completely parallel applications of an operator that deletes from more than one side and augments in more than one direction. Let O be the algorithm's iteration operator. O will be a reductive-augmentative 3 x 3 operator and will delete 8-residues. Let O^ be the reductive operator that deletes I's under exactly the same conditions as O, except that it does not delete 8-residues. We will require O's deletion conditions to be such that the reductive image transformation [OR : E] preserves foreground connectivity. The algorithm's iteration transformation [O : E] must then satisfy FC2L, provided that it satisfies condition L; it will also be quite likely to satisfy FCIL. If we allow I's to be deleted from both north and south (or east and west) borders simultaneously, we encounter difficulties in preserving foreground connectivity. So we will only allow O to delete from north and west borders. In other words, we will require every deletable 1, p, to match one of the following: 0 P O p We will not allow O to delete I's, p, for which Cs{p) > 1. (It is not hard to show that if O can delete such I's then [OR : E] does not satisfy FCl.) A consequence of this restriction is that [OR : E] passes the Rl Ronse test in [22] and the first author's chapter on thinning in this volume. If we allowed two 4-adjacent I's p and q both to be deletable by O in configurations such as 1 0 0 0 p q 1 p 1 0 q 1 then [OR : E] would violate the R2 Ronse test in [22] and would not satisfy FCl (by [22, Proposition 5.2] and the fact that OR is a 3 X 3 operator). All such "bad" cases are avoided and [OR : E] passes the R2 Ronse test (whence [OR : E] satisfies FCl) if we allow O to delete a 1, p, only when p is an 8-residue or Cs{p) = 1 and Ns{p) matches one of the following: 0 0 0 p O p We want [OR : E] to satisfy FC2 as well as FCl. Since [OH : E] passes the Rl and R2 tests of [22], a necessary and sufficient condition for [O^ : E] to satisfy FC2 is that it should not completely eliminate any 8-component of I's that consists of two, three, or four mutually 8-adjacent pixels. (This is the R3 Ronse test in [22] and the first author's chapter on thinning.) The following are the only such 8-components all of whose I's could satisfy the deletion condition: 1 1 1 1 1 1 1 1 1
• 84. 82 We prevent these components from being completely eliminated by [0^ : E] by preserving one of the I's in each case. In choosing which I's to preserve, we are guided by the need to ensure that the algorithm always terminates. A key step in the proof of termination will be to show that, at each iteration of a hypothetical non-terminating execution of the algorithm, a certain critical 1 must be deleted either at that iteration or at some subsequent iteration. With the proof of termination in mind, we choose to preserve from deletion the I's, p, shown below: 1 1 1 1 P ^ P P P These choices guarantee that p is never the critical 1 which must eventually be deleted. Next, we consider O's augmentation conditions. We want to constrain the non-zero part of the image, both to reduce iteration counts and to simplify the proof of termination. If we allowed a 0, q, to be changed to 1 when Ng{q) contained only one 1, then there would exist images / such that, for any fixed region R, repeated application of [O : E] to / eventually produces I's outside R, implying that the algorithm would never terminate when applied to /. [Proof. Suppose O changes a 0 to a 1 when only one of its diagonal neighbors, say its southwest neighbor, is 1. Then, for any image, application of [O : E] moves the easternmost of the northernmost I's one unit to the northeast. Suppose next that O changes a 0 to a 1 when only its south neighbor is 1, but not when only its southeast or southwest neighbor is 1. (Symmetrical arguments apply to the other three principal directions.) Then, for any image in which there is a unique northernmost 1, application of [O : E] moves the unique northernmost 1 one unit to the north.] Thus we must use augmentation conditions that require Ng{q) to contain at least two I's. Moreover, we will restrict our attention to augmentation conditions that require N^{q) to contain at least two I's. In addition, we will make Cs{q) = 1 a requirement for changing q from 0 to 1. Thus O will belong to class Os- This will imply that O satisfies condition L (since it is a 3 x 3 operator and m = 8) and that [O : E] satisfies the first condition of the FC3L Local Test. Note that Cs{q) = 1 implies that if there are just two I's in N^{q), then those I's must be 8-adjacent 4-neighbors, as in: 1 q 1 Augmentation in many directions can be desirable. For example, it would fill holes more quickly in images like the following: 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1 1 But, to satisfy FC3L we must restrict the augmentation conditions. Indeed, consider what happens if we change q from 0 to 1 in both of the following situations:
• 85. 83 1 q 1 1 q 1 These augmentations cause FC3L to be violated for a consistently labeled £-image whose set of I's includes 1 1 P q 1 1 where the I's belong to two different 8-components. Here changing both p and q to 1 merges these components. Such observations lead us to the following augmentation conditions, which are the same as the augmentation conditions used by OTSF- 9 is changed from 0 to 1 when Cs{q) = 1 and Ng{q) matches either of the following: 1 I q I q 1 Here the pixels at blank positions may be I's or O's. With these augmentation conditions, it is readily confirmed that the algorithm's iteration transformation [O : E] is of class CAUGS, so that [O : E] passes the FC3L Local Test. It can be shown that [O : E] also passes the FCIL and FC2L Local Tests. Thus the algorithm preserves foreground connectivity with allowance for deleted residues, assuming that it terminates for all input images. A complete statement of the algorithm follows. Algorithm FPS At each iteration apply the following reductive-augmentative operator, in parallel, to all pixels. a. A pixel p = 1 is deleted if (1) p is an 8-residue or if all three of the following conditions are satisfied: (2) Cs{p) = 1, and (3) pi — p2 = 0 OT pi = ps = 0, and (4) Ng{p) does not match any of the following: 0 1 0 0 0 0 0 1 O p O I p O O p O 0 0 0 0 0 0 0 0 0 b. A pixel p = 0 is changed to 1 if both of the following conditions are satisfied: (1) Cs(p) = 1, and (2) p8 = p2 = 1 or p8 = P6 = 1. Terminate when all I's in the image are 8-residues. An example of FPS operation is given in Figure 12. It is easily verified that kxk square components of I's are reduced to 8-residues by FPS in A; — 1 iterations, which is just half
• 86. 84 of the number of iterations required by LEV. In fact, in experiments by the first author and his coworkers the iteration counts of FPS for a variety of input images were found to be close to the iteration counts of TSF, and substantially lower than the iteration counts of LEV and RPS. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 • 1 1 1 • 1 1 • 1 1 1 1 1 1 • 1 1 1 • o i l • o i l • 1 1 G O - • O O • O O 1 • O O • • 1 • • 1 Figure 12. Example of FPS operation. Image 0 is the input image, and for i = 1 - 5 image i is the image after i iterations. In images 1 - 5 , the -'s are O's which were I's in the input image, and the o's are O's which were O's in the input image but were changed to I's at some iteration. To show that FPS is a universal shrinking algorithm, we must also prove that FPS terminates for all input images. As with LEV and TSF, when FPS is executed with any input image /, all I's are permanently constrained to lie within an upright bounding rectangle for the I's of /. At any iteration of an execution of FPS, let BNORTHWEST be the southwest-to- northeast diagonal that has all the I's on its southeast side and is as far southeast as possible, as shown in Figure 11. Consider the northernmost 1 which is 4-adjacent to the BNORTHWEST boundary line. If this pixel is deleted at the current iteration or a future iteration then it can never be changed back to a 1. To prove that FPS must terminate, it is enough to show, under the hypothesis that the algorithm does not terminate, that this 1 will eventually be deleted. When FPS is executed, say that a pixel q is special at iteration j if at that iteration q is a 1 whose north, northwest and west neighbors are all O's. Say that q is ultimately special for an execution of FPS if q is special at all iterations after the i'**, for some i. If at some iteration the critical 1 identified in the previous paragraph is never subsequently deleted, then it is an ultimately special pixel for the execution of FPS under consideration. The following lemma implies that this is impossible if the execution of FPS fails to terminate. Hence FPS must in fact terminate for all input images. Lemma 5.2 No pixel is ultimately special for a non-terminating execution of FPS.
• 87. 85 Proof. Consider any non-terminating execution of FPS. Suppose a pixel p is ultimately special. Let p be special at all iterations after the i^^. Then p is a 1 at all iterations after the I***, and so p cannot be deleted at any iteration after the t*^. At such an iteration we label the pixels near p as follows: 0 0 X 0 p a y h u V Suppose first that there is some integer j such that at all iterations after the j ^ ^ either a; is a 0 or a is a 1. Now if y is a 0 or 6 is a 1 at any iteration after both the t*** and the j^^ then p is deleted at that iteration, which is impossible. So y is a 1 and 6 is a 0 at all such iterations, which implies that v must be special at all such iterations (to prevent 6 from being changed to a 1 at that iteration). Hence v is ultimately special. Next, suppose no such j exists. Then x is a 1 at all iterations after the z'^, for if x is a 0 at any such iteration then x can never subsequently be changed to a 1. The nonexistence of j now implies that u is special at all iterations after the i'^. For if u fails to be special at some such iteration then, since p and x are I's, a is a 1 at the next iteration and can never be deleted thereafter. Hence u is ultimately special. Thus we have shown that if an ultimately special pixel p exists, then there exists another such pixel which is further south than p, and hence still another such pixel that is even further south, and so on. This contradicts the fact that there is a bounded region outside which the pixels have value 0 at all iterations and so are never special. Therefore no ultimately special pixels exist for this execution of FPS. • 6. PARALLEL 3-D SHRINKING There is an increasing need for the development of image processing algorithms for 3D images, such as those commonly used in medical diagnosis (see Udupa's chapter in this volume). Parallelism can be particularly valuable in processing such images, because of their large size. Parallel 3D mesh architectures have been commercialized [28, 32] and offer a particularly good match to VLSI constraints [46]. Models of computation based on a 3D mesh have also been shown to have good performance compared to higher connectivity networks—such as hypercube networks [13]. 3D mesh architectures are therefore a natural choice for implementing parallel image processing algorithms. All of this helps to motivate the study of parallel local operators and algorithms for 3D images. Research on 3D shrinking to a topological equivalent has focused mainly on the problems of identifying simple I's in 3D images and of defining connectivity preservation for 3D parallel reductive image algorithms [8, 34, 36, 37, 35, 40, 43, 45, 54, 57, 58], and on the development of 3D thinning algorithms (typically using reductive operators) [17, 19, 59, 60]. 3D parallel thinning algorithms have been designed using subiteration approaches [17, 59, 60] and subfield approaches [7, 19]. The problem of defining connectivity preser- vation for 3D parallel reductive image algorithms has been addressed in several ways. Morgenthaler developed one approach and applied it to parallel thinning [45]. Tsao and
• 88. 86 Fu [59, 60] demonstrated how the 2D "path-based" connectivity preservation proofs of Rosenfeld [50] can be extended to 3D images. Gong and Bertrand applied Morgenthaler's notions to their 6-subiteration parallel thinning algorithm [17]. A key issue in 3D connec- tivity preservation is the preservation of 3D doughnut-type holes, which are sometimes called tunnels [37, 45]. In fact, it is quite tricky even to give a precise definition of 3D hole preservation. (One way is to use digital fundamental groups [34, 36].) In the last few years. Hall has worked on the development of 3D connectivity preserva- tion tests for 2-subfield and 4-subfield algorithms [21], while Ma and Kong [35, 42] have extended Rouse's work on 2D minimal non-deletable sets [48] and related connectivity preservation tests for 2D image transformations [22] to 3D images. The resulting connec- tivity preservation tests for 3D image transformations are relatively simple, and can be useful in the development of parallel—especially completely parallel—3D reductive image algorithms. Related work has been done by Bertrand [6]. (The development of 3D com- pletely parallel single-operator thinning algorithms had previously been hampered by the difficulty of proving connectivity preservation for such algorithms.) 3D shrinking to a residue has received little attention since the early work of Arcelli and Levialdi [5]. Note that difficulties associated with 3D hole preservation do not arise in the 3D shrinking-to-a-residue problem, since 3D holes and cavities do not have to be preserved. In [5], Arcelli and Levialdi presented a 3D version of the LEV algorithm for images in which 26-adjacency is used on the I's and 6-adjacency on the O's. (26- and 6-adjacency are the 3D analogs of 8- and 4-adjacency.) Their algorithm (Algorithm AL below) will be stated using the following notation for specific 26-neighbors of p: Pi P2 PS PlO Pll Pl2 Pl8 Pl9 P20 Ps P9 P4 Pl7 P Pl3 P25 P26 P21 P7 P6 Ps Pl6 Pl5 Pl4 P24 P23 P22 Top Plane Middle Plane Bottom Plane Algorithin AL At each iteration, apply the following reductive-augmentative operator, in parallel, to all voxels. 1. A voxel p = 1 is deleted if pio = Pii = Pi? = Pis = Pi9 = P25 = P26 = 0. 2. A voxel p = 0 is changed to 1 if (pn A pir) V (pn A P25) V (pn A p26) V {pn A pig) V (Pl7 A P26) V (pio A P26) = 1. Terminate when all I's in the image are 26-residues. An example of the operation of AL is given in Figure 13. However, there are some input images for which AL does not satisfy (the 3D analog of) FC3L. Consider the following 3D image, where 9 is a 0, a, 6 and c are I's, and a does not lie in the same 26-component of the I's as {6,c}:
• 89. 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 o 0 0 0 0 1 0 0 1 1 0 1 1 0 0 1 Top Plane 0 1 1 0 0 1 0 • • 1 0 1 0 • • 0 0 1 0 • • 0 0 • 0 • • 0 0 • iddle 0 1 0 0 1 1 0 1 1 0 1 0 o Plane 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 Bottom Plane Figure 13. Example of AL operation. Image 0 is the input image, and for i = 1 - 4 image i is the image after i iterations. In images 1-4, the -'s are O's which were I's in the input image, and the o's are O's which were O's in the input image but were changed X _ 1 7 _ _ J . 'J. 2.1 to I's at some iteration. 0 0 0 0 0 1 0 0 a 0 0 0 b q 0 0 0 0 0 0 0 1 c 0 0 0 0 AL's iteration transformation does not delete a, 6 or c from this image, but it changes q to a 1. This merges the component containing a with the component containing b and c. Arcelli and Levialdi state restrictions on input images under which AL will satisfy FC3L [5]. Assuming FC3L is satisfied, if each 26-component of the I's of AL's input image is contained in a. k x k x k cube of voxels, then AL is sure to terminate in at most 3A: — 3 iterations. In an effort to design parallel 3D shrinking algorithms, 2-subfield approaches have been developed [25]. However, there are input images for which the algorithms in [25] fail to shrink every component of the I's to a residue. This may be rooted in a fundamental
• 91. 89 ^ i ^(a) (b) Figure 14. Example of the problem of determining if two closed curves are linked. In both (a) and (b) {a, b} and {c,d} belong to distinct closed curves of Ts. The closed curve containing {c, d} is assumed to extend above the page, and the closed curve containing {a, 6} is assumed to extend into the page. Thus, in (a) the two curves are linked and in (b) they are not. s s s s s p s s s s s We shall show in this appendix that this support is not quite the smallest possible—indeed, that the support s s s s s p s s s s suffices (see the discussion following Theorem A.7). It will follow from Proposition A.4 that for sequential image algorithms still smaller supports suffice. In the case m = 8, Corollary 3.10 states that if every iteration transformation of a reductive shrinking algorithm preserves foreground connectivity with possible deletion of residues, then the union of the supports of the algorithm's iteration operators at a pixel p includes all pixels in Ns{p). Similarly, in the case m = 4 the union of the supports of
• 92. 90 the iteration operators of such an algorithm must include all pixels in N4(p). This is a consequence of the following proposition, which can be proved in essentially the same way as Proposition 3.9. Proposition A.l Let m = 4. Let p he an arbitrary pixel and let q be any ^-neighbor of p. Then for all integers h > 0 there exists an image Ih, with 0(h) 1 's that has the following properties: 1. The set of 1 ^s of Ih is simply ^-connected. 2. Ih is unchanged by every image transformation [O : il] that preserves foreground connectivity with possible deletion of residues in which O has radius at most h and O '5 support at p does not include q. Corollary A.2 Let m = 4. Let A be any reductive shrinking algorithm all of whose iter- ation transformations preserve foreground connectivity with possible deletion of residues. Then the union of the supports of A '5 iteration operators at any pixel p includes all the pixels in N4(p). However, the union of the supports need not include all the 8-neighbors, as we now show. Definition A.3 Let B be a subset of {north, south, east, west}. Then a ^-border 1 in an image I is a 1 of I such that, for each direction in B, the 1 '5 ^-neighbor in that direction is a 0 of I. Proposition A.4 Let C be a simply 4-connected 4:-component of the 1 '5 of an image I such that C > 2. Then 1. C contains at least two pixels each of which is a A-simple north border 1 or a {south, east, west} border 1 of I. 2. C contains at least two pixels each of which is a 4-simple {north, east} border 1 or a i'Simple {south, west} border 1 of I. Proof. The result evidently holds when C = 2. Suppose as an induction hypothesis that it holds when C < A;, for some integer k > 2. It remains to prove the result under the assumption C = k. Let p be the easternmost of the northernmost pixels in C, and let /i be the image obtained from / by deleting p. Case 1: p is not 4-simple in /. In this case p's 3 x 3 neighborhood in / is as follows, where s and w are I's: 0 0 w p 0 0 s
• 93. 91 Since C is simply 4-connected, s and w lie in different 4-components C, and C^u of C — {p}. Now Ca and Cxu are 4-components of the Ts of Ji and they contain fewer than k pixels. So by the induction hypothesis either C, = {5}, or conditions 1 and 2 hold when C is replaced by C, and 7 by I^. If C, = {s} then let 5* = 5; otherwise we can choose s* £ Ca — {s) such that 5* is a 4-simple north border or {south, east, west} border 1 of I. In both cases it is readily confirmed that s* G C, is a 4-simple north border 1 or a {south, east, west} border 1 of /. By an analogous argument there also exists a pixel w* in C«, with the same property. Hence condition 1 holds. A similar argument shows that condition 2 also holds. Case 2: p is 4-simple in /. In this case p is a 4-simple {north, east} border 1 of 7. To show condition 2 holds, let q be the westernmost of the southernmost pixels in C If 9 is also 4-simple in / then q is a 4-simple {south, west} border 1 of 7, and it follows immediately that condition 2 holds. If q is not 4-simple in 7 then we can show that condition 2 holds using an argument that is symmetrical with that given in Case 1. To show that condition 1 holds, note that the 3 x 3 neighborhood of p in 7 is as follows: a 0 w p Q y 5 Here at least one of w and 5 is a 1, and if i/; is a 1 then a is a 0. Also, if both w and s are I's then y is a 1. Since p is 4-simple in 7, C — {p} is a component of the I's of 7i that contains fewer than k Vs. By the induction hypothesis C — {p} contains at least two pixels r^, r^ each of which is either a 4-simple north border 1 or a {south, east, west} border 1 of 7i. Suppose only one of w and 5 is a 1 in 7. Let r be one of r^ and r^ that is neither w nor 5. Since r is not 4-adjacent to p, r is also a north border 1 or a {south, east, west} border 1 of 7. It follows that r is 4-simple in 7 as well as 7i. Thus condition 1 holds. Now suppose w and 5 are both Ts of 7. Then a is a 0 and y is a 1 in 7. As y cannot be a north or a {south, east, west} border 1 of 7i, neither r^ nor r^ is equal to y. Let r be one of r^ and r^ that is not s. U r = w then r is a north border 1 of 7, and r is 4-simple in 7 as well as 7i. If r ^ ly then r is not 4-adjacent to p, and so since r is a north border 1 or a {south, east, west} border 1 of 7i, r is a north border 1 or a {south, east, west} border 1 of 7. Again, r must be 4-simple in 7 as well as 7i. Thus r is a 4-simple north border 1 or a {south, east, west} border 1 of 7, and condition 1 holds. D Let Oi be the reductive operator that deletes a pixel p in an image 7 if and only if p is a 4-simple north border 1 or a non-isolated {south, east, west} border 1 of 7. Let 02 be the reductive operator that deletes a pixel p in an image 7 if and only if p is a 4-simple {north, east} border 1 or 4-simple {south, west} border 1 of 7. It follows from Proposition A.4 that for m = 4 there exist reductive single-operator shrinking algorithms whose only iteration operator is Oi or O2. (Moreover, if D is any set of pixels then repeated sequential application of Oi or of O2 to D will reduce every simply 4-connected 4-component of the I's of any D-image to a 4-residue.) The reader can verify that Oi's support at p is
• 94. 92 and that 02's support at p is s s p s s s s s s s p s s s The following proposition implies that these supports are minimal for a single-operator reductive shrinking algorithm: Proposition A.5 Let m = 4, and let X be a proper subset of the support of Oi or of O2 at a pixel p. Then there exists an image with the following property: If O is any operator and R is any set of pixels such that the support of O at p is X and [O : B preserves foreground connectivity with possible deletion of residues, then the image is unchanged by [0:R]. This result follows from Proposition A.l i X does not contain all of the 4-neighbors of p. Now suppose X contains all of the 4-neighbors of p. Then X contains at most one diagonal neighbor of p, and by symmetry we may assume that the southeast, northeast and northwest neighbors of p are not in X. We claim that the following image, in which the a's and 6's are (4-simple) I's, has the required property: 1 1 1 1 1 1 1 1 1 1 1 a 1 a 1 6 6 6 6 It remains to justify this claim. In the case of the a's, the pixel's 4-simplicity depends on the fact that its southeast neighbor is a 1; in the case of the 6's, the pixel's 4-simplicity depends on the fact that its northeast or northwest neighbor is a 1. Now let O be any operator whose support at p is X. Since X doies not contain the southeast, northeast and northwest neighbors of p, if [O : i?] deletes one of the a's or 6's then O will sometimes delete pixels that are not 4-simple, in which case it is not hard to show that [O : /2] cannot satisfy FCl and FC2R. But if [O : If does not delete any of the a's and 6's, then it cannot delete any other 1 in the image without violating FCl. This justifies our claim. Proposition A.5 implies that Corollary A.2 can be strengthened: Corollary A.6 Let m = 4. Let Abe a reductive shrinking algorithm all of whose iteration transformations preserve foreground connectivity with possible deletion of residues. Then the union of the supports of the A *s iteration operators cannot be a proper subset of the support of Oi or the support of O2. For completely parallel single-operator image algorithms, the analog of Theorem 3.12 for m = 4 (which can be proved in a very similar way to Theorem 3.12) is:
• 95. 93 Theorem A.7 Let m = 4. Let A be any single-operator completely parallel reductive shrinking algorithm. Then the support of A *s operator contains at least 10 pixels. If the support contains just 10 pixels, then the support at a pixel p consists of p and its A-neighbors, together with the set <s> shown below or a rotation of this set around p by a multiple of 90°. . 5 . p . s s . s s To see that a 10-pixel support is in fact attainable, let O3 be the reductive operator that deletes a pixel p if and only if both of the following conditions hold: 1. pis either a 4-simple north border 1 or a non-isolated {south, east, west} border 1. 2. p's neighborhood does not match either of the following: 0 0 0 p 1 0 0 0 It is readily confirmed that Oa's support is 0 0 p 0 0 1 0 0 5 5 s p s s s s s s The single-operator completely parallel image algorithm which applies O3 to all pixels at each iteration is a reductive shrinking algorithm for m = 4. The (4,8) Ronse tests [48, 22] can be used to show that the algorithm's iteration transformation [O3 : E] preserves foreground connectivity. At each iteration just one pixel is deleted from each 4-component of the I's that consists of two pixels, and by Proposition A.4 at least two pixels are deleted from each simply 4-connected 4-component of the I's that contains more than two pixels. Hence the algorithm shrinks each simply 4-connected 4-component of the I's of any input image to a 4-residue. APPENDIX B: An Analog of Proposition 3.5 for Reductive Image Algorithms that Satisfy FCl and FC2 (rather than FCIR and FC2R) We know from Proposition 3.8 that there is no periodic universal reductive shrinking algorithm. However, our definition of a shrinking algorithm required such algorithms to preserve foreground connectivity with allowance for deleted residues. For a reductive shrinking algorithm, this means that FClR and FC2R must be satisfied. It is also of interest to consider reductive "shrinking algorithms" which satisfy FCl and FC2 instead of FCIR and FC2R. Although FC2 is a slightly stronger condition
• 97. 95 by adding I's so that there is an m-path of I's from some pixel in B^ to c^^ where the added I's lie outside the (2r -|-1) x (2r -f 1) neighborhoods of 6^ and c^. All pixels in the (2r H-1) x (2r -f 1) neighborhoods of ^ and c^ have the same values in J^ as in J^. So, by Lemma 3.4, when A is executed with Jj^ as the input image instead of J^, it remains true that neither l^ nor c^ is deleted at the first ko iterations. Hence at least one more iteration must occur to produce an image with no more than one 1, so that V{J!^) > ko. As J^ has more than N I's, this is a contradiction when N is sufficiently large. • REFERENCES 1 H. M. Alnuweiri and V. K. Prasanna Kumar. Fast image labeling using local operators on mesh-connected computers. IEEE Trans. Pattern Anal. Mach. Inteli, 13:202-207, 1991. 2 C. Arcelli. A condition for digital points removal. Signal Processing, 1:283-285, 1979. 3 C. Arcelli. Pattern thinning by contour tracing. Comput. Graphics Image Process., 17:130-144, 1981. 4 C. Arcelli, L. Cordelia, and S. Levialdi. Parallel thinning of binary pictures. Elec- tronics Letters, 11:148-149, 1975. 5 C. Arcelli and S. Levialdi. Parallel shrinking in three dimensions. Comput. Graphics Image Process., 1:21-30, 1972. 6 G. Bertrand. Sufficient conditions for 3D parallel thinning algorithms. In Proc. SPIE Vision Geometry IV Conference, pages 52-60, San Diego, CA, 1995. 7 G. Bertrand and Z. Aktouf. A three-dimensional thinning algorithm using subfields. In Proc. SPIE Vision Geometry III Conference, pages 113-124, Boston, MA, 1994. 8 G. Bertrand and G. Malandain. A new characterization of three-dimensional simple points. Pattern Recognition Letters, 15:169-175, 1994. 9 W. T. Beyer. Recognition of Topological Invariants by Iterative Arrays. Ph.D. Dis- sertation, M.I.T., 1969. 10 R. E. Cypher, J. L. C. Sanz, and L. Synder. Algorithms for image component labeling on SIMD mesh-connected computers. IEEE Trans. Computers, 39:276-281, 1990. 11 A. L. DeCegama. The Technology of Parallel Processing: Parallel Processing Archi- tectures and VLSI Hardware, volume 1. Prentice-Hall, Englewood Cliffs, NJ, 1989. 12 M. J. B. Duff and T. J. Fountain, editors. Cellular Logic Image Processing. Academic Press, New York, 1986. 13 Y. Feldman and E. Shapiro. Spatial machines: a more realistic approach to parallel computation. Comm. ACM, 35:61-73, 1992. 14 T. J. Fountain and M. J. Shute, editors. Multiprocessor Computer Architectures. North-Holland, Amsterdam, 1990. 15 M. Gokmen and R. W. Hall. Parallel shrinking algorithms using 2-subfields ap- proaches. Comput. Vision Graphics Image Process., 52:191-209, 1990. 16 M. J. E. Golay. Hexagonal parallel pattern transformations. IEEE Trans. Computers, 18:733-740, 1969. 17 W. X. Gong and G. Bertrand. A simple parallel 3D thinning algorithm. In Proc. lAPR 10th International Conference on Pattern Recognition, pages 188-190, Atlantic
• 98. 96 City, NJ, 1990. 18 Z. Guo and R. W. Hall. Parallel thinning with two-subiteration algorithms. Comm. ACM, 32:359-373, 1989. 19 K. J. Hafford and K. Preston. Three-dimensional skeletonization of elongated solids. Comput. Vision Graphics Image Process., 27:78-91, 1984. 20 R. W. Hall. Fast parallel thinning algorithms: parallel speed and connectivity preser- vation. Comm. ACM, 32:124-131, 1989. 21 R. W. Hall. Connectivity preserving parallel operators in 2D and 3D images. In Proc. SPIE Vision Geometry Conference, pages 172-183, Boston, MA, 1992. 22 R. W. Hall. Tests for connectivity preservation for parallel reduction operators. Topol- ogy and Its Applications, 46:199-217, 1992. 23 R. W. Hall. Optimally small operator supports for fully parallel thinning algorithms. IEEE Trans. Pattern Anal. Mach. Intell, 15:828-833, 1993. 24 R. W. Hall. Connectivity preservation tests for parallel reduction-augmentation algo- rithms. In Proc. lAPR 12th International Conference on Pattern Recognition, pages 245-250, Jerusalem, Israel, 1994. 25 R. W. Hall and S. Kucuk. Parallel 3D shrinking algorithms using subfields notions. In Proc. IAPR 11th International Conference on Pattern Recognition, Vol. I, pages 395-398, The Hague, The Netherlands, 1992. 26 R. M. Haralick and L. G. Shapiro. Computer and Robot Vision, volume 1. Addison- Wesley, Reading, MA, 1992. 27 C. J. Hilditch. Linear skeletons from square cupboards. In B. Meltzer and D. Michie, editors. Machine Intelligence 4, pages 403-420. American Elsevier, New York, 1969. 28 J. H. Jackson. The data transport computer: a 3-dimensional massively parallel SIMD computer. Technical report, WAVETRACER, Inc., Acton, MA, 1992. 29 C. V. Kameswara Rao, B. Prasada, and K. R. Sarma. A parallel shrinking algorithm for binary patterns. Comput. Graphics Image Process., 5:265-270, 1976. 30 S. Kawai. On the topology preservation property of local parallel operations. Comput. Graphics Image Process., 19:265-280, 1982. 31 S. Kawai. Topology quasi-preservation by local parallel operations. Comput. Vision Graphics Image Process., 23:353-365, 1983. 32 R. E. Kessler and J. L. Schwarzmeier. CRAY T3D: a new dimension for Cray research. Proc. IEEE Computer Conference, pages 176-182, Spring 1993. 33 J. Kittler and M. J. B. Duff, editors. Image Processing System Architectures. Wiley, New York, 1985. 34 T. Y. Kong. A digital fundamental group. Comput. and Graphics, 13:159-166, 1989. 35 T. Y. Kong. On topology preservation in 2-D and 3-D thinning. International Journal of Pattern Recognition and Artificial Intelligence, 9:813-844, 1995. 36 T. Y. Kong, A. W. Roscoe, and A. Rosenfeld. Concepts of digital topology. Topology and Its Applications, 46:219-262, 1992. 37 T. Y. Kong and A. Rosenfeld. Digital topology: introduction and survey. Comput. Vision Graphics Image Process., 48:357-393, 1989. 38 S. Levialdi. On shrinking binary patterns. Comm. ACM, 15:7-10, 1972. 39 H. Li and Q. F. Stout, editors. Reconfigurable Massively Parallel Computers. Prentice Hall, Englewood Cliffs, NJ, 1991.
• 99. 97 40 S. Lobregt, P. W. Verbeek, and F. C. A. Groen. Three-dimensional skeletonization: principle and algorithm. IEEE Trans. Pattern Anal Mach. IntelL, 2:75-77, 1980. 41 H. E. Lu and P. S. P. Wang. A comment on "A fast parallel algorithm for thinning digital patterns". Comm. ACM, 29:239-242, 1986. 42 C M . Ma. On topology preserving in 3D thinning. CVGIP: Image Understanding, 59:328-339, 1994. 43 G. Malandain and G. Bertrand. Fast characterization of 3D simple points. In Proc. IAPR 11th International Conference on Pattern Recognition, Vol. Ill, pages 232-235, The Hague, The Netherlands, 1992. 44 M. L. Minsky and S. A. Papert. Perceptrons, expanded edition. M.I.T. Press, Cam- bridge, MA, 1988. 45 D. G. Morgenthaler. Three-dimensional simple points: serial erosion, parallel thin- ning, and skeletonization. Technical Report TR-1005, University of Maryland, College Park, MD, 1981. 46 M. Noakes and W. J. Dally. System design of the j-machine. In Advanced Research in VLSI, Proc. Sixth MIT Conference, pages 179-213, 1990. 47 K. Preston and M. J. B. Duif. Modem Cellular Automata—Theory and Applications. Plenum Press, New York, 1984. 48 C. Ronse. Minimal test patterns for connectivity preservation in parallel thinning algorithms for binary digital images. Discrete Applied Math., 21:67-79, 1988. 49 A. Rosenfeld. Connectivity in digital pictures. J. ACM, 17:146-160, 1970. 50 A. Rosenfeld. A characterization of parallel thinning algorithms. Information and Control, 29:286-291, 1975. 51 A. Rosenfeld. Picture Languages. Academic Press, New York, 1979. 52 A. Rosenfeld and A. C. Kak. Digital Picture Processing. Academic Press, New York, first edition, 1976. 53 A. Rosenfeld and A. C. Kak. Digital Picture Processing, volume 2. Academic Press, New York, second edition, 1982. 54 P. K. Saha, B. B. Chaudhuri, B. Chanda and D. D. Majumder. Topology preservation in 3D digital space. Pattern Recognition, 27:295-300, 1994. 55 J. Serra. Image Analysis and Mathematical Morphology, volume 1. Academic Press, New York, 1982. 56 R. Stefanelli and A. Rosenfeld. Some parallel thinning algorithms for digital pictures. J. ACM, 18:255-264, 1971. 57 J.-I. Toriwaki, S. Yokoi, T. Yonekura, and T. Fukumura. Topological properties and topology-preserving transformation of a three-dimensional binary picture. In Proc. lAPR 6th International Conference on Pattern Recognition, pages 414-419, Munich, Germany, 1982. 58 G. Tourlakis and J. Mylopoulos. Some results on computational topology. J. ACM, 20:439-455, 1973. 59 Y. F. Tsao and K. S. Fu. A parallel thinning algorithm for 3-D pictures. Comput. Graphics Image Process., 17:315-331, 1981. 60 Y. F. Tsao and K. S. Fu. A 3D parallel skeletonwise thinning algorithm. In Proc. IEEE Conference on Pattern Recognition and Image Processing, pages 678-683, Las Vegas, NV, 1982.
• 100. 98 61 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. 62 T. Y. Zhang and C. Y. Suen. A fast parallel algorithm for thinning digital patterns. Comm. ACM, 27:236-239, 1984.
• 101. Topological Algorithms for Digital Image Processing T.Y. Kong and A. Rosenfeld (Editors) © 1996 Elsevier Science B.V. All rights reserved. 99 Skeletons of planar patterns Carlo Arcelli and Gabriella Sanniti di Baja Istituto di Cibernetica, CNR 80072 Arco Felice, Naples, Italy This chapter develops basic topics concerning the skeletonization of planar patterns in binary pictures digitized on the square grid, and focuses on some aspects of existing skeletonization methods designed for implementation on conventional sequential computers. More details on iterative, non-iterative, and other methods, as well as a comprehensive list of references, can be found in [1,2]. 1. INTRODUCTION Skeletonization of a digital pattern is a process leading to the extraction of a piecewise curvilinear subset, the skeleton, which is spatially placed along the medial region of the pattern. A skeleton is a stick-like representation of the pattern and, depending on the problem domain, is expected to account for different shape properties, such as symmetry, elongation, width, and contour curvature. Most of the research on skeletonization has been influenced, at least implicitly, by the work of Blum dealing with a geometry based on the primitive notions of a symmetric point and a growth process [3-5]. In a continuous pattern, a point p is called symmetric if at least two points of the boundary exist, such that their distances from p are equal to the distance from p to the boundary. For every symmetric point, the associated maximal disc is the largest disc, obtained by growth of the symmetric point, which is contained in the pattern. The set of symmetric points, each labeled with the radius of the associated maximal disc, constitutes a skeleton of the pattern. The pattern can be exactly reconstructed as the union of the maximal discs, the envelope of the discs being the pattern boundary. Skeletonization can also be understood by referring to the propagation of fire fronts. Consider a flat uniform field of dry grass embedded in an environment of wet grass, and imagine that, at a certain instant of time, a fire is lit simultaneously at all points on the boundary of the field. As time passes, the fire front propagates towards the inside with uniform velocity and disappears wherever it intersects with itself. This occurs at those internal points of the pattern, called extinction points, which are reached by the fire at the same instant of time from different boundary points. Due to the constant velocity of
• 102. 100 propagation of the fire front, any extinction point is a symmetric point as defined in the last paragraph. The extinction points form a connected piecewise curvilinear set, centered within the pattern. If each extinction point is labeled with the value of the instant at which it is reached by the fire front, the set of labeled extinction points constitutes a skeleton of the pattern. In the digital case, unit velocity is usually assumed for the fire front. After one unit of time, all the pixels at unit distance from the fire front are reached. The label of any pixel is then equal to the distance of the pixel from the complement of the pattern. Distance is generally computed using the "city- block" or "chessboard" distance function. For these functions, a "disc" is diamond-shaped or square-shaped, respectively. The set of pixels where the fire extinguishes includes all the centers of the maximal discs, i.e., the discs not properly included in any other disc, and the union of the maximal discs coincides with the pattern. Let B and B respectively denote a digital pattern and its complement, and let S indicate a set resulting from skeletonization. Although the structure of S depends on the algorithm employed for its computation, S always has one or more of the following properties: 1) S has the same number of components as B, and each component of S has the same number of holes as the corresponding component of B. 2) S is centered within B. 3) 5 is a unit-wide union of simple arcs and curves. 4) The pixels of S are labeled with their distances from B. 5) S includes the centers of the maximal discs of B. 6) S has arcs that correspond to regions of B bounded by contour subsets with sufficiently high curvatures. Algorithms to generate S have been called, besides skeletonization, also thinning and medial axis transformation, and the set S has received names such as medial line, medial axis transform, skeleton, and labeled skeleton. Classifying existing algorithms by using the names assigned to them by their authors could lead to transformations with the same name, but producing different results. To avoid such ambiguity, we use the following classification. The process is called thinning, if S has properties 1), 2) and 3); medial axis transformation, if S has properties 2), 4) and 5); curvature skeletonization, if S has properties 1), 2), 3), and 6); and labeled skeletonization, if S has properties 1), 2), 3), 4), and 5). In the future we will only use the term "skeletonization" to refer to either of the two last mentioned types of processes. Thinning is a topology preserving transformation, generally applied to elongated patterns with nearly constant thickness, which produces a set S whose structure is almost independent of both small size contour inflections and large, gentle contour convexities. Intuitively, thinning reveals the underlying linear structure of a pattern. Medial axis transformation produces a set, the MAT, that is suited for storage of patterns of any size and shape [6]. Even if the set of MAT pixels is not the minimal set that allows exact reconstruction of the pattern, the compression obtained by the MAT is of interest, because MAT computation can be accomplished in a fairly simple way. The use of the MAT for shape description purposes is questionable, since generally the MAT does not reflect the topological properties of a pattern.
• 103. 101 Skeletonization is preferred whenever S is expected to represent patterns characterized by relevant contour inflections, or patterns having neither constant nor negligible thickness [7]. Skeletons turn out to be powerful shape descriptors, as they combine both region and contour information. The curvature skeleton has a geometry strongly conditioned by the presence of perceptually significant contour pixels. The labeled skeleton is of interest when thickness information is crucial (as in Figure 1). The labels increase the representative power of the skeleton branches, and allow context-dependent skeleton pruning. ILHH111111111111TOT1 yillllllllllllllfflS Figure 1. Two differently shaped patterns having the same curvature skeleton. 2. NOTATIONS AND BASIC NOTIONS 2 . 1 . Preliminary notions Let A be a rectangular array of pixels, each of which has value 1 or 0. Pixels with value 1 are called black, and pixels with value 0 are called white. In this chapter we will consider the effect of different skeletonization algorithms on A. B will denote the set of black pixels in A, B the set of white pixels in A, and m,n the adjacency relations respectively used to define connectedness on B and B fsee [8]). Here (m,/i) is either (4,8) or (8,4). We write d4 for the city-block distance induced by the 4-adjacency relation and dg for the chessboard distance induced by the 8-adjacency relation. The frame of A is the set of all pixels in the first or last row of A, or the first or last column of A. Except where otherwise stated we assume throughout this chapter that B is m-connected. (This involves no significant loss of generality since the effects of the skeletonization algorithms we discuss on any one m-component of B would not be changed by the presence of other m-components of B.) Note that B may have holes - i.e., B need not be n-connected. We assume, again without loss of generality, that B does not meet the frame of A. Neighbors. For every p in A, let N*(p)={nfc I l<i5:<8}, where n;,..., ng are the pixels successively encountered while going clockwise around p starting from the pixel to the west of p. If pixels p and q are both in B, we say that p and q are neighbors if they are m-neighbors; if they are both in B, or one is in B and the other in B, we say that they are neighbors if they are /i-neighbors. A pixel p is said to be a neighbor of a set of pixels C if p is a neighbor of some pixel in Q.
• 104. 102 ^ f ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ g ^ ^ ^ ^ ^ ^ ^ ^^SSSS^^^ a) b) Figure 2. Black pixels denote skeleton elements. The 90° corner configuration is preserved (a) when m=4, and not preserved (b) when m=8. The contour C of B is the subset of B whose pixels are neighbors of B. The skeleton is a subset of B, and as such it should be m-connected. In fact, the skeleton may be the result of an iterated process which at every iteration removes from the contour of the current set of black pixels (i.e., changes from black to white) only pixels whose removal does not alter the m-connectedness of B, Therefore, requiring the same type of connectedness for B, C and 5 is a good starting point for developing a skeletonization algorithm. If different types of connectedness are used for these three sets, ad hoc rules become necessary to avoid obtaining a disconnected S or creating spurious branches. The choice of m is not crucial in skeleton computation, but can be influenced by the class of patterns to be skeletonized. For instance, m=4 is preferable for patterns that are understood as unions of upright rectangles, because the resulting skeleton shape better resembles the pattern shape; see Figure 2. Often 8-connected skeletons are preferred, due to their greater compactness and their ease of use in further processing. Thus, when 4-connectedness is adopted for the pattern, a reasonable compromise between shape and manageability of the skeleton is to reduce each 4-connected component of the skeleton to an 8- connected component. During this skeleton reduction 4-connectedness must be adopted for the background. In the following, we assume that, for either m, the skeleton consists of 8-arcs and 8-curves. A black pixel p is called a 4-internal pixel (8-internal pixel)^ if its 4- neighbors (8-neighbors) are all black. The interior of B is the set I=B-C. By definition of C, / consists of 4- internal (8-internal) pixels of B when m=8 (m=4). A set which is equal to its contour is called a thin set. The interior of a thin set is empty. __ __ The exterior of B is the set B. Each /i-component of B that does not contain pixels of the frame of A is called a hole in B.
• 105. 103 A path from pi to pn is a sequence of pixels pj, P2,'-.^ Pn where each pixel, except the first, is reached by a unit move from the preceding one. The permitted unit moves depend on the distance function used. Only horizontal/vertical moves are permitted when using J^, while diagonal moves can also be made when using dg. Each pixel in the path, except the first, is a neighbor of the preceding pixel. If weighted distance functions are used, other kinds of unit moves may be allowed. Each kind of unit move is assigned a length. The lengths of the unit moves are called their weights, A 3x3 local operation updates the value of each pixel p, not in the frame of A, to a function of the current value of p and the values of p's 8-neighbors. An operation is said to be sequential if the pixel values are updated one pixel at a time, so that if a pixel p is processed before its neighbor q, then the updated value of p is used in computing the new value of q. An operation is said to be parallel if the values of all pixels are updated simultaneously. A parallel operation can be simulated on a sequential computer by scanning the picture twice. During the first scan the new values of all pixels are computed and stored in an auxiliary array, but the pixels' values are not changed. During the second scan the value of each pixel is changed to the value stored in the array. A sequential operation can be performed more efficiently on a conventional sequential computer than the corresponding simulated parallel operation, because the picture only has to be scanned once. Shrink and expand are examples of parallel operations: i) The 4-shrink operation removes from B (i.e., changes from black to white) the pixels of B which have at least one white njt, k odd. The 8-shrink operation removes from B the pixels of B which have at least one white nk, <k<%. _ ii) The 4-expand operation removes from B (i.e., changes from white to black) the pixels of B which have at least one black njt, k odd. The 8-expand operation removes from B the pixels of B which have at least one black njt, l<k<%. 2 . 2 . Skeleton elements Due to the discrete nature of the digital plane, the skeleton does not generally completely fulfil the properties mentioned in the Introduction. For instance, the labeled skeleton seldom includes all the centers of the maximal discs, because this requirement is not compatible with unit width. Moreover, unit width may be prevented by the topology preservation requirement, which implies that the skeleton may include internal pixels. Only an ideal skeleton 5,-^ can be thought of as a concatenation of 8-arcs and 8-curves, where each pixel has at least two opposite /i-neighbors, nk and nk-^4, which are white. Skeletonization can be accomplished by using iterative algorithms to process the contour pixels in an a priori given order. At each iteration, pixels in the current contour are removed provided that they are not associated with the tips of significant protrusions of B (generally referred to as end points), and that their removal does not change the topology of the picture. An alternative criterion, based on the notion of multiple pixels on digital contours, can be
• 106. 104 used to identify all the pixels not to be removed. An iterative algorithm produces a finite sequence of sets Bj^B, B2, B3,..., Bf, in which each set includes its successor, and Bf is generally a thin set. If Bf is unit wide, it is the skeleton S. Otherwise, it is called the set of skeletal pixels, and is denoted by SP. In this case, further processing is required to obtain S from SP, A different approach is to identify and mark as skeletal pixels the pixels associated with suitable local configurations of the distance transform of B. Algorithms which work in this way are said to be non-iterative. In general the set of skeletal pixels produced by a non-iterative algorithm is not unit wide, and further processing is again required to obtain a skeleton. The resulting skeleton is a labeled skeleton. In general, the same process can be used to reduce SP to S, independently of whether iterative or non-iterative algorithms were used to obtain SP. In fact, the role of this process is just to reduce SP to unit width. S can also be pruned to produce a skeleton with a simpler structure that still satisfactorily represents B. Finally, it is sometimes desirable to remove or shift pixels, so as to get rid of jaggedness and beautify 5. The skeleton consists of three types of pixels, termed end points, normal points, and branch points. End points are extremes of arcs and correspond to tips of pattern protrusions; branch points are common extremes of two or more arcs/curves and correspond to overlaps of pattern subsets. To distinguish the pixels of an ideal skeleton Sid, the following two equivalent criteria can be employed: Def. 1. A pixel p of Sid is called an end point, normal point, or branch point, depending on whether the number of its black m-neighbors is 1, 2, or greater than 2. Def. 2. A pixel p of Sid is called an end point, normal point, or branch point, depending on whether the number Vp of n-connected components of white pixels in N*(p) is 1, 2, or greater than 2. These definitions are no longer equivalent when dealing with a non-ideal skeleton S. This can be seen in Figure 3a-b, in which m=8 and /i=4. In particular, some pixels classified as branch points by Def. 1 are classified as end points or normal points by Def. 2. Moreover, some pixels classified as end points by Def. 2 are classified as branch points or normal points by Def. 1. Thus, neither of these two definitions is adequate to classify the pixels of 5. A new definition, leading to the classification shown in Figure 3c, is suggested below. Def. 3. A pixel p of 5 is classified as: an end point if Vp =1. a branch point if it is not an end point and has more than two black neighbors and, if Vp =2, it has no black neighbor q for which Vq >2. a normal point if it is neither an end point nor a branch point.
• 107. 105 |o| l»oooo^¥l a) loooooooi [•PC ^ b) i09 J*L poooo©¥»l MM.doom c) po| poo©> o ® o t Figure 3. Pixels marked with black, gray, and white dots indicate end points, normal points, and branch points, respectively. In (a), (b), and (c), Def. i, Def. 2, and Def. 3 are respectively used. A simple arc contained in S that has non-normal points at its extremes is called a skeleton branch. An elementary skeleton branch is a branch whose points are all normal except for the two extremes. A peripheral skeleton branch is an elementary skeleton branch that has at least one end point. A simple closed curve contained in S is called a loop of S if its inside contains a hole of S and each of its points is adjacent to that hole. 2 . 3 . Protrusions Shrink and expand operations can be used to give a simple classification of protrusions. We will illustrate this by examples (Figures 4-6) for the case (m,n)=(4,8). Let lie, ^^1» be the set of black pixels at distance greater than k from B, obtained by applying the n-shrink operation k times to B. Let £j be the set generated by applying the /i-expand operation k times to I^. Let h, h>l, be the smallest integer such that Ih is non-empty and £j is not all of 5 (assuming that such an integer exists). Let Rh-B-E)^. If B and B-R^ have the same number of m-components and the same number of holes, each m-
• 108. 106 component of Rfi is said to be a {minimal-thickness) protrusion of B. The thickness of the protrusion is 2h. (Note that this definition does not allow a protrusion to have odd thickness.) In Figure 4 we have /i=l, and the dark gray regions show Rh- The regions in Figure 4a-d are protrusions, while those in Figure 4e,f are not protrusions. (Note that even the region in Figure 4c has thickness 2 by our definition.) i„ lue I a) b) - t t i 1 1 1 1 I t I i | | | ] i | | [ | | | l i i i i t l i l i l c) 1 [ 1 1 { 1 i 111 1 ' LJ1HIM1 • l"l'1 • 1 1. 1 [ i ] 1 1 1 f"!' 1 "1 : | | | | . | { | | . i | 1.1 { 1. 1 1 1 i I i 1 J d) e) f) Figure 4. The dark gray regions are obtained by subtracting from the pattern the light gray regions, resulting after applying the n-expand operation to the regions delimited by heavy lines. Now consider Ej for each j>h such that Ij is not empty. For simplicity, suppose that each Rj consists of one m-component. It may happen that for all such y, Rj=Rh (e.g., see Figure 4a and Figure 5a, where Rh (h=l) and Rj (2<j<5) are respectively shown); such an Rj is called a constant-thickness protrusion. Otherwise, let t be the minimal value of 7 such that E^^Ej . Then Rf properly includes Rh- The regions Rh and Rt are respectively shown in Figures 4 and 5. Any of the following cases (or a combination of them) may occur: 1) Rt satisfies the definition of a protrusion of thickness 2r, but its included Rh consists of more than one m-component; see Figure 5b, where r=3.
• 109. 107 In this case Rf is called a multiple protrusion. 2) Rf satisfies the definition of a protrusion of thickness 2t, and its included Rh consists of only one m- component; see Figures 5c,d, where r=3 and r=2 respectively. In this case Rt is called a tapering protrusion. 3) Rf satisfies the definition of a protrusion of thickness 2t, but B-Rh is not connected; see Figure 5e, where r=3. In this case Rt is called a bulbous protrusion. 4) Rf does not satisfy the definition of a protrusion; see Figure 5f, where r=3. J™ J. a) b) 1 d) e) f) Figure 5. The dark gray region is (a) a constant-thickness protrusion, (b) a multiple protrusion, (c,d) a tapering protrusion, (e) a bulbous protrusion. The dark gray region (f) is not a protrusion. Every Rt is associated with a subset St of the labeled skeleton of J5. In the examples in Figures 4,5, when Rt is a constant-thickness protrusion, St is a peripheral skeleton branch along which the labels have the same value. When Rt is a multiple protrusion, St includes more than one peripheral skeleton branch. When Rt is a tapering protrusion, 5^^ is a peripheral skeleton branch along which the labels increase starting from the end point. When Rt is a bulbous protrusion, St is a peripheral skeleton branch along which the labels decrease
• 110. 108 starting from the end point. Finally, when Rt is not a protrusion, St is not a peripheral skeleton branch. A tapering protrusion can be interpreted as a concatenation of protrusions with constant thicknesses (bricks, for short). A constant-thickness protrusion is a special case of a tapering protrusion that consists of just one brick. The n-shrink operation can be used to compute the jut of a tapering protrusion. To compute the jut of a single brick with thickness 2J, it is necessary to apply the n-shrink operation (s-l) times to the set of black pixels, so as to reduce the brick to a set Q consisting entirely of contour pixels. The jut of the brick is one less than the number of unit moves in a minimal length 8- path passing through pixels of fi, and linking Is to a pixel on the tip of Q. For instance, to compute the jut of the brick of thickness 25, 5=3, shown as the hatched region in Figure 6a, two applications of the n-shrink operation are necessary. In Figure 6b, the set Q is the hatched region, and the set Is is the region delimited by heavy lines. The jut of a tapering protrusion is obtained by adding the juts of its constituent bricks. n I I - - ' L - . •"::.. S L : - a) b) Figure 6. (a) A tapering protrusion consisting of two bricks. The set hatched in (b) results from the brick hatched in (a) after twice applying the 8-shrink operation. 2.4. Distance transform The discrete distance between two pixels p and q is the length of a shortest path from p to q. The degree of approximation to the Euclidean distance (or to a multiple of it) depends both on the unit moves used to build the path, and on the weights assigned to the unit moves when these have different Euclidean lengths. When the city-block distance function d4 is used, the (horizontal/vertical) unit moves have the same Euclidean length, and a unique weight (wj-l) is adopted. When the chessboard distance function dg is used, although the unit
• 111. 109 horizontal/vertical moves and the unit diagonal moves have different Euclidean lengths, equal weights (wi=W2=l) are adopted. The distance transform of B with respect to B is a replica of B, whose pixels are labeled with their distances from B, computed according to the chosen distance function. In what follows, if no ambiguity arises, lower-case letters will be used to denote both the pixels and their associated distance labels. Within By distance information can be propagated from any pixel to any pixel reachable by unit moves; as a result, local operations turn out to be sufficient to create the distance transform of B. Two sequential operations fi(p) and f2(p) are applied to every p in B, during a forward and a backward raster scan of the picture, respectively. Forward scan: fi{p)= min {/li+w;, n2+W2, Wi+w;, /14+W2} Backward scan: fiip)- ^in {p, nj+w;, n6-^W2, ny-^wi, n8-^yv2) For w;=w2 = l, and for wi- and ^2=*^, these operations compute the distance transform DT with respect to dg and ^^, respectively [9]. Introducing the weight W2=*^^ for the diagonal moves not permitted by d4 allows one to treat in a homogeneous way distance transforms computed over a 3x3 support. J p^ W3 4^-Wi Figure 7. Pixels reachable from p by unit moves of weight w;, W2 and wj. To get a closer approximation to Euclidean distance, different weights can be used for the unit moves. The resulting distance function is called a weighted distance function. To avoid resorting to real numbers, suitable integer weights are used. A thorough investigation of the weighted distance transform (WDT) and weight selection can be found in [10-12]. A good approximation is obtained by using the weights Wi=3 and W2=4, when only horizontal/vertical and diagonal moves are permitted. Different values can be chosen for the two weights, provided that H'i<W2:^2w7. If the knight's move (in the game of chess) is also permitted (see Figure 7), a third weight wj is introduced. In this case, the constraints on the values of the weights are: Wi>2w7; 2H'5>3W2; vi/5<Wi+W2. The triple of values (5,7,11) is suggested as a suitable choice for (w7,W2,W3). To compute the WDT when the knight's move is permitted, fi(p) 2ind f2ip) must be suitably modified by adding further arguments. A sequential algorithm for the computation of the Euclidean distance transform, EOT, was proposed in [13]. It uses two scans over the image, where
• 112. no each scan goes forward and backward over each row. The algorithm is not perfectly accurate. Improvements in both computational cost and accuracy can be found in [14]. A pixel p in the distance transform, DT or WDT, belongs to the k-ih layer if wiy.{k-)<p<wixik. The layers of the DT are equilabeled sets of pixels (since W7 = l in the DT), and they are unions of 4-connected curves or of 8-connected curves depending on whether dg or d4 is used to compute the DT. The layers of the WDT may contain differently labeled pixels, and can be described as unions of curves whose type of connectedness is not constant. Any pixel p in the DT (WDT) is the center of a disc Dp that is contained in the transform and includes pixels of the first layer. For each /?, Dp can be constructed using an auxiliary array in which all pixels are white except for one pixel, which is labeled p and is placed in the position corresponding to that of p in A. Two sequential local operations, £]{q) and £2{(l)^ are applied to every pixel q not in the frame of the auxiliary array, during a forward and a backward raster scan of the array, respectively. In the case of two weights, these operations are as follows: Forward scan: Si(q)= 'wojc {q, nj-wj, n2~W2y ns^wj, n4-W2} Backward scan: £2(q)= fnax [q, /15-W7, n6~W2j nj-wjy ^15-^2} After these operations have been performed, the set of pixels with values different from zero is just Dp. Its radius is given by (p^h), where h is the minimal value in Dp and identifies the pixels at maximal distance from p. When Wi = l (as in the cases of the city-block and chessboard distances) we have h=l. Size comparison among discs can be accomplished by comparing the labels of their centers. The disc Dp can be understood as "circular", although it is square-shaped (diamond-shaped) in the case of the chessboard (city-block) distance. For wj^ly not all the above statements are true. When using £2 and £2 to build the disc Dp, the value given to any pixel q is max(p-dyv, 0), where Jvf is the weighted distance from p to q. In the weighted distance transform of a set (Dp, having the same shape and size as Dp, the labels of some pixels may differ from the labels of the corresponding pixels in Dp. In other words, the value of pixel q in Dp is not necessarily the same as the weighted distance of q from the set of white pixels, as obtained by computing the WDT of (Dp using / ; and ^ . In particular, the pixels labeled w; in the WDT of (Dp correspond to pixels having different labels q, 1<^<W7, in Dp. The pixels of Dp with the minimal value h need not constitute a connected set. Moreover, it is not true that h is always equal to 1, whatever the label of p. Although h>l for only a small number of labels of p, this possibility implies that two discs may be of the same size even if their centers have different labels. The only labels permitted in the WDT are linear combinations of the Wi with non-negative integer coefficients. Thus, if each label p is stored in position p of a table, blank entries will occur. It is straightforward to check that in the disc centered on any label immediately preceded in the table by at least one blank
• 113. Ill entry, no pixel with value 1 is present. In this case, the notion of least equivalent label is of interest. Consider two labels, say p and p+r (r>l), separated in the table by r - 1 blank entries. All the discs Dp+sy l^s<r, coincide in shape and size, but only Dp+7 includes pixels with value h=l. The value p+l is called the least equivalent label of p+r, although it is not a label permitted in the WDT. For instance, in the WDT where the weights wi = S and ^2 = 11 are used, 20 is the least equivalent label of 22. See Figure 8. fl 4 1 1 9 12 9 1 4 12 20 12 4 1 9 12 9 1 1 4 1 2 5 2 2 10 13 10 2 5 13 21 13 5 2 10 13 10 2 2 5 2 3 6 3 3 11 14 11 3 6 14 22 14 6 3 11 14 11 3 3 6 3 Figure 8. The pixels labeled 20, 21 and 22 are centers of discs of equal size and shape, built by using weights w]=S and W2=ll- The disc Dp is called a maximal disc if it is not properly included in the disc associated with any other pixel in the DT (WDT). To check this condition, it is not necessary to resort to the disc building process. A comparison among the (least equivalent) label of/? and the (least equivalent) labels of all the nic {l<k< 8) is sufficient [15,16]. The pixel p is the center of a maximal disc if for every qEN*{p), we have q < p+Wi where /=1 if ^ is a 4-neighbor of p, and i=2 otherwise. In the DT the center of a maximal disc is a pixel whose label is not smaller than the labels of any of its neighbors, and is called a local maximum. In the WDTy the centers of maximal discs do not necessarily have locally maximal labels. If the operations £j and £2 are applied to any subset of the DT (WDT) of B that includes all the centers of the maximal discs, the set obtained has the same shape and size as B. In fact, the operations give the union of the discs centered at the pixels of the chosen subset of the DT (WDT). Among these discs, only the maximal ones make contributions to the union. 3. ITERATIVE ALGORITHMS Skeletonization can be accomplished by using sequential or parallel 3x3 operations, applied by scanning the picture in a raster fashion, or by contour tracing or contour generation.
• 114. 112 3 . 1 . Topology preserving pixel removal operations A black pixel p is m-deletahle if its removal does not change the number of n- holes and of m-components in the set of black pixels. It has been proved that if removal of p does not alter the topology of the 3x3 window centered at /?, then p can be safely removed, since topology is also globally maintained [17], and so p is m-deletable. More precisely, a 3x3 topology preserving removal operation may change a non-isolated pixel p from black to white if a hole is not created, and m-connectedness is not broken, in the set of black pixels in the 3x3 window centered at p. A hole is not created if/? is a neighbor of a component of white pixels, i.e., if at least one of the rik is white, with k=[ 1,3,5,7} if m=8, and A:={ 1,2,...,8} if m=4. Assuming that removal of p does not create a hole, various arithmetic checks can be performed to determine whether disconnection occurs. These checks involve the crossing number Xmip) [18,19] or the connectivity number Cmip) [20]. These_numbers are defined by the following four expressions, where n9=njy and njc = l^n^: C/P)= X (n2k-l--'^2k-l """^Ik ^^^2^+7) k= ri, if /i2;^_^ = 0 and X8{p)=J.hj^ where h^A ^'^^^' ''2k = ^ ^^ ""ik^i^^ 4 J k = 1 [0, Otherwise 4 C 5 ( p ) = X ^'^ik^i-'^ik-i'^'^ik'^'^ik^? k = Xsip) and Cgip) count the 8-components of black pixels in N*{p)y and so are always equal. X^(/7) counts the number of 4-components of black pixels in N*{p)y and C^Cp) counts the number of these components of which p is a 4- neighbor. Removal of p does not disconnect B if there is just one m-component of black pixels in N*(p) of which p is an m-neighbor. Since removal of a 4-deletable pixel does not change the number of 8- components of black pixels, X^(p) and C4(p) can also be used when skeletonizing an 8-connected B. (Of course, in order for 4-deletability to imply 8-deletability, it is necessary that one of the rik be white, with k odd.) The use of X^(p) or C4(p)y rather than Xsip) or Q(p)» although it does not allow us to remove all the 8-deletable pixels, yields better shaped skeletons for certain classes of patterns. The design of ad hoc 8-deletability rules allows one to
• 115. 113 preserve 8-connectedness (but not 4-connectedness), while producing a well shaped result. There are other conditions that guarantee preservation of connectedness when removing a black pixel p that is a neighbor of an n-component of white pixels. For instance, removal of p does not break 8-connectedness if one of the following relations holds [21]: /l7X/l5x(n5+7l7-n6+l)>l njxnjx (n^+n 7-n8+l)>l n5xn7x(ni+/i5-n2 +1)^1 nyxn iy.{n5--n3- n4--)> Furthermore, as there is a one-to-one correspondence between the configurations of the black and white pixels in N*{p) and the numbers 0-255, a look-up table can be used to determine m-deletability [22]. 3 . 2 . End point detection The validity of a skeletonization process also depends on the amount of perceptually significant information about B that the skeleton retains. There should be a correspondence between peripheral branches of the skeleton and significant protrusions of B or, more generally, convex parts of B bounded by perceptually significant contour arcs. We first discuss the detection of end points in the case of protrusions. A peripheral skeleton branch should lie in the medial region of any protrusion. The end point is expected to correspond to the tip of the protrusion, and its identification is crucial in skeletonization. Since end points are m- deletable pixels, the skeleton branches are likely to be shortened or even to disappear if the end points are not retained. A criterion based on the number of black neighbors is not effective in detecting end points during skeletonization, since this number usually depends on the order in which removal operations are applied. Thus, it cannot be guaranteed that all and only the expected end points are correctly identified, since during removal some protrusions may be flattened, while regions bounded by smooth contour arcs may be sharpened. Increasing the number of black neighbors a pixel can have in order to be defined as an end point does not necessarily favor the detection of expected end points, and it tends to increase the number of spurious end points. Pixels embedded in the same configuration, whatever its position or orientation, should all be classified as end points or as non-end points. The end points that correspond to tips of protrusions should therefore be detected in parallel. Afterwards, skeleton pruning can be performed to identify the peripheral branches which are significant. Errors in end point detection can also be reduced by preliminary application of suitable cleaning operations. Including cleaning as a preliminary step is always advisable, especially for filling noisy holes in the set of the black pixels. Otherwise, the skeleton will include loops surrounding the noisy holes, which irreparably modify its structure.
• 116. 114 A more effective end point detection criterion, employing a threshold 6 on the minimal jut a protrusion should have in order to be understood as significant, is described in [23]. The value of d depends on the orientation and shape of the protrusion, as well as on the metric used to detect the protrusion by shrink/expand operations. The jut of a protrusion R is not less than 6, if at a certain iteration, say the ^-th, at least one pixel of the current contour Cjt is at a distance greater than 6 from the current interior. If all the pixels of Ck at a distance greater than 6 are marked, the connected components of marked pixels identify significant protrusions. In such cases, the marked pixels are not removed, while the remaining pixels of Ck are removed, if they are m-deletable. If this is done for each ky spurious end points are not created, and the resulting skeleton has branches that correspond to the significant protrusions. For a fixed value of 6, the skeleton branches found in this way correspond to protrusions that have jut at least 0, regardless of their thickness (refer to Figure 9, where d=2). By allowing the value of d to depend on k, it becomes possible to define protrusion significance in terms of both thickness and jut. n Figure 9. The dotted pixels are end points of skeleton branches arising from two protrusions having the same jut, but different thickness, and found at the third and fifth iterations of the skeletonization process. The appropriate value of 6 depends on the problem domain. However, this dependence is not easy to formulate when working in the discrete plane and with discrete metrics. If a small value is chosen for d, in order to detect the bricks constituting the smoothest tapering configurations one wishes to represent in the skeleton, non-significant protrusions will also be detected. On the other hand, a higher value of 6, chosen to avoid detection of non-significant protrusions, leads to a skeleton that also lacks branches corresponding to tapering protrusions consisting of non-negligible numbers of bricks having small juts. A compromise usually cannot be reached at the stage of end point detection. Thus, it is convenient to choose a small value for 6, and postpone to a later pruning step removal of skeleton branches that do not represent protrusions having significant juts. End point detection can also be guided by contour curvature information; this is appropriate when constructing the curvature skeleton. One can take as end points the pixels that perceptually dominate contour arcs which delimit convex portions of B and whose curvatures are sufficiently high. If these pixels (often
• 117. 115 referred to as dominant points) are not removed, they become end points of peripheral skeleton branches. The resulting skeleton structure does depend on the shape of the contour, and can be used to discriminate among patterns which differ in their contour curvature. Since dominant points can identify the tips of significant protrusions, this criterion also offers a partial solution to three problems which otherwise may arise in end point detection. The first problem occurs in connection with identically shaped, but differently oriented protrusions. These are not always mapped consistently into skeleton branches. The second problem concerns protrusions which barely protrude, but have juts comparable with that of a brick of a tapering protrusion. The third problem occurs in connection with certain simple protrusions whose sizes and shapes are not modified by the iterated process. (See Figure 10.) Such a protrusion does not give rise to a peripheral skeleton branch, but only distorts the geometry of the skeleton subset associated with the region from which the protrusion juts out. This phenomenon also depends on the orientation of the protrusion. Figure 10. Skeleton obtained when 8-connected contours are iteratively processed. The protrusion is not mapped into a peripheral skeleton branch. If dominant points related to curvature minima, as well as maxima, are accepted as end points, the resulting skeleton has branches originating from both contour convexities and concavities. Several procedures for detecting dominant points can be found in the literature (see for instance [24], which discusses the performance of many of them). The following method [25] has been used in the context of skeletonization (e.g., [26,27]). A curvature N-code cf is assigned to the i-th contour pixel by using the differential chain codes Cj [28], in a contour neighborhood of size (2N-1) pixels. Each c^, N>1, is derived from the cj's by means of the following expression: A^-1 cf = Nxci + Z {N-k)x{ci.k + ci^k ) it=l The value of N need not be large; for instance, iV=4 was sufficient to identify the dominant points on chromosome contours [25].
• 118. 116 Depending on the class of patterns to be analyzed, one can compute the ^ - codes associated with the pixels lying on the smoothest, but still significant contour arcs that are expected to occur. The largest of these iV-codes is then used as a threshold T. In any connected set of pixels whose ^-codes are not less than r, one of them is selected as an end point. By varying r, different sets of end points, and hence different skeletons, can be obtained for a given pattern. In particular, increasing T results in skeletons that have branches only for sharper and sharper convex regions [26]. It is difficult to find a significant set of dominant points when the contour contains details of different sizes. A curvature-based definition of dominant points is satisfactory only when the resolution at which the contour has to be analyzed is known. To overcome this problem, one can extract sets of dominant points at various resolutions, by changing the value of N in the ^-code. Skeletons at different resolutions can then be constructed and compared. Persistence of a branch over a number of resolutions indicates a high level of significance of the corresponding region [27]. 3 . 3 . Processing schemes Verifying whether p is a contour pixel and, if so, possibly removing it should not be done at every step of a raster scan when sequential operations are used, because this would produce a skeleton biased in the direction of the raster, and not centered within B. An example is shown in Figure 11, where the dark gray pixels are those remaining in B after one forward raster scan. In this example, all the pixels initially belonging to the interior of B are detected as contour pixels, because the pixels on their left were previously detected as contour pixels and immediately removed. This problem can be avoided if the identification of contour pixels and their removal are performed in different raster scans. Skeletonization requires a number of iterations proportional to the maximal thickness of B. Each iteration requires two steps (1. identification of the contour pixels; 2. deletion of the m-deletable contour pixels that are not end points); these steps are repeated until no m-deletable pixels remain. The interior of the resulting set is expected to be empty; some exceptions are discussed in Section 4. At each iteration, end point detection is the main problem. If pixels having just one black neighbor are detected as end points, the transformation is likely to be non-isotropic. (See Figure 12, where p and q are pixels that have the same neighborhood configuration. Here p may not be detected as an end point since, when it is checked for removal, it has more than one black neighbor. On the other hand, q may be identified as an end point since, when it is checked, two of its three initial black neighbors have already been removed.) Rather, end points should be tentatively identified using criteria involving protrusion jut (Section 3.2), or based on the notion of multiple pixels (Section 4). In both cases, the components of skeletal pixels found at a given iteration are likely not to be of unit width. The final identification of the end points is done at a later stage when the skeleton branches are reduced to unit width. (Reduction of the
• 119. 117 branches to unit width could also be accomplished iteratively, but generally this possibility is not of interest, as it requires a greater computational effort.) Figure 11. Bias caused by removal operations performed at every step of a raster scan. Figure 12. Pixels p and q may not both be detected as end points. Iterated deletion by means of repeated raster scans has cost proportional to the size of the array A, and to the maximal thickness oi B. By using contour tracing [26,29,30] or contour generation [31,32] the cost becomes proportional to the area of B. In contour generation based algorithms, only the initial contour is traced, and each successive contour is generated while identifying the skeletal pixels on the current contour. A method of constructing the labeled skeleton, which can be regarded as related to the contour generation approach, is described in [33]. The pixels of the skeleton are labeled with their distance values in the WDT computed using three weights. (Preliminary computation of the WDT is unnecessary, as this is generated in an auxiliary array during skeletonization.) Skeleton construction is performed in two stages. In the first stage, the pixels which are currently nearest to B are deleted, provided they are not centers of maximal discs, and are not needed to 8-connect two centers to each other. No end point detection criterion is required, as the tips of the protrusions are represented by centers of maximal discs. During the second stage, the set produced by the first stage is reduced to unit width, and some of its elongated parts are shortened by removing pixels that do not contribute significantly to the reconstruction of the original pattern from the distance values. As in [34], buckets are used to store the pixels at given distance from B, and to guide pixel deletion. A major advantage of the method is that the skeleton contains most of the centers of the maximal discs computed in a WDT that closely approximates the Euclidean distance transform; this provides, to a great extent, invariance under rotation and reconstructability of the original pattern. 4. MULTIPLE PIXELS The pixels that should not be removed at the it-th step of the iterated process are located where Bk is locally thin - that is, where Ck folds on itself. Thus,
• 120. 118 one can investigate the structure of Ck and identify the pixels at which folding occurs. In [35,36], it is shown that these pixels are multiple pixels, i.e., pixels that prevent Ck from being simple (as defined below). In the digital plane a simple curve is a set of black pixels dividing the set of white pixels into two connected subsets. The subset that contains the frame is called the outside of the curve, and the other subset is called the inside of the curve. Each black pixel is a neighbor of both the inside and the outside. Because of the structural similarity of curves and contours, the definition of a simple contour can be derived from that of a simple curve [35]. An important difference between curves and contours concerns the metrics to be used for the inside and the outside. When a curve is considered, both the inside and the outside of the curve consist of white pixels, so that the same metric is used for them. On the other hand, when the contour C of 5 is considered, its inside consists of black pixels and its outside consists of white pixels, so that different metrics are used for the inside and the outside. Note that if B is not simply connected, the outside of its contour also includes the holes of B, and so consists of more than one component. Moreover, in this case the contour may not be connected, whereas a simple curve is always connected. The contour C of 5 is termed simple if and only if the following conditions are satisfied: a) the inside of C is connected. P) removal of any pixel of C locally disconnects C. y) C Kj B and B have the same number of n-components. The third condition can be disregarded when B is simply connected. Conditions a)-y) do not provide a basis for identifying multiple pixels of C. For example, in the case of the contour shown in Figure 13, where only a) fails to be true, knowing that the inside of C is not connected is not enough to identify the pixel centered in the neck of the pattern as multiple. Figure 13. A non-simple 8-connected contour. In [36], two sets of conditions equivalent to «)-/) are given, for the cases m=8 and m=4, respectively. Only local checks are required to determine contour simplicity, and the multiple pixels are those at which any of the local checks fails to be satisfied.
• 121. 119 A contour C is simple if and only if both conditions (Jll-J^Z, for m=8; ^1- (B2, for m=4) are satisfied for each of its pixels p: Jll For some 1<A:<4 a pair of neighbors n2k'iy n2k+3 (modulo 8) exists in N*(p) such that n2k-i belongs to the inside and n2k+3 belongs to the outside. J^.2 No triple of neighbors n2k-i^ ^2ky ^ik-^-i (niodulo 8; <k<A) exists in N*(p) such that n2k belongs to C while n2k'i and n2k+i belong to the outside. CBl In N*(p) exactly two rik (k odd) belong to C and at least one Jik (l<k<S) belongs to the inside. ^2 No triple of neighbors n2k'Jy n2ky n2k+J (modulo 8; l<it<4) exists in N*(p) such that n2k belongs to C while n2k-i and n2k+i belong to the inside. Any component of multiple pixels has the following two properties: ^1 It is a thin set. ^2 It is 8-adjacent to the inside, if the inside is not empty. Validity of ^2 is proved in [36] for both 8-connected and 4-connected contours. Validity of fPi is guaranteed since a component of multiple pixels consists of contour pixels, and so cannot have interior pixels. Iterative deletion of non-multiple pixels can be used to construct an 8- connected set of skeletal pixels. At each iteration, when the non-multiple pixels are removed, the set of black pixels remains 8-connected. The process is iterated until the contour is completely made up of multiple pixels. Ordinarily, this will occur when the interior of the current set Bk of black pixels is empty. However, in some pathological cases, a contour consisting entirely of multiple pixels can exist when the interior of Bk is not empty. In either case, Bk is taken to be the set of skeletal pixels. The pathological cases occur only for patterns of two special types. In the first type (see Figure 14a) the contour of B contains subsets, symmetrically placed and possibly far apart, which at some iteration originate components of multiple pixels. At successive iterations, these components incorporate new multiple pixels and converge towards a common region. The distances between the components diminish until they merge into a single component surrounding a non-empty inside. The cardinality of the inside is 12 pixels in the worst case, when eight components of multiple pixels merge as shown in Figure 14a. When topology preserving deletion operations, coupled with end point detection, are applied to the set SP, some black pixels may be removed, but unit width is not necessarily attained. For instance, some pixels can be removed in Figure 14a, but none in Figure 14b, which is an irreducible set. In Figure 14c, an example of a pathological pattern of the second type is shown. The initial contour is lace-edged and surrounds an arbitrarily large
• 122. 120 inside. The contour is an irreducible set; in fact, no pixel can be deleted without altering the topology. m u m M tfil i i{ t {• ili t k i 1 • h 1i 1 Um 1 |i] P il 111 11 !•!• td # •t 1•if 1 • •f pi f)^ M sinWW a) b) c) Figure 14. The dots indicate pixels, multiple due to failure of either Al or J12, found on successive contours of pathological 8-connected patterns. If condition *B1 is replaced by condition ^1' below, and contour pixels for which (Bl' or ^2 fails are not removed at each iteration, the pixels that are not removed can be used as a set of skeletal pixels for skeletonization of 4- connected patterns. (Bi' In N*(p), at least one nic (1<A:<8) belongs to the inside, and p is a 4- neighbor of exactly two 4-components of contour pixels, each of which has cardinality less than 3. Using ^1' instead of (Bl still allows us to identify all the multiple pixels on a 4-connected contour. Moreover, each component of skeletal pixels on C^ is 4- adjacent, rather than 8-adjacent, to the current inside, and 4-connectedness is preserved during skeletonization. In fact, we can prove the following propositions. Proposition 1. In the case (m,n)=(4,8), if p is a multiple contour pixel either iBi' or ^ 2 fails. Proof. If p is multiple because of failure of !B2, the proposition is true. If p is multiple because of failure of (Bl, either no tik (l<k<S) belongs to the inside (and the proposition is true), or a number of rik (k odd) different from 2 belong to the contour. If just one /ijt (k odd) belongs to the contour, (Bl' fails because in N*(p) only one 4-connected component of contour pixels includes an /ijt (k odd). If more than two njc (k odd) belong to the contour, (Bl' fails since more than two 4-connected components of contour pixels exist in N*(p), and/or the cardinality of a component is greater than 2. D Proposition 2. Suppose (m,/i)=(4,8) and the inside is non-empty. Then each 4-component of the contour pixels for which ^1' or (B2 fails is 4-adjacent to the inside.
• 123. 121 Proof. Let K be such a 4-component. If ^2 fails the Proposition holds. If 'Bl' fails the following cases can occur. Case 1. S o m e p e ^ satisfies *B1. If any 4-neighbor of this p is a pixel of the inside then the Proposition holds, so suppose no 4-neighbor of p is a pixel of the inside. By (Bl, p is 8-adjacent to the inside, so we may assume without loss of generality that the south-east neighbor of p is in the inside. Then the south and east neighbors of p are not O's, so they are contour pixels. (Bl now implies that the north and west neighbors of p are not contour pixels, so that they are O's. But now p satisfies 'Bl', which is a contradiction. Case 2. No p in ^ satisfies (Bl. Here every pixel in ^ is a multiple pixel, so by Proposition 1, ^ is a 4- component of the multiple pixels. By property ^2, s o m e p e ^ is 8-adjacent to the inside. If this p is 4-adjacent to the inside then the Proposition holds, so suppose p is not 4-adjacent to any pixel of the inside. Without loss of generality the south-east neighbor of p is a pixel q of the inside, which implies that the south and east neighbors of p are I's. Thus the south and east neighbors of p are contour pixels. Since Bl fails, at least one other 4-neighbor of p is a contour pixel. Suppose without loss of generality that the west neighbor of p is a contour pixel. This implies that the south neighbor of p fails to satisfy Bl' (as p and its east and west neighbors are contour pixels), and so the south neighbor of p lies in K. Therefore K is 4-adjacent to the pixel q of the inside. D Preservation of connectedness is not the only topological requirement to be satisfied during skeletonization, since the number of components of white pixels must also remain constant. Indeed, this number cannot increase, since internal pixels are never deleted. I {•I I ,}, ], I • n • ••WOT ••»••rrr !•*•• rn ! * • • T1 n •!•! i I M I b) c) Figure 15. (a,b) Dots indicate multiple pixels detected on two successive 4- connected contours. In (c), stars mark white pixels to be changed into black when the set of skeletal pixels is understood as 8-connected. When m=4, two 4-connected subsets of skeletal pixels can be very close to each other, as shown in Figure 15a-b. The dotted pixels are identified as skeletal pixels during the iteration process, due to failure of either Bl' or (B2.
• 124. 122 In Figure 15c, the dots show the resulting set of skeletal pixels. Note that the two protrusions give rise to two 4-connected skeleton branches. To generate an 8-connected skeleton, we change (m,/i) from (4,8) to (8,4); there is now only one 8-connected "branch", but there are many one-pixel holes (starred in Figure 15c). We can obtain a thin 8-connected skeleton with only one branch by filling these holes before removing any of the black pixels. As in the m=8 case, irreducible sets may be found when using conditions 01''02 to identify the skeletal pixels. Examples are shown in Figure 16. ' nFM' 'i'H i i mmmm 11 ^H*^^,l,b^^d|,t, 'r' 1 id' rp mmmmmmm w i d m Mddddd* MJytdjf lrra*iri tildd*bldi a) b) Figure 16. Dots indicate skeletal pixels found on successive contours of pathological 4-connected patterns. An alternative approach to the definition of multiple pixels given in [36] can be found in [29,37,38], for 8-connected contours. A multiple pixel p is identified, while tracing the contour, as a pixel which satisfies at least one of the following conditions: a) p is traversed more than once. b) p has no 8-neighbor in the interior. c) p has at least one 4-neighbor which belongs to the contour, but which does not occur immediately before or immediately after p while tracing the contour. Figure 17. The dotted pixel is multiple only according to [29]; the starred pixel only according to [36]. Figure 18. The dots indicate pixels that are multiple according to the definition given by Pavlidis in [29]. Although the multiple pixels found by the above definition can be interpreted as pixels at which the contour folds on itself, they do not coincide with the
• 125. 123 multiple pixels at which either of the conditions ^1-^2 fails. Indeed, conditions {a-c) can be regarded as identifying locations at which the set of black pixels is thin, whereas conditions !A.l-!^2 are based on a characterization of simple contours. Both criteria are equivalent for contour pixels at distance ds> from the interior, but not for pixels in corner configurations, nor for pixels that connect the interior to a component of the multiple pixels at distances ds> from the interior; see Figure 17. The difference, which might appear to be negligible, is significant in skeletonization. In fact, if pixels like the one dotted in Figure 17 are accepted as multiple, there exists another type of pathological contour consisting entirely of multiple pixels, as shown in Figure 18. 5. THE LABELED SKELETON 5 . 1 . Labeling the skeletal pixels __ In the labeled skeleton, each pixel is labeled with its distance from B. This assigns a two-dimensional meaning to each pixel, since the label is directly related to the size of the maximal disc (in B) centered on the pixel. Moreover, the label values along skeleton branches provide information about the shapes of the regions represented by the branches, e.g., whether they have nearly constant or monotonically changing width, or contain narrow necks. If an iterative process is used, the skeletal pixels can be labeled as soon as they are identified [39]. Skeletal pixels found at the first iteration are labeled 1. Removal of the non-skeletal pixels causes (some) pixels at distance 2 from B to become contour pixels at the second iteration. Skeletal pixels detected at the second iteration are labeled 2, provided they are not already labeled 1. By repeating this process we obtain skeletal pixels that are labeled with their distances to B (dg or J^). This process does not work correctly whenever irreducible contour subsets exist, as in Figure 19, where some pixels are labeled with iteration numbers greater than their distances from B. h h 1 12 1 1 1 4 3 2 1 PI 1 6 5 4 3 2 1 1 4 S 6 5 4 3 ? m [T] 2 ? 4 5 4 3 ^1 1 z3 4 3 2 1 1 2 3 ? 1 1 2 1 1| Figure 19. Labels indicate the iteration numbers at which the pixels are detected for the first time as contour pixels. Bold labels indicate the skeletal pixels. Correct labeling can be achieved by A^Ding the skeleton with the distance transform of B. However, the labeled skeleton so obtained is not guaranteed to provide adequate information about the shape of B, if the skeleton does not
• 126. 124 include the pixels which are centers of the maximal discs on the distance transform. This is true for many thinning algorithms, e.g., [19,34]. Correct labeling is also obtained when the skeleton is constructed using an algorithm based on the distance transform of By and which does not delete the centers of the maximal discs. Such algorithms are discussed in Section 6. 5.2. Reversibility A correctly labeled skeleton can be used to recover B if it includes the centers of all the maximal discs. In this case, the skeletonization is called reversible. Reversibility is seldom achieved, because thinness and inclusion of all the centers are generally mutually exclusive, and thinness is preferred in most cases. Symmetric reduction of the set of centers results in a recovered set whose shape is not significantly different from that of B, since the non- recovered pixels tend to be fairly uniformly distributed along the contour of B; see Figure 20. In addition, maximal disc centers may be deleted from the skeleton to prevent it from possessing branches that arise from non-significant parts of B. If the significant parts of the pattern are preserved in the reconstruction, it is still appropriate to talk of reversible skeletonization. ^ a) b) c) Figure 20. The labeled pixels are local maxima according to dg. The dark gray region is not recovered. One might include in the labeled skeleton centers of maximal discs that are not necessary for preserving topology only when the radii exceed a threshold. For small thresholds, this would tend to eliminate peripheral skeleton branches, arising from protrusions which are unions of maximal discs with radii below the threshold. The centers of the maximal discs do not generally constitute a minimal set from which recovery of B is possible. An example, for n=8, is given in Figure 21a,b. Minimal sets are not unique and their identification is time consuming [14]. Moreover, a minimal set may be incompatible with other requirements on the skeleton, e.g., unit width and topology preservation (Figure 21b). A reasonable compromise is shown in Figure 21c. More complete recovery of B can be achieved at the expense of a well-shaped skeleton (Figure 2Id). Incomplete recovery is also caused by skeleton branches that are shorter than expected. The extent of non-recovery is difficult to predict when end point detection is performed by using local information, e.g., the number of black
• 127. 125 neighbors. On the other hand, the loss of information can be controlled when the peripheral skeleton branches are found in correspondence with protrusions having significant jut [23]. Finally, pruning of skeleton branches also leads to incomplete recovery, but if context-dependent pruning is performed, loss of information can be controlled [40,41]. H1 1 1 1 h n_T ^ LL p_F T 1 T] 2 2 2 2 ? ? 7 2 ? 2 7 7 1 rn2 3 3 3 3 3 3 3 3 3 1^ 7 1 rri2 3 3 3 3 3 3 3 3 3 1 7 1 1 2 2 2 2 2 ? 2 2 2 2 ? ? 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 a) 3 3 3 3 3 3 b) 3 3 3 3 3 3 3 3 3 3 ?n^ iui !'" ^ c) 3 3 3 3 3 3 3 3 3 3 • d) Figure 21. (a) Bold labels indicate local maxima in the DT using d^. (b-d) Different subsets of the local maxima yield different recovered patterns. The dark gray squares are unrecovered pixels. 6. NON-ITERATIVE ALGORITHMS 6 . 1 . Skeletonization using the distance transform Early attempts to use the DT for skeletonization used only the set of local maxima of the DT but this set may not be connected even when the input pattern B is connected, and (as indicated in Section 1) it is more properly called the MAT rather than the skeleton. In this section we describe a Dr-based method which, at least under some circumstances, yields the same result as the iterative process of Section 4. We first give a (recursive) definition of the set of skeletal pixels based on the DT. Let Li be the set of pixels labeled / in the DT. Let 5^=0; let Di={Kjj>iLj) ^ ^k<i-iSk)'^ ^"d let Si be the set of pixels in Li that are multiple pixels on the contour of D/. A pixel will be called skeletal if it belongs to one of the 5,'s. The set of skeletal pixels defined in this way is found to have the topological properties expected of a skeleton. A skeletal pixel will be called intrinsic if it is a multiple pixel on the contour of Kjj>iLj. The set of intrinsic skeletal pixels generally consists of the local maxima of the DT together with "saddle pixels"; as illustrated by the underlined labels in Figure 22, where d4 is used, a saddle pixel may either have a neighbor with the same label which is a local maximum, or may be the central pixel of a "sand glass" configuration. The non-intrinsic skeletal pixels in Figure 22 have circled labels.
• 128. 126 An algorithm for finding the set of skeletal pixels, given the DT, in a single raster scan coupled with a "path growing" process is described in [42]. The skeletal pixels with label / found during the scan include all multiple contour pixels of D|*, which is defined analogously to D, but using only the parts of the 5jt's that have been found so far. Whenever a skeletal pixel p is found, it is marked and the raster scan is temporarily interrupted. The neighbors of p in positions already visited by the scan that have labels greater than p's are checked to see whether any of them is induced by p to become a skeletal pixel. If no such neighbor exists, the scan is resumed; if such neighbors are found, they are marked and their neighbors are checked. fTTTITT?. mm Figure 22. Bold labels, underlined labels and circled labels respectively indicate local maxima, saddle pixels and other skeletal pixels. Figure 23. The starred 2 is detected as skeletal pixel during a path growing process. The path growing process is necessary because a pixel may be induced to become a skeletal pixel by a neighbor in a position not yet reached by the raster scan. A simple example is shown in Figure 23. Both the circled and the starred 2 are skeletal pixels, but only the circled 2 can be detected while scanning the picture in forward raster fashion. The starred 2 cannot be detected as a multiple pixel when it is visited by the scan because its crossed neighbor, which has not yet been visited, is interpreted as belonging to the outside. A modified version of the algorithm, described in [43], interleaves detection of the skeletal pixels and reduction to a skeleton of unit width during the same raster scan. If the iterative process is well-behaved in a sense that we shall now define, it yields the same set of skeletal pixels as the Dr-based process of [42]. * * 1 X y Figure 24. Configuration violating the FCG property. The stars are skeletal pixels, and each of x and y is either an interior pixel or a skeletal contour pixel. We say that the iterative process has the full contour generation property (FCG, for short) if, at each iteration, all the black pixels belonging to the
• 129. 127 current interior and n-adjacent to the current contour become elements of the next contour, after the non-skeletal pixels of the current contour are deleted. (Figure 24 shows how the FCG property can be violated for m=8.) It can be shown that if FCG holds, the set of black pixels at the /-th iteration is just Di. 6 . 2 . Using weighted and Euclidean distance transforms The cardinality, labels and spatial distribution of the skeletal pixels may change drastically with pattern orientation when using algorithms based on the dg or d4 distance transform. Better results can be obtained by using the WDT [44, 45], which provides a closer approximation to the EDT, or by using the EDT directly [46,47]. However, a satisfactory definition of a multiple pixel for these distance transforms has not yet been proposed. The distance transform can be interpreted as a landscape, where the label of every pixel indicates its height. In a distance transform, constraints exist on the heights of neighboring pixels. In fact, labels of neighboring pixels can differ only to a limited extent, so the landscape is characterized by gentle slopes converging towards at most two-pixel wide ridges and peaks. Moreover, plateaus cannot exist and craters exist only if they include a lake (of O's). 3x3 local checks cannot be used to reliably detect ridges and peaks in the WDT {EDT). On the other hand, using local operations with larger supports could be prohibitively expensive. The neighborhood of every pixel p generally includes pixels whose labels are greater than, less than, or equal to that of p. In [44], the sets of these pixels are called 5>, 5<, and S=. In two cases, the decision on whether to accept p as a skeletal pixel can depend on the number and sizes of the components of 5> and 5<. The pixel p is accepted if: i) Only components of 5< exist; in this case, p is understood as a peak (if 5< has a unique component) or as located on a ridge (if 5< has at least two components), ii) Both S> and S< are present, and at least one of them has more than one component; in this case, p is understood as a saddle pixel. When one component of 5< and one component of 5> exist, the size of the S< component is compared with a threshold to decide on acceptance of p. If 5< has more than four pixels, p is accepted, since it is interpreted as located on the tip of a peninsula (where the height of p is taken to be the jut above sea level). By changing the threshold, peninsulas of different sharpnesses can be represented in the skeleton. To ensure skeleton connectedness, a path growing process is used. Paths originate from already detected skeletal pixels and proceed in the direction of the distance gradient upwards, until another already detected skeletal pixel is found. When determining the gradient, the weights w, used to measure the unit moves are taken into account. If p is a saddle pixel and q belongs to a component of 5>, the gradient to q from p is grad q = (q'p)/wi where the value of wi depends on the relative position of p and q. The pixel of 5> which maximizes the gradient is the next pixel in the path.
• 130. 128 7. GETTING TO THE SKELETON The skeleton is a unit-wide set, in the sense that the end points are the only pixels which can be removed without changing its topology. This section discusses methods of reducing the set of skeletal pixels to unit width in a single raster scan. Reduction is accomplished by applying to SP removal operations that both preserve topology and favor well-shapedness of the resulting 8- connected set. Ideally, SP should be an m-connected thin set, and so should be reducible to a unit-wide set in one raster scan. However, SP is not always thin, since it may include some n-internal pixels as a result of the existence of pathological configurations. The number of internal pixels depends on the value of m and on the criteria used to identify the skeletal pixels. Reduction to a minimal 8-connected skeleton S is especially complicated in the m=4 case, where SP is a 4-connected set, since clusters of 4-internal pixels can occur in SP (see, e.g., [48]). Moreover, these clusters may include sparse 8-internal pixels. In this situation, obtaining an S centered within SP and without spurious end points is not trivial to accomplish in one raster scan. On the other hand, when m=8, only a few sparse 4-internal pixels generally exist in SP. Clusters of 4-internal pixels can also occur when skeletal pixels are found using the WDT. We briefly describe below an operation that can be used to reduce the set SP to unit width in one raster scan when it includes at most a few sparse 4-internal pixels (Case 7), and then describe the tasks that need to be performed when SP includes also clusters of 4-internal pixels, as well as (possibly) a few sparse 8- internal pixels (Case 2). The operations discussed below generally suffice to produce a unit-wide S. However, especially in Case 2, some superfluous pixels may remain in the resulting set. The input to the operations is a binary image in which the pixels of SP are black and all other pixels are white. Case 1 During the raster scan, each pixel p of SP is changed from black to white provided that the following condition is satisfied by N*(p): z X y > I where z = njxnjxtisxnjy y = (njxnjxna + n^xnsxng + 115x1x7x112 + /i/xnyx/i.^), z = l-z and iii = l-ni The application of this operation is illustrated in Figure 25. The condition used in the operation preserves topology and prevents shortening of branches. Creation of holes is prevented by requiring that at least one Hi, i odd, does not belong to SP (see the term z ). It is easy to see that (8,4)-connectedness is preserved, as p can only be deleted if y^O. Shortening is almost completely prevented because the condition is false when applied to
• 131. 129 pixels having just one n-neighbor in SP. Two-pixel wide columns (rows) of skeletal pixels are reduced to unit width without any shortening, since as soon as one of the two pixels on the tip of the column (row) is removed, the condition becomes false for the second pixel on the tip, which remains in the skeleton as an end point. Since the central pixel in an L-junction or T-junction of SP is removed, S is free of pixels that are not necessary to preserve 8- connectedness, except for the end points. isa i Figure 25. An 8-connected set of skeletal pixels that can be reduced to a skeleton (dotted pixels) in one forward raster scan. Case 1 in the text. Case 2 In this case we use a deletion criterion based on the number of black neighbors. Centering S within SP is favored by avoiding deletion of pixels that cause "digging" into SP (refer to Figure 26a). To obtain an S free of internal pixels, some pixels are examined more than once. il« • • • • • • • • • • • • !•!• • • • • • • • • • • _m a) b) Figure 26. (a) Removal of pixels may cause digging, which yields a distorted S. (b) The skeleton resulting when digging is avoided. End point detection. A flag Wp, initially set to zero, is associated with each skeletal pixel. When a pixel is deleted, the flags of its black neighbors that have not yet been visited by the scan are increased by 1. Thus, the flag Up of the currently visited skeletal pixel p is equal to the number of its already deleted neighbors. The number ep of skeletal neighbors p had in the original SP can be computed as follows: 8 ep =2-f nk + Up
• 132. 130 Since the value of ep is independent of the order in which the pixels are visited, end point detection would in effect be "parallel". Any pixel p having ep<3, might be regarded as being on a tip of SP; this would favor the detection of end points corresponding to smooth tips of SP. However, this criterion prevents the selection of only one end point at sharp tips of SP (see Figure 27). We therefore allow deletion of a pixel p for which ep<3 if (nixnsxn^ + nsxnsxns + 115x117x112 + 117x111x114) ^ 0 Figure 27. Both starred pixels identify the same tip of the set of skeletal pixels. Prevention of digging. The skeleton must be forced to preserve connectedness of cross-sections aligned in the direction of the raster. To this end, a pixel is not deleted if it is located between two skeletal neighbors aligned in the raster direction. For a forward raster, this condition can be written as nixnsxns = 1 Figure 26b shows the effectiveness of this condition. Deletion of internal pixels. A pixel p that was initially internal to SP remains internal unless one of its neighbors n, (/ odd) is deleted. Thus, the deletability of p should be rechecked after the last of these n, (in the case of a forward raster scan, this is ^7) has been visited. 8. PRUNING 8 . 1 . Skeleton modification The skeleton can be modified by performing suitable operations before, during, or after skeletonization. An improved skeleton can be obtained by simplifying the input pattern prior to skeletonization. An often used method of pattern simplification is based on the application of a sequence of shrink and expand operations. If a small number of expand steps is followed by the same number of shrink steps, the result will be a version of the pattern that is free of small holes and thin indentations; if the reverse is done, the result will be free of small components and thin protrusions. The larger the number of steps that is performed, the more significant is the smoothing of the pattern. Note that splitting or merging of components or holes may also occur, if they are joined or separated by narrow necks. The same results can be obtained at a smaller computational cost by using the distance transform of the pattern to accomplish the required set of shrink steps and then using the distance transform of the complement of the shrunk pattern to accomplish all the required expand steps, or vice versa [49].
• 133. 131 A further speed-up can be obtained by computing simultaneously the distance transforms of both the pattern and its complement [50]. The structure of the skeleton can also be controlled during skeletonization, by preventing the creation of unwanted skeleton branches. In particular, when jut and curvature are used to identify the tips of significant protrusions, as discussed in Section 3.2, the parameters of the process can be modified. If skeletonization is based on the distance transform, it is possible to make creation of branches depend on thickness. For example, skeletal pixels can be required to have labels greater than a threshold value. Note that using this criterion also prevents creation of branches in the middles of sufficiently narrow necks, so that disconnected skeletons can be obtained. Finally, the skeleton can be modified, after its construction, by pruning its peripheral branches. Pruning may involve either deletion or shortening of skeleton branches. Pruning techniques will be discussed in the remainder of this section. 8 . 2 . Pruning techniques Suppose first that the skeleton is not labeled, or that our goal is thinning rather than (curvature) skeletonization; in these cases, only elongated patterns should be processed. If a pattern is elongated and of constant width, branches of its skeleton can be discriminated according to their lengths; in particular, short peripheral branches can be interpreted as unwanted features. Discrimination is not as effective when pattern width is not constant, since the lengths of an unwanted branch and a significant branch may not differ greatly, as illustrated in Figure 28, for m=4. 1 KXI 1'^MMMMM^M^MM^M^ l|iiiiiiiiiiiiiiiii:@iiiiiiiiiiiiiiiii||p llllllllltlillllllilllllllltilllllllll = WM Figure 28. The noisy branch cannot be pruned on the basis of its length, but pruning can be done if the labels of the skeletal pixels are taken into account. The labeled skeleton provides a much better basis for determining the structural relevance of peripheral skeleton branches. A pruned skeleton represents a pattern which would result from flattening some of the protrusions of the input pattern. Thus, pruning criteria can be based on geometric properties which allow discrimination between protrusions that are regarded as significant
• 134. 132 and those that should be flattened. In our opinion, only tapering protrusions should be flattened, but not bulbous protrusions, because the latter might be regarded as significant regions in their own right. Thus a skeleton branch should be pruned only if the sequence of distance labels encountered along the branch, starting from its tip, never decreases. The pruning criteria described below are designed to delete or shorten peripheral skeleton branches corresponding to tapering protrusions. Jut-based criteria. In general, a protrusion is significant if its jut is large relative to its thickness. On the corresponding branch of the labeled skeleton, a large fraction of the pixels will have labels that are local distance maxima; thus if this fraction is small enough, the branch can be pruned. The distribution of the maxima can also be used in defining a pruning criterion. If many of the maxima are isolated, the corresponding protrusion is relatively flat, while otherwise the protrusion is sharper, as illustrated in Figure 29 where dg is used to compute the label values. Pruning will generally be appropriate in the first case, but may not be appropriate in the second. A measure of protrusion sharpness is the slope of the graph of label value as a function of position along the skeleton branch. This slope is zero when the labels are equal (a constant- width protrusion). The maximal slope, 45°, can occur only when all the pixels in the branch have different labels, i.e., none of them is maximal. rW-| ^ ^ 1MCT 1 m 1 m 1 label t label fcnP ^ I I I I I I I I I I I I I pixel XE xc I I I I I I I I I I I I l» pixel Figure 29. Protrusions of different sharpness are mapped into skeleton branches having different slopes in (pixel, label) coordinates, using dg to compute the label values.
• 135. 133 Figure 30. Shortening of a protrusion resulting from trimming its associated skeleton branch. Jut-based criteria can also be used to shorten a skeleton branch by pruning it from its end point p up to its most internal pixel q such that the jut of the protrusion generated from the shortened branch is not significantly less than that of the original protrusion. A simple method of testing this for each q is to compute X-p-q-^dp^q, where dp^q is the distance between p and q according to the metric used to label the skeletal pixels [45,51]. As illustrated in Figure 30 (where dp^q is the weighted distance with W7=3 and ^2=4, and ^=54 p=27), X denotes the amount by which the disc of radius p centered at pixel p extends beyond the disc of radius q centered at pixel q - i.e., the amount by which the protrusion is shortened when the branch is trimmed down to q. Another basis for shortening a branch is to associate contour segments with terminal segments of the branch (by identifying the pair of contour pixels at minimal distance from each skeletal pixel [40]). A pruning criterion can then be defined in terms of contour segment prominence. Area-based criteria. In [41] a criterion for branch shortening is described, based on the amount of area lost from the (reconstructed) protrusion when the branch is shortened. For each sequence of equally-labeled local maxima on the branch, let q be the outermost pixel in the sequence, let D{q) be the area of the maximal disc centered at q, and let P(q) be the area of the protrusion reconstructed from the portion of the branch from q to the end point (inclusive). This portion of the branch (not including q itself) is a candidate for elimination if D{q) is a sufficiently large fraction of Piq). More than one q can satisfy this criterion. Thus, if qj,...,qn-i (counting inward) satisfy it, and qn does not, we prune the branch at qn-i-
• 136. 134 . . * . . a d d « h a t C O . . * . . . . • * n l L * 0 « . . . . . . . * • . . . l i l . . . . i . . . . . . d . h 2 ** C : X d o X NS S 1 SII ] , o dX •c :J . ', Figure 31. Stars are pixels belonging to pruned subsets of skeleton branches.
• 137. 135 Both classes of pruning criteria described above involve examination of the peripheral skeleton branches starting from their end points. Search for the end points can be avoided by creating a list of the end points that are found when skeletal pixels are being identified. Pruning eliminates skeleton branches which do not correspond to significant portions of the input pattern and which therefore make the skeleton difficult to interpret. The pruning process is particularly useful when the pattern to be skeletonized may occur in different orientations. As an example see Figure 31, which shows results for two orientations of a pattern, using a Euclidean distance transform, as described in [51]. The resulting skeletons are quite different from each other, but pruning increases their similarity and makes them easier to use for shape analysis. 9. A TOOL FOR SHAPE ANALYSIS 9.1. Geometric properties When the pixels of S are labeled according to dgy the discs associated with its pixels are square-shaped, so that the pattern reconstructed from 5 is a union of upright squares. Efficient methods have been proposed to compute geometric properties of the pattern from 5, both when S is the MAT [52], and when 5 is a labeled skeleton [53,54]. Algorithms based on the labeled skeleton are outlined below. Area, perimeter, projections on the coordinate axes, and moments (which can be defined in terms of the projections) can be computed while tracing S. For the sake of simplicity, we assume that S has only one branch; generalizations to an arbitrary S can be found in the above cited papers. r^'hrrM'T'• f'pi'"! 1 f } 1 1 • i i#[ 1 i; 1 1 I { } 1 4 i ] :"i"i"i III; f i i 1 1 i 1 a) mmmummm mmmnmmm mmmmmmm b) mmmmm^m mmmnmmm mmmmmmm ^mmmmmm mmmmmmm c) d) rY k r m M » i| 1 e) • ^??; i S#1 m M m f) Figure 32. Basic displacements of Dp.^^ (light gray region) with respect to Dp. (dark gray region).
• 138. 136 The maximal discs Dp. and Dp.^^ associated with two successively encountered local maxima p,- and pi+7 partially overlap in a way which depends on both the relative position and the labels of pi and Pi+7. Only a few basic configurations are possible for Dp. and Dp.^^ (see Figure 32). Thus, it is possible to identify the portion of Dp.^^ which is not contained in Dp., and accordingly to accumulate in registers the contributions of Dp.^^ to the geometric properties of the set Ujt D^^. Multiple overlaps (see Figure 33) must also be taken into account. A key feature of the algorithms is that such overlaps can be identified without backtracking. Figure 33. The dotted pixels belong to Dp.^ and to the portion of Dp. not overlapped by Dp. j . The algorithms hawe low computational cost since all the computations are performed while tracing S. If we can associate parts of S with subsets of B, the properties of each subset can be individually computed. Extension of the algorithms to a skeleton whose pixels are labeled according to d4, and whose maximal discs are diamond-shaped, is possible, but extensions to weighted distance functions is more difficult. In the latter case, the sides of a disc are not aligned only along the eight principal directions, and it is not easy to predict overlaps between maximal discs. 9 . 2 . Skeleton decomposition The labeled skeleton can be used to define structural descriptions of patterns having complex shapes. Decomposing the skeleton into subsets according to specific rules (for instance, based on the numbers and labels of the centers of maximal discs) allows one to decompose the original pattern without reexamining the pattern. Examples of skeleton decomposition methods are given in [55-60].
• 139. 137 To illustrate this, we limit ourselves to patterns whose labeled skeletons consist of a single branch. In [59], decomposition of a one-branch skeleton S labeled according to d4 is used to decompose the corresponding "ribbon-like" pattern B into pieces with nearly constant orientation and with either nearly constant or linearly changing width. S is interpreted as a digital curve in 3D space, the three coordinates {x,y,z) of each pixel in the curve being the two planar coordinates {x,y) and the label z. This curve is polygonally approximated using a splitting algorithm (e.g., [61]). Each segment of the polygon can be regarded as a line segment in the ix,y) plane on which a width function (the linearly varying z value) is defined; thus it defines a trapezoidal region in the plane that corresponds to a piece of the original ribbon. Since d4 is not Euclidean distance, and the z values at the end points of the segment are derived from d4, the width of the trapezoidal region will differ from the width of the original ribbon piece by an amount that depends on the orientation of the piece. This can be compensated by multiplying the z values by suitable correction factors. Further improvements in the approximation can be achieved by merging adjacent pairs of the trapezoidal regions. 9.3. Endoskeleton and exoskeleton Generally, a complex shape B can be described in terms of protrusions and intrusions (e.g., refer to [62]). If a skeleton is used to represent the shape, the protrusions correspond to peripheral skeleton branches. The detection of intrusions from the skeleton is more difficult. However, since any intrusion of B is a protrusion of B, a simple way to detect the intrusions is to use the skeleton of B. The skeletons of B and of W are called endoskeleton and exoskeleton, respectively. Figure 34. Example of an exoskeleton and endoskeleton obtained simultaneously from distance transforms computed using the d4 distance.
• 140. 138 An algorithm to compute both skeletons simultaneously is of interest, since it reduces the computational burden. For this purpose, non-iterative algorithms are appropriate, since once the distance transforms of both B and B are available the two skeletons can both be computed as described in Section 6.1. The computational convenience of the algorithm increases if the two distance transforms are also computed simultaneously. A skeletonization algorithm of this kind is given in [63], where the two distance transforms are computed using d4. An example of the output of the algorithm is shown in Figure 34. We shall describe below how to compute the two distance transforms simultaneously; the skeletonizing algorithm has already been described in Section 6.1. Rather than using t/^, we use the more general WDT [50]. _ The two WDTs, say WDT(B) and WDT(B), are computed simultaneously using the same pair of (forward and backward) raster scans. The pixels of the frame of the array A, which are assumed to be white, are initially labeled with a sufficiently high negative value (e.g., equal to the size of A) to avoid an incorrect labeling of WDTiB). During the forward raster scan, each pixel p assumes the transformed value p' defined as follows: ypeE - w, if 3 n^. (/ odd) such that n.> 0; P' = - ^ 2 if 3 n^. 6* even) such that n^. >0, andV n. (/ odd) n . < 0 ; -min (|«7|+>V7 'h2|"'"^2'hi|"*' ^i'h¥K^2^ otherwise V / 7 € 5 w, if 3n.(/odd) such that n.<0; P = if 3 n. (/ even) such that /i. < 0, and V 71. (/ odd) n. > 0; I mm (rij + Wj, n^ + w^ , n^-^Wjy n^ + w^) otherwise Similarly, during the backward raster scan, p assumes the transformed value /?' defined as follows: V p such that/7<0, amd p^-wi (i=l,2) p'= -min {Insl-^wj, |/i(5l+W2, In/l+w;, In5l+W2» p) V p such that p>0, and p^wi (/=1,2) /?'= min (ns+wi, n6+W2y nj-^-wj, n8'^yv2, p)
• 141. 139 At the end of the second scan, WDT{B) and WDT(B) are respectively given by the positive labels and the negative labels. !y lo Figure 35. Topological paradox which may arise by choosing m=n=8, when computing both the exoskeleton and the endoskeleton. Using the same distance transform to compute both exoskeleton and endoskeleton may lead to topological paradoxes, as shown in Figure 35. (This particular problem can be overcome by not checking pixels ±1 against conditions J^l-AZ of Section 4.) a) b) c) Figure 36. (a) Exoskeleton of a pattern consisting of five components, (b) Exoskeleton after elimination of peripheral branches, (c) Voronoi diagram of the picture. Computing the exoskeleton is also useful for constructing the Voronoi diagram of a pattern. For a finite set P={piy P2y"y Pn) of points in the Euclidean plane, the Voronoi diagram can be defined as a subdivision of the plane that associates with each pi the region Ti closer to pi than to any py, j^i. The set T/, which is a convex polygon, is called the (open) tile of p/. Analogously, given a pattern B in the digital plane, we can define a tessellation into tiles each of which contains one connected component K of B; the pixels of
• 142. 140 K's tile are closer to K than to any other component of B. Due to the variable shapes of the components of 5 , the tiles are not guaranteed to be digitally convex and bounded by digital straight line segments. Moreover, a tile may be adjacent to only one other tile, so that the set of edges of the tiles may be disconnected. This occurs whenever one component of B is located in a hole or a deep concavity of another component. Each tile edge in the Voronoi diagram of B should be symmetrically placed with respect to (i.e., at the same distance from) at least two components of B. Similarly, the branches of the exoskeleton of B are required to be centered within B. In fact, the exoskeleton contains the Voronoi diagram [64]. In addition it contains branches equidistant from two parts of the contour of a deep concavity of B; as we see in Figure 36, these branches are often, but not always, peripheral. The branches that are not Voronoi edges can be removed after the tiles have been colored, since they are surrounded by pixels belonging to the same tile. The computational effort required is rather modest; five scans of the picture suffice to obtain the Voronoi diagram. Acknowledgment We are grateful to Mr. Salvatore Piantedosi for his careful and patient work in preparing the illustrations. REFERENCES 1 F. Leymarie and M.D. Levine, Simulating the grassfire transform using an active contour model, IEEE Trans. Patt. Anal. Mach. Intell., 14, 56-75, 1992. 2 L. Lam, S.W. Lee and C.Y. Suen, Thinning methodologies - A comprehensive survey, IEEE Trans. Patt. Anal. Mach. Intell., 14, 869- 885, 1992. 3 H. Blum, A transformation for extracting new descriptors of shape, in W. Wathen-Dunn, ed.. Models for the Perception of Speech and Visual Form, M.LT. Press, Cambridge, MA, 1967, 362-380. 4 H. Blum, Biological shape and visual science, J. Theor. Biol., 38, 205- 287, 1973. 5 H. Blum and R.N. Nagel, Shape description using weighted symmetric axis features. Pattern Recognition, 10, 167-180, 1978. 6 J.L. Pfaltz and A. Rosenfeld, Computer representation of planar regions by their skeletons, Comm. ACM, 10, 119-125, 1967. 7 C. Arcelli, L.P. Cordelia and S. Levialdi, From local maxima to connected skeletons, IEEE Trans. Patt. Anal. Mach. Intell., 3, 134-143, 1981. 8 T.Y. Kong and A. Rosenfeld, Digital topology: Introduction and survey, Comput. Vision Graphics Image Process., 48, 357-393, 1989. 9 A. Rosenfeld and J.L. Pfaltz, Sequential operations in digital picture processing, J. ACM, 13, 471-494, 1966.
• 143. 141 10 G. Borgefors, Distance transformations in arbitrary dimensions, Comput. Vision Graphics Image Process. ^ 27, 321-345, 1984. 11 G. Borgefors, Distance transformation in digital images, Comput. Vision Graphics Image Process., 34, 344-371, 1986. 12 G. Borgefors, Another comment on "A note on 'Distance transformation in digital images'", CVGIP: Image Understanding, 54, 301-306, 1991. 13 P.E. Danielsson, Euclidean distance mapping, Comput. Graphics Image Process., 14, 227-248, 1980. 14 I. Ragnemalm, The Euclidean distance transform, PhD Dissertation No. 304, Dept. Electrical Engineering, Linkoping University, Sweden, 1993. 15 C. Arcelli and G. Sanniti di Baja, Finding local maxima in a pseudo Euclidean distance transform, Comput. Vision Graphics Image Process., 43, 361-367, 1988. 16 C. Arcelli and G. Sanniti di Baja, Weighted distance transforms: A characterization, in V. Cantoni, V. Di Gesu and S. Levialdi, eds.. Image Analysis and Processing II, Plenum, New York, 1988, 205-211. 17 A. Rosenfeld, Connectivity in digital pictures, J. ACM, 17, 146-160, 1970. 18 D. Rutovitz, Pattern recognition, J. Royal Statist. Soc, 129 Series A, 504-530, 1966. 19 C.J. Hilditch, Linear skeletons from square cupboards, in B. Meltzer and D. Michie, eds.. Machine Intelligence IV, Edinburgh University Press, Scotland, 1969, 403-420. 20 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. 21 C. Arcelli and G. Sanniti di Baja, On the sequential approach to medial line transformation, IEEE Trans. Systems Man Cybernet., 8, 139-144, 1978. 22 U. Eckhardt, Digital topology I. A classification of 3x3 neighborhoods with application to parallel thinning in digital pictures. Hamburger Beitrdge zur Angewandten Mathematik, Reihe A 8, 1987. 23 C. Arcelli and G. Sanniti di Baja, A thinning algorithm based on prominence detection. Pattern Recognition, 13, 225-235, 1981. 24 C.H. Teh and R.T. Chin, On the detection of dominant points on digital curves, IEEE Trans. Patt. Anal. Mach. Intell., 11, 859-872, 1989. 25 G. Gallus and P.W. Neurath, Improved computer chromosome analysis incorporating preprocessing and boundary analysis, Phys. Med. Biol., 15, 435-445, 1970. 26 C. Arcelli, Pattern thinning by contour tracing, Comput. Graphics Image Process., 17, 130-144, 1981. 27 A.R. Dill, M.D. Levine and P.B. Noble, Multiple resolution skeletons, IEEE Trans. Patt. Anal. Mach. Intell., 9, 495-504, 1987. 28 H. Freeman, On the encoding of arbitrary geometric configurations, IRE Trans. Electronic Computers, 10, 260-268, 1961. 29 T. Pavlidis, A thinning algorithm for discrete binary images, Comput. Graphics Image Process., 13, 142-157, 1980.
• 144. 142 30 V. K. Govindan and A. P. Shivaprasad, A pattern adaptive thinning algorithm. Pattern Recognition, 20, 623-637, 1987. 31 P.C.K. Kwok, A thinning algorithm by contour generation, Comm. ACM, 31, 1314-1324, 1988. 32 Y. Xia, Skeletonization via the realization of the fire front propagation and extinction in digital binary shapes, IEEE Trans. Patt. Anal. Mach. IntelL, 11, 1076-1086, 1989. 33 C. Arcelli and M. Frucci, Reversible skeletonization by (5,7, ll)-erosion, in C. Arcelli, L.P. Cordelia, and G. Sanniti di Baja, eds.. Visual Form Analysis and Recognition, Plenum, New York, 1992, 21-28. 34 B.J.H. Verwer, Improved metrics in image processing applied to the Hilditch skeleton, Proc.9th Int. Conf. on Pattern Recognition, Rome, Italy, 137-142, 1988. 35 C. Arcelli and G. Sanniti di Baja, On the simplicity of digital curves and contours, Proc. 8th Int. Conf. on Pattern Recognition, Paris, France, 283- 285, 1986. 36 C. Arcelli and G. Sanniti di Baja, A contour characterization for multiply connected figures. Pattern Recognition Letters, 6, 245-249, 1987. 37 T. Pavlidis, Algorithms for Graphics and Image Processing, Springer- Verlag, Berlin, Germany, 1982. 38 T. Pavlidis, An asynchronous thinning algorithm, Comput. Graphics Image Process., 20, 133-157, 1982. 39 N.J. Naccache and R. Shinghal, SPTA: A proposed algorithm for thinning binary patterns, IEEE Trans. Systems Man Cybernet., 14, 409-418, 1984. 40 S.B. Ho and C.R. Dyer, Shape smoothing using medial axis properties, IEEE Trans. Patt. Anal. Mach. Intell., 8, 512-520, 1986. 41 L.P. Cordelia and G. Sanniti di Baja, Context dependent smoothing of figures represented by their medial axis transform, Proc. 8th Int. Conf. on Pattern Recognition, Paris, France, 280-282, 1986. 42 C. Arcelli and G. Sanniti di Baja, A one-pass two-operation process to detect the skeletal pixels on the 4-distance transform, IEEE Trans. Patt. Anal. Mach. Intell., 11, 411-414, 1989. 43 C. Arcelli and G. Sanniti di Baja, Distance driven skeletonization, Proc. IEEE Conf. on Computer and Communication Systems, Hong Kong, 304- 308, 1990. 44 L. Dorst, Pseudo-Euclidean skeletons, Proc. 8th Int. Conf. on Pattern Recognition, Paris, France, 286-288, 1986. 45 G. Sanniti di Baja, Well-shaped, stable and reversible skeletons from the (3,4)-distance transform, J. Visual Comm. Image Repres., 5, 107-115, 1994. 46 F. Klein and O. Kubler, Euclidean distance transformations and model- guided image interpretation. Pattern Recognition Letters, 5, 19-29, 1987. 47 C. Arcelli and G. Sanniti di Baja, Ridge points in Euclidean distance maps. Pattern Recognition Letters, 13, 237-243, 1992. 48 C. Arcelli and G. Sanniti di Baja, A width-independent fast thinning algorithm, IEEE Trans. Patt. Anal. Mach. Intell., 1, 463-474, 1985.
• 145. 143 49 S. Suzuki and K. Abe, New fusion operations for digitized binary images and their applications, IEEE Trans. Patt. Anal. Mach. Intell., 7, 638-651, 1985. 50 S. Ablameyko, C. Arcelli and G. Sanniti di Baja, Using distance information for editing binary pictures, Proc. 6th Scand. Conf. on Image Analysis, Oulu, Finland, 401-407, 1989. 51 C. Arcelli and G. Sanniti di Baja, Euclidean skeleton via centre-of- maximal-disc extraction. Image and Vision Computing, 11, 163-173, 1993. 52 A.Y. Wu, S.K. Bhaskar and A. Rosenfeld, Computation of geometric properties from the medial axis transform in 0(n log n) time, Comput. Vision Graphics Image Process., 34, 76-92, 1986. 53 L.P. Cordelia and G. Sanniti di Baja, Geometric properties of the union of maximal neighborhoods, IEEE Trans. Patt. Anal. Mach. Intell., 11, 214- 217, 1989. 54 G. Sanniti di Baja, O(^) computation of projections and moments from the labeled skeleton, Comput. Vision Graphics Image Process., 49, 369-378, 1990. 55 L.P. Cordelia and G. Sanniti di Baja, Structural description of silhouettes, Proc. 3rd Scand. Conf. on Image Analysis, Copenhagen, Denmark, 73-78, 1983. 56 S. Suzuki and K. Abe, Max-type distance transformation for digitized binary pictures and its applications. Trans. Inst. Electron. Commun. Eng., Japan, E66, 94-101, 1983. 57 C. Arcelli and G. Sanniti di Baja, An approach to figure decomposition using width information, Comput. Vision Graphics Image Process., 26, 61-72, 1984. 58 A. Montanvert, Medial line: Graph representation and shape description, Proc. 8th Int. Conf. on Pattern Recognition, Paris, France, 430-432, 1986. 59 A. Chianese, L.P. Cordelia, M. De Santo and M. Vento, Decomposition of ribbon-like shapes, Proc. 6th Scand. Conf. on Image Analysis, Oulu, Finland, 416-423, 1989. 60 C. Arcelli, R. Colucci and G. Sanniti di Baja, On the description of digital strips, in M.H. Hamza, ed.. Artificial Intelligence Applications and Neural Networks, Acta Press, Anaheim, CA, 1990, 193-196. 61 U. Ramer, An iterative procedure for the polygonal approximation of planar curves, Comput. Graphics Image Process., 1, 244-256, 1972. 62 L.G. Shapiro and R.M. Haralick, Decomposition of two-dimensional shapes by graph-theoretic clustering, IEEE Trans. Patt. Anal. Mach. Intell., 10, 10-20, 1979. 63 C. Arcelli and G. Sanniti di Baja, Endoskeleton and exoskeleton of digital figures: An effective procedure, in V. Cappellini and R. Marconi, eds.. Advances in Image Processing and Pattern Recognition, North-Holland, Amsterdam, The Netherlands, 1986, 224-228. 64 C. Arcelli and G. Sanniti di Baja, Computing Voronoi diagrams in digital pictures. Pattern Recognition Letters, 4, 383-389, 1986.
• 146. Topological Algorithms for Digital Image Processing T.Y. Kong and A. Rosenfeld (Editors) © 1996 Elsevier Science B.V. All rights reserved. 145 Parallel Connectivity-Preserving Thinning Algorithms Richard W. HalP ^Department of Electrical Engineering, University of Pittsburgh, Pittsburgh, PA 15261 Abstract A variety of approaches to parallel thinning using operators with small supports are reviewed, with emphasis on how one may preserve, and prove one has preserved, connec- tivity. Tests are demonstrated for verifying connectivity preservation; and for fundamental classes of parallel thinning algorithms, including fully parallel, two-subiteration, and two- subfield, conditions are identified using these tests which are sufficient for preservation of connectivity. Thus "design spaces" for connectivity preserving algorithms belonging to these classes are identified. Some fundamental limitations on parallel thinning operators for images with 8-4 connectivity are also reviewed, including constraints on support size and shape. Parallel computation time issues are addressed and it is shown that existing fully parallel thinning algorithms are nearly optimally fast. 1. I N T R O D U C T I O N In digital image processing it is usually desirable to reduce the complexity of an image by determining some simpler representation for parts of the image. For example an image might be preprocessed into a binary image containing a set of distinct connected regions, perhaps representing objects. Each of the regions might then be reduced to a simpler representation. This representation might be a potentially unconnected digital version of the medial axis skeleton as defined originally by Blum [5] or a connected approximation of the medial axis for each region when these are composed of elongated parts [57]. These connected approximations will be called medial curves. (These are not necessarily digital arcs or curves as defined in [57]; they may branch (see, e.g.. Figure 4), and if the original object has holes (i.e., is not simply connected) its medial curve will also not be simply connected.) A process which constructs these medial curves is usually referred to as thinning. Although thinning algorithms can be defined for grey level images [16, 24, 35], this chapter will address only the thinning of binary images. Thinning processes typically reduce an object by successively removing border pixels of the object while maintaining connectivity. An example of this process is illustrated in Figure 1 (using the thinning algorithm in [36]). Processes or operators which transform images only by removing object pixels will be called reduction operators; such operators are typically used to perform thinning. Although it is sometimes of interest to be able to reconstruct the original image from its thinned representation, investigators have fre- quently focused solely on the reductive aspect of thinning since image reconstruction is often not necessary. This chapter will focus on the reduction processes used to construct medial curves.
• 147. 146 1 1 1 1 1 1 1 ] 1 1 1 ] 1 1 ] 1 1 ] 1 ] [ 1 [ 1 L 1 L 1 L 1 L 1 1 1 1 • • 1 1 1 • 1 1 • 1 1 • • • • • • • • • • • • • • • • • 0 1 Figure 1. Example of parallel thinning. The -'s represent deleted I's of the original image and the • 's represent the medial curve. The iterations are numbered from 0 to 2 with 0 representing the original image. For sequential reduction operators, which change only a single pixel at any one time, there are well known necessary and sufficient conditions for preserving connectivity proper- ties [55, 64]. Parallel reduction operators are more difficult to analyze since large numbers of pixels may change simultaneously, which complicates the proof of connectivity preserva- tion. In the image processing community parallel approaches to thinning using reduction operators have received much attention, partly because parallel computers are becoming more available and larger [12, 15, 23, 38, 42, 52]; but the care taken with connectivity preservation has been mixed [6, 10, 13, 14, 30, 36, 44, 58, 61, 65]. If connectivity properties are not preserved in a low level vision operation like thinning, then higher level processes may have difficulty performing correctly. For example, in processing printed characters a key problem is to identify distinct characters. If the raw images are tractable enough to provide distinct connected image regions for distinct characters, then in performing a thinning operation it is particularly desirable that a thinned connected component also be connected. This assumption can ease the burden on further processing to identify the individual characters. Taking a contrary view, total connectivity preservation may not always be a critical factor and in some cases it might be desirable to violate certain connectivity properties. For example, if single-pixel holes are assumed to arise only because of "noise" in image acquisition, then it might be desirable to "fill in" such holes before thinning. Similarly, snaall regions in an image may not be of interest if one chooses to focus solely on larger elongated regions. In such a case one might choose to completely remove small objects (e.g., 2 x 2 squares) from the image at early stages of the algorithm. In both of these cases the "topology" of the image is not preserved, but this may be irrelevant to further processing. Regardless, in the design of algorithms one must be concerned with identi- fying the connectivity properties which are preserved and with properly characterizing situations in which connectivity is not preserved. In this chapter a variety of approaches to parallel thinning will be reviewed with a view
• 148. 147 towards showing how one may preserve and prove one has preserved connectivity. We will also exhibit local conditions which are required for preservation of connectivity in various classes of parallel algorithms, and based on these conditions we will characterize "design spaces" for connectivity preserving operators within these classes. 2. P R E L I M I N A R Y N O T A T I O N 2.1. Images Pixel values are assigned from the set {0,1}; 1-valued pixels are called I's and 0-valued pixels are called O's. The non-zero region of the image is assumed to be finite in extent. The set 5 of I's is referred to as the foreground, and its complement, the set S' of O's, as the background. Terms like i-path, i-adjacent, i-neighbor, i-connected, and i-component are used in the same sense as in [39] for i = i and 8. To avoid connectivity "paradoxes", S and S' are understood to have 8-connectivity and 4-connectivity, respectively; this is referred to as 8-4 connectivity. The dual 4-8 definition could also be used, but the 8-4 definition seems to be used more often by the image processing community and this presentation will focus on that case. Unless otherwise indicated the term object or component will refer to an 8-component of S. Variables m and n will be used exclusively to refer to the foreground and background adjacency relations, respectively; e.g., in the 8-4 case m = 8 and n = i. Lower case letters will be used to denote pixels or integer variables and upper case letters will be used to denote sets of pixels and paths. Ni{p) refers to the set consisting of p and its i- adjacent neighbors; N*{p) = Ni{p) — {p}] Ni{P) is the union of Ni{pj) for all pj in P; and A^*(P) = 7Vi(P) — P , all for z — 4 or 8. In illustrations of regions of an image < 5 > refers to the set of all pixels labeled s in the illustration. In such illustrations, if I's are shown but O's are not (see, e.g.. Figure 1), then pixels at blank positions are O's unless otherwise indicated. If certain pixels are explicitly labeled as O's (see, e.g., the illustrations in the statement of Proposition 4.2), then the values of pixels at blank positions are unspecified and may be 0 or 1, unless otherwise indicated. In certain cases we specify 90° rotations of given patterns; such rotations are taken clockwise. 2.2. Neighborhood Functions When we refer to specific pixels in Ns{p) we will use the notation given in Figure 2. We say that p = 1 is a border 1 if N^{p) contains a 0; p is called an interior 1 otherwise. We define C{p) as the number of distinct 8-components of I's in Ng{p). We say a 1, p, is 8-simple if C[p) — 1 and p is a border 1. We define A[p) as the number of distinct 4-components of I's in N^{p) and B{p) as the number of I's in N^{p)' Pi P2 Ps P8 P PA PI Pe, Pb Figure 2. 8-neighborhood notation.
• 149. 148 2.3. Parallel Reduction Operators and Algorithms We will consider thinning algorithms which use operators that transform a binary image only by changing some I's to O's (this is referred to as deletion of I's); we call these reduction operators. Algorithms are defined by a sequence of operator applications; each such application is termed an iteration. The support of an operator O applied at a pixel p is the minimal set of pixels (defined with respect to p) whose values determine whether p's value is changed by O. We assume that O's support at any other pixel q is just the translation to q of the support at p. For example, the support of the operator which deletes a 1, p, iff p is 8-simple is Ns{p)] this is called a 3 x 3 support. When the support has small diameter it is referred to as a local support. Thinning algorithms typically delete only border I's and we need to determine which border I's can be deleted without disrupting connectivity. Two conditions have found substantial application in the design of thinning operators: A{p)=l and C{p)=l. There are straightforward ways to compute A[p) (e.g., A{p) is equivalent to the crossing number CN of Tamura [63]) and efficient methods are known for testing the condition C{p)=l for border I's p [1, 11, 27^ 34, 64]. We will be concerned primarily with operators that have local support and in particular with operators that have very small supports, e.g., 3 x 3 . Operators that require A{p) = 1 {C{p) = 1) for deletion, and algorithms that use only such operators, are said to be A{p) = 1-based {C{p) = 1-based). Algorithms apply operators over parts or all of the image in a sequence of iterations. When an operator is applied to only one pixel at each iteration, it is called a sequential operator; otherwise, it is called parallel. The term completely parallel operator is used to denote an operator which is applied to the entire image at each iteration where it is applied. Such operators can be particularly desirable when algorithms will be implemented on parallel 2D mesh computers [12,15, 23, 38, 42, 52]. Operators with local support are highly desirable in such implementations since larger supports require either higher time cost or higher interconnection complexity for obtaining the values of the pixels in the support. In particular thinning operators with 3 x 3 (or smaller) supports are especially desirable; but, unfortunately, a completely parallel reduction operator with 3 x 3 support cannot provide adequate thinning if it is used exclusively [27, 32, 57] (this point is discussed in Section 3.2). Investigators have worked around this problem using two basic approaches. Subiteration algorithms apply an operator to the entire image at each iteration, but rather than using the same operator at each iteration, they cycle through a small set of operators; the iterations of the cycle are usually called subcycles or subiterations [3, 27, 44, 56, 57, 61, 65]. Subfield algorithms partition the image into subsets in some manner and a parallel operator is appHed to one of the subsets (a subfield) at each iteration, cycHng through the subsets [26, 27, 52]. An algorithm is called fully parallel if it applies the same completely parallel operator at every iteration. We measure the parallel speed of a parallel thinning algorithm on a given image by counting the number of iterations required for the algorithm to terminate; this number is called the iteration count. We say a parallel algorithm is fast (i.e., has high parallel speed) if it has low iteration count.
• 150. 149 3. F U N D A M E N T A L S OF PARALLEL T H I N N I N G 3.1. Thinning Goals A thinning algorithm typically makes use of reduction operators which are designed to iteratively delete border I's until thin curves (medial curves) are obtained which lie approximately along the midhnes of elongated objects. A good thinning algorithm should satisfy the following conditions: T l . Medial curve results must be thin; T 2 . Medial curve results must approximate the medial axis; T 3 . Thin curves and endpoints must be preserved; T 4 . Connectivity of foreground and background must be preserved. For parallel thinning algorithms, a further condition is T 5 . Parallel speed should be substantially higher than that achievable with a se- quential algorithm. As we shall now see, it is difficult to precisely define most of these goals, especially the geometric goals T1-T3. Consider condition T l . A thin curve G of I's (in the 8-4 case) would ideally be expected to be composed of all border I's, i.e., I's 4-adjacent to a 0. Further, most of the pixels of G should have exactly two 8-neighbors in G and a few pixels in G could be endpoints (e.g., only one 8-neighbor in G) or branch points (more than two 8-neighbors in G) [57]. A medial curve might be defined as ideally thin if no set of non-endpoint pixels on the curve can be removed without violating connectivity properties. However, consider the image whose I's are as shown below 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Here all I's are either endpoints or are not 8-simple and the deletion of any set of non- endpoint I's will violate connectivity properties; thus the image is ideally thin by our definition, but it contains an interior 1. An alternative to T l might be that the medial curve should be a smallest set of pix- els satisfying T2-T4. However, this condition cannot in general be satisfied by a local operator. For example, in the following two images, where e = p = q = 1
• 151. 150 e e l 1 1 1 1 1 1 1 1 p q p q 1 1 1 1 1 1 1 1 1 e e if we want to preserve the endpoints labeled e and obtain the shortest 8-path between them as the medial curve, then in the example on the left we must delete p while preserving q and in the example on the right we must delete q and preserve p. We can create such examples with diagonal lines of width two and any length. Thus, there is in general no reduction operator with local support which can determine whether to delete p or ^; but clearly p or q must be deleted if we are to achieve a smallest medial curve. Heuristic approaches are usually taken to produce medial curves which satisfy T l . A typical approach [36, 60] applies post-processing to do a final thinning using reduction operators which delete I's, p, with 3 x 3 neighborhoods like the following: 0 0 0 1 1 0 0 0 1 p 0 I p 0 Q p I 0 p I 0 1 0 0 0 0 1 0 (1) (2) (3) (4) The pixels that are left blank may be I's or O's. (Similar deletion conditions were earlier used in [3].) In order to preserve connectivity only certain subsets of these four deletion conditions can be used in parallel. Using the Ronse techniques presented in Section 4, it can be shown that a connectivity preserving parallel operator can delete p only for any single one of the conditions or for the pairs of conditions (1) and (2), (1) and (4), (2) and (3), and (3) and (4). It is also possible to add these conditions to the main thinning operator and avoid post-processing [28]. An example of such an algorithm is given in Section 7.1. Other issues relating to achieving thin medial curves are discussed in [60, 63]. Medialness (T2) can also be difficult to define precisely. For example, it is unclear what the ideal medial curve should be for a u; x /-pixel upright rectangle when the width w is even. Figure 3 illustrates several alternatives for the part of the medial curve near the center of the rectangle. Example (a) would usually be preferred by practitioners, although the medial curve's vertical position is biased. Example (b) has a less biased vertical position, but the medial curve is not straight. Example (c) has an unbiased vertical position, but the medial curve is not ideally thin. For an odd-width rectangle, the midline of the rectangle is thin, straight, and centered, but at the end of the rectangle the medial curve may take several forms, as illustrated in Figure 4. In practice thinning algorithm designers attempt to balance deletions from the four compass point directions in order to achieve an approximation to isotropic erosion (while preserving connectivity). Davies and Plummer [11] illustrate a methodology for evaluating the quality of a medial curve by taking the union of the maximal disks contained in the object and centered at the pixels of the medial curve. Analysis of the differences between this union and the original image provides quantitative measures of how good the medial curve is geometrically. Plamondon et al. [50] evaluate medial curves by comparing them to medial curves constructed by
• 152. 151 • • • • • • • • • • (a) (b) (c) Figure 3. Examples of central regions of possible medial curves for a rectangle of even width. • • • • • • • • • • • • • • (a) (b) (c) Figure 4. Examples of possible medial curves for a rectangle of odd width. human subjects for selected test images. As regards T3, we first observe that non-endpoints of ideally thin curves are not 8- simple pixels; hence T4 guarantees that they are not deleted. The key T3 issue is to preserve endpoints. There are three traditional definitions of an endpoint pixel p (in the 8-4 case): E l . B{p) = 1; E 2 . B{p) - 1 or 2; E 3 . B{p) == 1, or B{p) = 2 and A{p) = 1. El is widely used and any point which satisfies El is obviously an endpoint. However, El is too restrictive for certain kinds of objects, e.g., p p I I 1 1 I I I 1 1 1 1 1 p 1 p where p = 1. In such objects the pixels p may need to be considered as endpoints to avoid excessive erosion. (An example will be given later in this section.) E2 treats these p's as endpoints, but unfortunately all points in a diagonally oriented rectangle of width 2 are endpoints according to E2:
• 153. 152 1 1 1 1 1 1 1 1 Nevertheless, E2 is useful in certain A(p)=l-based thinning algorithms to avoid erosion of certain diagonal lines [29, 44]. E3 properly handles the width-2 diagonally oriented rectangle case; it is used in [27, 45, 62]. The difficult problem of distinguishing between "true endpoints" and "noise spurs" leads some investigators to allow partial erosion of endpoints [11, 62]. Typically the thinning operator initially allows endpoint deletions and after a certain number of iterations (related to the investigator's notion of how long noise spurs might be) the operator is changed to preserve endpoints at subsequent iterations [62]. Connectivity preservation (T4) can be precisely defined and will be treated in some detail in Section 4. One way to quantitatively express goal T5 is to argue that for w x I rectangles of I's where w <^ I a. parallel thinning algorithm should require only 0{w) iterations. Such a definition is used in [32] and in the following subsection to simplify arguments about support requirements for fully parallel thinning algorithms. A variety of aspects of thinning algorithm performance and design are treated in [11, 22, 41, 48, 57, 59, 63]. There has been some work on operators with fairly large (i.e., 5 x 5 or larger) support [7, 43, 46]. For example, Li and Basu [43] use up to 9 x 9 supports in order to better preserve vertical strokes, so that characters like 'B' may be more easily distinguished from characters like '8'. Nevertheless, thinning operators with small support are usu- ally preferred for reasons of efficiency. This chapter will focus on the goal of preserving connectivity using parallel operators of small (i.e., 4 x 4 or smaller) support. 3.2. Support Limitations Small operator support sizes are desirable but, unfortunately, as already mentioned, a completely parallel reduction operator with 3 x 3 support cannot provide adequate thinning if it is used exclusively [27, 56, 57]. For example, a completely parallel thinning operator which yields 90° rotated results for each 90° rotation of an object will either completely delete a 2 X 2 square or will completely preserve it [56]. Furthermore, we know that a long 3 x / horizontally oriented rectangle can be thinned in 0(1) iterations using, say, the four-subiteration thinning algorithm of Rosenfeld [56]. But if we are using a fully parallel algorithm, in order to avoid requiring 0(1) iterations and still satisfy T2 we must delete the north and south border I's of this long rectangle, except possibly near the corners. The same algorithm applied to a long horizontal rectangle of width 2 will then disconnect it, completely delete it, or delete all but at most two I's at one end or the other of the rectangle. Thus, fully parallel thinning algorithms which use 3 x 3 reduction operators are unable to meet our thinning goals. Note that if we omitted T2, we could define a satisfactory fully parallel "thinning" algorithm with 3 x 3 support, e.g., using an operator which deletes all north border 8-simple I's which are not endpoints [56]. This subject is addressed more formally and completely in Section 7 and [32].
• 154. 153 3.3. A C ( p ) = l - B a s e d Thinning Algorithm Some investigators have circumvented these support Hmitations by using subiterations. We illustrate this using the well known four-subiteration thinning algorithm of Rosenfeld [56, 57] which is based on a 3 x 3 operator that deletes certain 8-simple I's: Algorithm ROS The following four reduction operators are applied at successive iterations to all pixels in the image. A pixel p = 1 is deleted if a. C{p) = 1, b. p is not an endpoint (see below) and c. Pi = 0; where i takes the values 2, 6, 4, 8, 2, 6, 4 , . . . at successive iterations. The algorithm terminates when no deletions occur during four successive iterations. Examples of ROS's performance are given in Figure 5 for two endpoint definitions. ROS deletes 8-simple north, south, east, west, north,... border I's that are not endpoints at successive iterations. Rosenfeld has shown that these four operators preserve connectivity. ROS does quite well on goal T l , producing ideally thin results. ROS also tends to produce rather good medialness (T2) since deletions are performed from the four compass direc- tions. But the definition of an endpoint can impact on both the T2 and T3 performances of ROS. Thus, if we use the El endpoint definition, ROS performs badly on the image illustrated in Figure 5a, as the triangular shaped "endpoints" are successively deleted. A more robust definition of an endpoint, such as E3, is needed to preserve such pixels. Then ROS produces a more acceptable medial curve result, as illustrated in Figure 5b. The definition of an endpoint does not typically affect connectivity preservation (T4) except for certain very small objects. 3.4. A n A ( p ) = l - B a s e d Thinning Algorithm In some thinning algorithms the C{p) = 1 condition is replaced by the more restrictive A{p) = 1 condition. Border I's satisfying A{p) = 1 are 8-simple since for such I's we also have C{p) = 1. But there are 8-simple pixels at which A{p) ^ 1, e.g., p in 1 p 1 Most A(p)=l-based thinning algorithms find their roots in the early work of Rutovitz [58]. Operators which require A{p) = 1 for deletion of a pixel p tend to produce thicker medial curves than operators which allow deletion in C{p) = 1 cases; but this may be acceptable in some appHcations. The following i4(p)=l-based thinning algorithm, HSCPN, is derived from the fastest approach in [36] as modified in [29].
• 155. 154 1 3 1 1 1 1 4 3 1 4 • 3 4 5 3 1 4 • 3 4 7 5 3 1 1 1 1 1 1 1 1 » « « 7 3 1 1 4 » 7 5 5 5 4 # 3 • • • 6 * « « * 3 4 * 3 2 4 6 7 6 6 3 4 « 3 2 4 6 3 2 2 4 » 3 2 4 3 2 2 2 2 3 2 (a) • • 1 1 1 1 • 3 1 4 • 3 4 • 3 1 4 • 3 4 « 5 3 1 1 1 1 1 1 1 1 # » « 7 3 1 1 4 » 7 5 5 5 « » « « « » 4 « 3 • • • 6 « 9 « « 3 4 « 3 2 4 6 * 6 6 3 4 » 3 2 4 » 3 2 2 4 « 3 2 • 3 2 2 2 2 • (b) Figure 5. Examples of thinning by ROS: (a) Using El; (b) using E3. The nunabers and • 's indicate I's of the original image. The numbers indicate the iteration at which the 1 at that position is deleted and the • 's denote pixels in the medial curves. Algorithm HSCPN At successive iterations do both of the following: a. Find those I's, p, for which A{p) = 1 and 3 < B{p) < 6. b. Delete the I's that were found in (a), except those I's, p, that satisfy one of the following conditions: 1. P2 = Pe = ^ a-nd p4 is a 1 that was found in (a); 2. p4 = PQ = I and pe is a. 1 that was found in (a); or 3. P4,P5, and pe are I's that were found in (a). The algorithm terminates when no deletions occur during an iteration. Connectivity preservation for HSCPN is proved in Section 4. Figures 1 and 6 show examples of the operation of HSCPN. Although expressed differ-
• 156. 155 ently, it is very close to the original Rutovitz algorithm [58] but preserves all connectivity properties. (The original Rutovitz algorithm completely deletes 2 x 2 components of I's.) Step (a) identifies potentially deletable pixels, and the conditions in step (b) are preservation conditions which prevent the deletion of certain pixels in order to preserve connectivity. Conditions (bl) and (b2) preserve p if its neighborhood looks like 6 1 1 c a 0 b 0 p P4 0 or I p 1 a I I d 1 pe 1 d 0 c respectively, where p = p4 — pe = I and {a, 6} and {c, c?} each contain at most one 1. Condition (b3) preserves one 1 in a 2 x 2 component of I's. In Figure 6, HSCPN is viewed as being fully parallel with support < s > U p: s s s s s p s s s s s s s s s s This is the support required to determine whether or not p will be deleted as a result of steps (a) and (b). From this standpoint the operator is unchanged from iteration to iteration. This algorithm can also be regarded as a two-subiteration thinning algorithm when operators are restricted to 3 x 3 supports. In this view step (a) is computed in parallel in one iteration; but since step (b) uses intermediate results from step (a), it requires a second parallel iteration. Step (a) is not a traditional subiteration operator since no image pixels are transformed; rather, a flag is set for each 1 of the image that satisfies (a). • • 1 1 1 1 1 • 1 1 • 1 1 • 2 1 1 • 1 1 2 « 2 1 1 1 « « * « 1 1 « « . « 3 2 » « 1 1 1 1 1 1 » 1 1 1 2 3 « « « 2 1 1 » 1 1 2 3 * 3 2 1 1 • 1 1 2 * 2 1 1 1 • 1 1 • 1 1 1 1 1 • • Figure 6. Example of thinning by HSCPN. Same notation as in Figure 5. Note that in HSCPN, deletions can occur from all four compass directions. As can be seen by comparing Figures 1 and 6, HSCPN is substantially faster than ROS.
• 157. 156 4. C O N N E C T I V I T Y P R E S E R V I N G R E D U C T I O N O P E R A T O R S Connectivity preservation is a key design goal for parallel reduction processes like thin- ning. There is a need for straightforward and efficient techniques for proving connectivity preservation. When these proof techniques are stated as algorithms, they are referred to as connectivity preservation tests. Using such proof techniques, algorithm designers can more easily prove the correctness of their algorithms based on reduction operators. If one has connectivity preservation tests which can be efficiently realized (i.e., with fast execution times) in a computer program, algorithm designers can improve the efficiency of their design processes by automating the proofs of connectivity preservation for their algorithms or operators. To keep the complexity of manual or automatic proofs reasonable we wish to have proof techniques which use local support for their computations. Such approaches have been presented over the past two decades by Rosenfeld [56, 57], Ronse [53, 54] and others [17-20, 27, 29, 31, 37] to prove preservation of connectivity for various classes of thinning algorithms. The proof techniques of Rosenfeld [56] provide a method for proving certain key con- nectivity properties in thinning based on reduction operators. Kameswara Rao et al. [37] gave a connectivity preservation test for a very restricted subset of such operators. Hall [29] has determined simple local sufficient conditions for connectivity preservation for a large class of parallel thinning algorithms which use A(p)=l-based reduction operators. Eckhardt [17-20] has reported related results using his notion of perfect points. Ronse [54] has presented a set of sufficient conditions which constitute a particularly simple set of connectivity preservation tests for arbitrary parallel thinning algorithms based on reduc- tion operators. Hall [31] has related the work of Ronse and Rosenfeld and has extended the work of Ronse, deriving Ronse-like connectivity preservation tests for hexagonal im- age spaces and giving conditions under which the Ronse tests are necessary as well as sufficient. Some of this work will be presented in some detail in Sections 4.2 and 4.3. 4.1. Connectivity Properties to Preserve Connectivity preservation can be characterized in many equivalent ways. In this sec- tion a characterization is used which formed the basis for early connectivity preservation proofs for parallel thinning algorithms [56, 61]. Recall that S refers to the set of I's and S' to the set of O's in a binary image and that (m,n) = (8,4) or (4,8). A reduction operator, O, is said to preserve (m,n) connectivity if all of the following properties hold: F C l . O must not split an m-component of S into two or more m-components of I's; FC2. O must not completely delete an m-component of S; B C 3 . O must not merge two or more n-components of S' into one n-component of O's; and B C 4 . O must not create a new n-component of O's. The analogous (unstated) foreground conditions FC3, FC4 and background conditions BCl, BC2 are always satisfied for reduction operators since no O's may be changed to I's. We will focus on operators which delete only border I's. For such operators BC4 holds trivially and it will not be considered further. This classical definition of connectivity
• 158. 157 preservation is applied to algorithms by requiring the conditions to hold for each operator application. This strong condition is relaxed in the chapter on shrinking in this volume. There is a fundamental class of reduction operators of substantial interest when con- nectivity preservation is a concern; this class is the subject of most of the results in this section. Definition 4.1 A reduction operator, O, belongs to Class R when every 1 that is deleted by O is 8-simple. It has been shown that an (8,4) connectivity preserving reduction operator with 3 x 3 support must belong to Class R and that a sequential Class R operator always preserves connectivity [55, 64]. 4.2. Ronse Connectivity Preservation Tests Ronse [54] has reported a rather simple, local set of sufficient conditions for a reduction operator, O, to preserve (8,4) or (4,8) connectivity. We will focus on the (8,4) conditions. Ronse has shown that an operator is connectivity preserving if it does not completely delete certain small sets of I's. These critical sets are: single I's which are not 8-simple; pairs of 4-adjacent I's, p and g, with special conditions on N^{{p^q})] and 8-components consisting of two, three, or four mutually 8-adjacent I's. Ronse defines an 8-deletable set as a set which can be deleted while preserving connectivity in an 8-4 image. He shows that a pair of 8-simple I's, {p, ^}, is 8-deletable iff q is 8-simple after p is deleted. The following set of sufficient conditions for connectivity preservation [31] can be de- rived from Rouse's results [53, 54]: R l . If a 1 is deleted by O then it must be 8-simple; R 2 . If two 4-adjacent I's are both deleted by O, then they must constitute an 8-deletable set; R 3 . No 8-component composed of two, three, or four mutually 8-adjacent I's is completely deleted by O. Rl is a test to determine if O belongs to Class R. The test set for R3 is shown in Figure 7. The bulk of the complexity in verifying the Ronse conditions arises in the R2 test. The Ronse tests were originally formulated as sufficient conditions for proving connectivity preservation [54] but they have also been shown to be necessary (i.e., connectivity preser- vation implies satisfaction of the conditions) for completely parallel operators that satisfy certain support restrictions, including 3 x 3 operators [31]. Pavlidis [49] addresses sim- ilar issues when using his definitions of multiple and tentatively multiple I's to identify deletable I's in connectivity preserving thinning algorithms. For a discussion of multiple I's see the chapter by Arcelli and Sanniti di Baja in this volume. We can measure the complexity of the Ronse tests in terms of the number of test patterns required. For the Rl test one considers the 2^ = 256 possible patterns of I's in Ng[p) for a given 1, p, and determines those patterns for which p is not 8-simple. These are the test patterns for which the reduction operator must not delete p; there are 140 such. For the R2 test (where it is assumed that Rl has been satisfied) one must consider test patterns containing two 4-adjacent I's, p and g, where p and q are each 8-simple;
• 159. 158 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Figure 7. Test patterns for Ronse's condition R3. {p^q} is not 8-deletable; and N^{{p^q}) fl 6" is non-empty, i.e., {p^q} is not a two-pixel component of 5*—such components are part of the R3 test. For each of these test patterns, either p oi q must not be deleted by O. Of the 2^° possible patterns of I's in Ng{{p,q}) for each orientation of p^q (vertical or horizontal), 192 are of this sort. Examples of such test patterns, for the case where p and q are horizontally adjacent, are: 0 1 0 0 1 1 0 0 0 1 1 0 O p ^ O I p q 0 0 p q 0 0 0 1 0 0 0 1 1 0 1 1 0 The R3 test (where it is assumed that Rl is satisfied) is performed by determining that the nine test patterns illustrated in Figure 7 are not completely deleted by O. A computer implementation of the Ronse tests is reported in [31]. We do not have to consider all of the Ronse test patterns in detail in order to prove that an operator satisfies the Ronse tests. The following results can be derived from Ronse's work [53, 54] and help in applying the tests in proofs. Proposition 4.2 A set {p^q} Q S, where p is ^-adjacent to q, is 8-deletable iff Ng{{p,q}) n S is an 8-connected nonempty subset of Ng{{p,q}) and either p or q is 4-adjacent to a 0. This is probably the easiest condition to use for 8-deletability when doing proofs manually, since it is an easily perceived property. Proposition 4.3 Ifp andq are both 8-simple and N^{{p,q})nS is non-empty, then {p,q} is 8-deletable if Ns{{p^q}) matches either of the following patterns or their rotations by multiples of 90°. 0 0 0 p q P q I 0 Note the relative simplicity of proofs using these notions as compared to the proofs in [27, 29, 56]. For example, consider a proof that the ROS algorithm preserves connectivity. Here Rl follows directly from the definition of the operator. For R2 we consider all possible cases where two 4-adjacent I's, p and q^ are deleted by the ROS operator (say for subiterations where north border I's are deleted), giving 0 0 p q
• 160. 159 Since p and q must be 8-simple and neither p nor q is an endpoint (and hence N^{{p^q})rS is non-empty), Proposition 4.3 gives R2 immediately. Finally, it is easy to show that no 8-components in the R3 test set are completely deleted by the ROS operator. 4.3. Connectivity Preservation Tests for A ( p ) = l - B a s e d Operators HSCPN, which uses an A{p)=l deletion condition, can be proven to preserve connec- tivity using Ronse tests; but particularly simple connectivity preservation tests [29] are available for the following class of reduction operators, which includes HSCPN: Operator Class F P A reduction operator is in the FP class if the deletion of a 1, p, requires all of the following conditions: a. B(p) > 1; b. p is 4-adjacent to a 0; and c. A{p) = 1. If p satisfies these conditions it is 8-simple and deletion of p alone cannot affect connec- tivity properties in p's 8-neighborhood. Parallel deletion of all I's satisfying FP will not in general preserve all connectivity properties; thus additional conditions are required. It can be shown [28, 29] that FP class reduction operators preserve connectivity if for the following three patterns 0 p 1 q 1 0 1 1 0 p q 0 1 1 0 0 0 0 Zi Z2 0 Zs Z4 0 0 0 0 0 0 0 Hla Hlb H2 (where p, g, and the ^'s are I's and unspecified pixels' values are irrelevant), either p or q is preserved (not deleted) in Hla and Hlb and at least one of the ^'s is preserved in H2. (Similar results are reported by Eckhardt in [17-20] using his notion of perfect points.) An operator which preserves p or ^ in Hla (Hlb) is said to satisfy Hla (Hlb), and an operator which preserves one or more of the z^s in H2 is said to satisfy H2. We will refer to these connectivity preservation tests as the FP tests. Condition (a) in the definition of HSCPN guarantees that it is an FP class reduction operator. Condition (bl) ((b2)) guarantees satisfaction of Hlb (Hla) by preserving p in each case. For H2, all the z^s satisfy condition (a). Thus condition (b3) is needed; it implies that Zi is preserved. Hla-b and H2 are satisfied by a variety of other parallel operators [28, 44, 65]. Satisfying either these FP tests or the Ronse tests is sufficient for preserving connectiv- ity. Further, it is easy to show that an FP class operator satisfies Hla-b and H2 iff it also satisfies the Ronse tests. This is a useful observation when proving connectivity preser- vation properties for algorithms which use a mix of FP class and non-FP class conditions for deletion. An example of such an algorithm is given in Section 7.
• 161. 160 5. S U B I T E R A T I O N - B A S E D T H I N N I N G A L G O R I T H M S Since (as indicated in Section 3.2) fully parallel 3 x 3 reduction algorithms cannot do successful thinning, many investigators—striving to restrict themselves to a 3 x 3 support—have used a subiteration approach. In this approach, the operator is changed from iteration to iteration with a period of typically two [8, 27, 44, 60, 61, 65], four [4, 11, 35, 56, 57, 61], or eight [3]; each iteration of a period is then called a subiteration. (Suzuki and Abe's [62] two-subiteration algorithm uses an operator with support larger than 3 x 3 . ) We presented a four-subiteration algorithm in Section 3. To reduce the total number of (sub)iterations required for thinning it is desirable to reduce the period to a minimum, i.e., two. We present examples of two-subiteration algorithms in the following. 5.1. Examples of Two-Subiteration Thinning Algorithms The well known A(p)=l-based algorithm of Zhang and Suen [65] as modified by Lii and Wang [44] is presented first. Algorithm ZSLW The following pair of reduction operators is applied repeatedly. A pixel p — 1 is deleted if a. A(p) = 1; b. 3 < B{p) < 6; and: c. At odd subiterations 1. p4 = 0 or pe = 0 or p2 = ps = 0 At even subiterations 2. p2 = 0 ov ps = 0 OT p4 = pe = 0 The algorithm terminates when no deletions occur at two successive subiterations. Figure 8a illustrates the performance of this algorithm. Note the improvement over ROS (see Figure 5) in iteration counts. Condition (cl) allows deletion of border I's on an east or south boundary, or of northwest "corner" I's. Condition (c2) allows deletion of border Ts on a north or west boundary, or of southeast "corner" I's. (A similar condition was earlier used by Deutsch in [13, 14].) The original presentation of this algorithm [65] used 2 < B{p) < 6 for condition (b), which reduces to a single 1 diagonally oriented rectangles like the following: 1 1 1 1 1 1 1 1 The ZSLW operators [44, 65] for each subiteration are FP class operators and it is simple to show that the HI conditions are satisfied. Unfortunately, the H2 condition is not satisfied since the 2 x 2 component of I's is completely deleted. H2 would be satisfied if the "corner" I's were not deleted in condition (c). A similar observation was made in [19] to repair an analogous flaw in the original Rutovitz operator [58]. This deletion of 2 x 2 components can be serious since there is a large (in fact unbounded) class of components
• 162. 161 which ZSLW eventually reduces to the 2 x 2 component which it then completely deletes. Figure 8b shows an example. Next we present a C(p)=l-based two-subiteration algorithm [27] which preserves all connectivity properties and produces thinner results than ZSLW. 1 2 1 1 • • • 2 2 3 2 1 1 2 • • • 3 2 1 1 2 3 • 4 3 2 1 1 2 4 • • • • 1 2 • 4 3 2 1 • • 2 • 3 2 1 • 1 1 1 1 1 1 1 1 2 2 2 1 1 2 3 3 2 2 1 1 2 3 4 4 3 1 1 1 2 4 4 3 1 2 3 3 3 2 1 1 1 2 2 1 2 2 2 2 2 2 1 1 1 • 1 • 1 • 1 • 1 t 1 • 1 2 1 1 1 1 1 1 (a) (b) Figure 8. Examples of thinning by ZSLW. Same notation as in Figure 5. Note that in (b) the component is completely deleted. Algorithm G H 8 9 - A 1 The following pair of reduction operators is applied repeatedly. A pixel p = l is deleted if a. C{p) = 1; b. p does not satisfy the E3 endpoint condition; and: c. At odd subiterations 1. p4 = 0, or p2 = P3 = 0 and ps = 1. At even subiterations 2. ps = 0^ or pe = P7 = 0 and pi = 1. The algorithm terminates when no deletions occur at two successive subiterations. Figure 9 illustrates the performance of this algorithm. Condition (cl) is satisfied when Ns{p) takes either of the following forms:
• 163. 162 0 0 p 0 or p 1 This allows deletion of certain east and north border I's. Condition (c2) is satisfied for 180° rotations of these two conditions, allowing deletion of certain south and west border I's. Although this algorithm does not use FP class operators, connectivity preservation is easily shown for this algorithm using the Ronse tests. Rl follows easily from the definition of the operators. To show R2 we consider any two 4-adjacent 8-simple I's, p and q, at (say) odd subiterations, and we find that one of the following conditions must hold: 0 0 0 0 0 p q 0 p q p 0 1 1 1 ^ 0 In each case {p^q} is 8-deletable by Proposition 4.3; and an analogous result follows for even subiterations. Finally, it is straightforward to show that no member of the R3 test set (Figure 7) is completely deleted. • • 1 2 • 1 2 • 3 1 2 4 • 3 1 1 1 1 1 1 1 1 « 3 4 « 5 3 « • 2 « » « 7 « 3 1 2 4 6 • 5 3 1 2 4 • 5 3 1 2 • 1 • 1 • Figure 9. Example of thinning by GH89-A1. Same notation as in Figure 5. 5.2. Two-Subiteration Thinning Algorithm Design Space It is of some interest to characterize the class of all connectivity preserving two- subiteration thinning algorithms based on 3 x 3 reduction operators. We pointed out in Section 3.2 that north and south border I's, such as p and g in a long 2 x /-pixel horizontal rectangle, e.g., ... 0 0 0 0 0 ... ... 1 1 p 1 1 ... . . . 1 1 ^ 1 1 ... ... 0 0 0 0 0 ... must not both be deleted if connectivity is to be preserved. Consideration of such exam- ples leads to the well known restriction that two-subiteration algorithms that use 3 x 3 • • 1 1 1 1 2 • 1 2 • 1 • • 3 1 2 • 1 2 • 1 2 • 1 2 • 1 2 2 1
• 164. 163 operators should only delete north and west, north and east, south and west or south and east border I's at any one subiteration [56, 57]. Thus, a typical two-subiteration operator would have the following deletion conditions: TSI Deletion Conditions (north and east deletions) a. P2 = 0 or p4 = 0; b. C{p) = 1; and c. p does not satisfy the E3 endpoint condition. In addition there will be certain cases in which p must be preserved from deletion in order to preserve connectivity. We can use the Ronse tests to identify these cases. It can be verified that conditions Rl and R3 are implied by TSI. To insure R2 consider two 4-adjacent I's, p and q, which both satisfy TSI, but do not constitute an 8-deletable set, so that if both were deleted, R2 would be violated. For example, suppose the I's p,q are horizontally adjacent: e a p q b c d By TSI condition (a), e = 0. Since {p^q} is not 8-deletable, by Proposition 4.3 a = 1 and c and d cannot both be O's; and since a = 1, we must have 6 — 0 in order that q satisfy condition (a). Enumerating the allowed values of c and d for horizontally or vertically adjacent p and q we find that the following six cases include all possible cases where {p, q) is not 8-deletable: y 0 1 z p q ^ 1 1 0 0 1 0 p ^ 0 0 0 1 y 0 1 z p q 0 1 0 0 0 1 q 1 1 p 0 z y 0 1 q 1 0 p 0 0 0 0 0 0 0 q 1 1 p 0 z y (1) (2) (3) (4) (5) (6) where {y^z} are such that C{p) = 1 (i.e., y = I and z = 0 is not allowed) and the blank pixels' values are irrelevant. Cases (4), (5) and (6) can be obtained by reflection in a 45° line through q from cases (1), (2) and (3). To insure that R2 holds, preservation conditions must be added to the TSI deletion conditions to guarantee that at least one of p and q is not deleted in each of these cases. At the subiteration when south and west border I's may be deleted, preservation con- ditions based on the 180° rotations of (1-6) must be used. Similar preservation conditions hold for other border choices (e.g., south and east) for the I's deleted at one subiteration. These requirements on the preservation conditions reveal the design space for connectivity preserving two-subiteration thinning operators which satisfy the TSI deletion conditions. Note that if TSI did not include the endpoint condition, then we would also have to preserve from complete deletion the following small 8-components: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
• 165. 164 Another discussion of two-subiteration design spaces can be found in [8]. The TSI preservation conditions might be chosen to maximize the number of 3 x 3 neighborhoods of a 1, p, for which p is deleted. Alternatively, they can be chosen for their simplicity, as in the following example: Algorithm TSIN The following pair of reduction operators is applied repeatedly. A pixel ^ == 1 is deleted if: 1. At odd subiterations, ^'s neighborhood satisfies the TSI north and east deletion conditions, but does not match either of the following patterns: 0 1 0 1 ^ 0 q I 1 0 (The first pattern preserves q in TSI preservation cases (1-3), and the second in cases (4-6).) 2. At even subiterations, ^'s neighborhood satisfies the TSI south and west deletion conditions, but does not match either of the following patterns: 0 ^ 1 0 1 1 0 1 q 0 The algorithm terminates when no deletions occur at two successive subiterations. The performance of the algorithm is illustrated in Figure 10. 1 1 2 4 2 1 1 3 • 1 1 1 1 1 1 1 2 • 2 • Figure 10. Example of thinning by TSIN. Same notation as in Figure 5. There are four-subiteration algorithms which give iteration counts comparable to those of two-subiteration algorithms. In [4] a four-subiteration algorithm is defined which deletes from the south and west, north and east, north and west, and south and east directions at
• 166. 165 successive subiterations. Since deletions occur from two directions at each subiteration, its iteration counts are comparable to those of fast two-subiteration algorithms such as ZSLW. Further, this approach tends to produce more symmetrical medial curve results than two-subiteration approaches. 6. S U B F I E L D - B A S E D T H I N N I N G A L G O R I T H M S Subfield approaches are useful in thinning, shrinking and more general image processing tasks [25-27, 51, 52]. In these approaches the image is partitioned and at each iteration a parallel operator is applied only over one member (subfield) of the partition. Golay and Preston introduced this notion for images on a hexagonal grid [26, 51, 52]. Preston in Chapter 6 of [52] proposed the use of the following partition into four subfields for images on a rectangular grid: Vi V2 Vi V2 Vi ... Vs V4 Vs V4 V3 ... Vi V2 Vi V2 Vi ... Here no two 8-adjacent pixels belong to the same subfield. This property implies that if a sequential operator preserves connectivity, so does the parallel operator, with the same deletion conditions, defined on each subfield. For example, any operator which deletes only 8-simple I's preserves connectivity if appHed in parallel to any one of the subfields of this partition. Preston presented thinning algorithms using four subfields for the rectangular case [52] and three subfields for the hexagonal case [51, 52]. Since a smaller number of subfields tends to produce faster thinning, it is of interest to consider two-subfield partitions; in particular, we shall consider the "checkerboard" partition ^1 V2 Vi V2 Vi ... V2 Vi V2 Vi V2 ... Vi V2 Vi V2 Vi ... Since only the I's in one subfield can be deleted at any iteration, a pixel js's 4-neighbors do not change at the same iteration as p. Hence, it is obvious that for any "checkerboard" reduction operator the Ronse R2 condition automatically holds. Thus, for such operators only R l and R3 need to be checked. Also, the only 8-components in the R3 test set which could possibly be completely deleted are the two-pixel 8-components 1 1 1 1 where the I's are both in the same subfield. These I's are endpoints for any of the three endpoint definitions given in Section 3.1. Thus, proving connectivity preservation for checkerboard reduction operators is particularly easy. In fact any such operator which deletes only 8-simple I's (thus satisfying Rl) which are not endpoints (thus satisfying R3) is connectivity preserving. A thinning algorithm has been defined which is an adaptation of the ROS thinning
• 167. 166 algorithm [56, 57] to the checkerboard approach, and which appears to provide lower iteration counts than typical two-subiteration algorithms [27]: Algorithm GH89-A2 A 1, p, is deleted iff it is 8-simple and B{p) > 1; this is done in parallel, at alternate iterations, for each of the two checkerboard subfields. The algorithm terminates when no deletions occur at two successive iterations. Examples of the operation of this algorithm on simple images are given in Figure 11. The algorithm has particularly low iteration counts and produces ideally thin results [27]. The speed of Algorithm GH89-A2 can be understood by considering its ability to erode borders in various orientations. For example, consider an upright rectangle such as that shown in Figure l i b . We note that at the second and subsequent iterations GH89-A2 deletes all border I's which are not on the medial curve. Thus, for upright (horizontal or vertical) w x / rectangles (it? < /) GH89-A2 requires [w/2 + 1 iterations when w > 1. This is very good since even a fully parallel algorithm which deletes all border I's, without concern for connectivity preservation, would require [w/2 iterations to reduce the rectangle to unit width. Since algorithms with 3 x 3 support cannot delete pixels from the north and south or the east and west borders of the rectangle at the same (sub)iteration, the iteration counts achievable by such algorithms on these w x / rectangles are at least w — 1 (sub)iterations. Next consider diagonally oriented borders as illustrated in Figure 12. Such a border is composed of I's that are all in the same subfield and is entirely deletable by GH89-A2 in one iteration when that subfield is used. At the iteration after these border I's are deleted, the new border I's are in the other subfield and are in turn all deletable. As a result, GH89-A2 is able to delete all of these border I's at successive iterations until the vicinity of the medial curve is reached. Thus, the iteration counts of GH89-A2 on these diagonal borders again comes close to that achievable by fully parallel deletion of all border I's. Note that there are four classes of diagonal border I's, having 4-adjacent O's on the north and west, north and east, south and west, and south and east, respectively. After the first iteration GH89-A2 is able to delete all four classes of border I's at each iteration. Typical two-subiteration algorithms will only delete border I's from three of these four classes at one subiteration. Thus, the example of GH89-A2 suggests that two-subfield ("checkerboard") algorithms appear to have fundamental speed advantages over two- subiteration algorithms.
• 168. 167 1 • 1 1 • 2 • 1 2 1 2 3 • • • 2 3 2 1 2 • • • 4 3 2 1 2 3 4 • • • • 1 2 • 4 3 2 1 • 2 • 2 3 2 1 • 1 2 1 • 1 1 • • 1 1 • • • 1 • 1 • 1 • 1 2 • 2 • • 2 1 2 ^ 2 1 • 1 2 ^ 2 1 • 1 • 1 • (a) 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ^ 2 ^ 2 3 2 3 2 3 2 3 2 3 2 3 ^ 1 1 2 ^ ^ ^ ^ ^ ^ ^ 3 2 2 ^ 2 3 2 3 2 3 2 3 2 3 2 3 ^ 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ^ (b) Figure 11. Examples of operation for GH89-A2. Same notation as in Figure 5; note that odd numbers are in the subfield operated on first and even numbers are in the other subfield. • • • 3 2 1 • • • • 3 2 1 3 2 1 ^ 3 2 1 • • • • • • • 3 2 1 1 2 3 • • • 1 2 3 • • • • 1 2 3 • • • • • 1 2 3 ^ ^ ^ ^ ^ ^ 1 2 3 ^ ^ Figure 12. GH89-A2 performance on borders with diagonal orientations (only fragments of the borders are shown). The numbers indicate iterations at which I's of the original image are deleted. Odd numbers are in the first subfield used and I's which are undeleted just after iteration 3 are indicated by • 's.
• 169. 168 GH89-A2 tends to preserve medial curve branches emanating from corners of objects (see Figure 11). For example, if the corner c= 1 shown below c d 1 1 ... d i l l . . . 1 1 1 1 ... is not in the subfield used at the first iteration, then the two I's labeled d are deleted (since they are in that subfield) and on subsequent iterations c is preserved as an endpoint. Conversely, if c is in the subfield used at the first iteration then after that iteration we have the following configuration at the corner: 0 a 0 a ... a b a 1 ... 0 a 1 1 ... where a = b = 1. At the second iteration the I's labeled a are deleted and b is subsequently preserved as an endpoint. Thus, GH89-A2 tends to produce a medial curve which looks like a medial axis skeleton [5, 57]. The medial curves produced by the corners of upright rectangles are symmetrical for rectangles with odd lengths and widths, since all corners are in the same subfield. When the corners are not all in the same subfield, the resulting medial curves are not precisely symmetrical. In general the performance of two-subfield algorithms will vary somewhat depending on which subfield is used first. GH89-A2 produces medial curves with a "zigzag" pattern for certain object orientations and widths (for example upright rectangular regions of even width). This pattern can be seen in one of the examples in Figure 11. Although visually disconcerting, these patterns are of similar complexity to straight medial curves in a chain code representation. But the patterns are a disadvantage if an interpixel distance of 2^/^ between two diagonally adjacent pixels is used when estimating curve length, and they also partially conceal the essential linearity of the chain code. However, this form of medial curve can provide the least biased estimate of the position of the medial axis of, for example, a long even-width upright rectangle. 7. F U L L Y P A R A L L E L T H I N N I N G A L G O R I T H M S Ideally, we would like to use fully parallel thinning algorithms, but we have observed that fully parallel 3 x 3 algorithms cannot perform correct thinning. We will now relax the 3 x 3 support restriction. In Section 3 we gave an example (HSCPN) of a fully parallel thinning algorithm which uses an operator with a sixteen-pixel support. We will now look at some algorithms which have smaller supports. The earliest fully parallel thinning efforts are found in [13, 14, 58], although connectivity is not entirely preserved in this early work.
• 170. 169 7.1. Examples of Fully Parallel Thinning Algorithms We consider first a thinning algorithm, GH92-AFP2 [28], which is of FP class (Sec- tion 4.3), has an eleven-pixel support, and has preservation conditions which provide a simple way to satisfy Hla-b and H2 (Section 4.3). Algorithm G H 9 2 - A F P 2 A 1, p, is deleted whenever all of the following conditions are satisfied: a. Aip) = 1; b . p is 4-adjacent to a 0; c. B{p) > 2; and d. The neighborhood of p does not match any of the following patterns: 0 1 1 0 0 0 1 p 1 0 1 p 0 0 1 p 0 1 1 1 1 1 1 1 0 0 0 The algorithm terminates when no deletions occur at an iteration. Connectivity preservation follows obviously from conditions HI and H2. This algorithm is quite similar to HSCPN, with identical thinning performance on the image in Figure 6, but uses a much smaller support. GH92-AFP2 produces medial curve results which are not particularly thin [28]. A vari- ation of GH92-AFP2 has been identified [28] which achieves substantially thinner results: Algorithm G H 9 2 - A F P 3 A 1, p, is deleted whenever either of the following conditions is satisfied: a. Conditions (a), (b), (c) and (d) of GH92-AFP2 are satisfied, or b . The neighborhood of p matches either of the following patterns: 0 0 0 0 1 p 0 0 p 1 0 1 1 0 The algorithm terminates when no deletions occur at an iteration. Figure 13 contrasts the performance of GH92-AFP2 and GH92-AFP3, illustrating that thinner results can be achieved with the same iteration counts. Condition (b) of GH92- AFP3 allows deletion of I's along diagonal curves which are thicker than necessary. Similar conditions are used as a separate post-processing step in [36] while here the conditions are imbedded in the parallel operator. The support for both of these thinning operators when applied at p is the eleven-pixel set < 5 > U p shown below: s s s s s p s s s s s Algorithm GH92-AFP3 is not entirely an FP class algorithm but the connectivity
• 171. 170 • 1 1 1 • • 1 • 1 1 • • 1 1 • • 1 1 • • 1 1 • • 1 1 • 1 1 1 1 1 1 1 • 1 2 2 2 1 • • • • • 2 1 1 2 2 2 1 1 1 1 1 1 • 1 1 1 • 2 1 • 1 1 2 • 1 1 2 • 1 1 2 • 1 1 2 • 1 1 • 1 1 1 1 1 1 1 • 1 2 2 2 1 1 • • • • 2 1 1 2 2 2 1 1 1 1 1 1 Figure 13. Examples of thinning for GH92-AFP2 (left) and GH92-AFP3 (right). preservation proof is simplified since condition (a) is an FP condition. Deletion of the set of all pixels satisfying condition (a) must satisfy Hla-b and H2; thus, as stated in Section 4.3, it also satisfies the Ronse tests. Since p is 8-simple for any p satisfying con- dition (b), Ronse condition Rl holds. Further, Ronse condition R2 could only fail if for two 4-adjacent I's, p and ^, which are both deleted, at least one is deleted by condition (b). But i p satisfies (b) the I's 4-adjacent to p are not deletable, since none of these I's can satisfy both A{p) = 1 and B{p) > 2, and they also cannot satisfy (b). Thus, the R2 condition is satisfied. Finally, it is straightforward to show that no component in the R3 test set is completely deleted. 7.2. Optimally Small Supports for Fully Parallel Thinning Algorithms The two algorithms just discussed have an eleven-pixel support. (A similar eleven-pixel support is used in [10].) It has been shown that eleven-pixel supports are the smallest possible in the 8-4 case [32]; thus, the previous algorithms have optimally small supports. Further, the possible locations for the eleven pixels are tightly constrained by the following result from [32]: T h e o r e m 7.1 The support of a fully parallel thinning algorithm atp must contain at least eleven pixels. If it contains just eleven, these must consist of Ns{p) and two additional pixels chosen in one of the following two ways (see the illustration below): a. Exactly one of the x 's and one of the y 's, or b. One of the z 's and one of its ^-neighbors in the 5 x 5 square centered at p, e.g., {zi.xi], {zi.yo},... Zi Xi X2 X3 Z2 ye w w w yi ys w p w y2 y4 w w w ys Z4 xe X5 X4 Z3
• 172. 171 s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s p s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s Figure 14. An infinite set of pixels, p U < s >, no subset of which can be a support for the operator of a connectivity preserving fully parallel thinning algorithm. The results in [32] can also be used to demonstrate that algorithms whose supports are contained in the (infinite) set p U < s > illustrated in Figure 14 (and its 90° rotation) cannot provide adequate fully parallel thinning. Thus, an infinite class of inadequate supports has been identified. 7.3. Fully Parallel Thinning Algorithm Design Space In this section we will characterize a large class of connectivity preserving fully parallel thinning algorithms. A typical fully parallel thinning algorithm would use an operator with the following deletion conditions: F P T Deletion Conditions a. p is 8-simple b . p is not an E3 endpoint There will be certain cases where p must be preserved from deletion in order to preserve connectivity. We can use the Ronse tests to identify these cases. Consider two 4-adjacent I's, p and ^, both of which satisfy the FPT deletion conditions, but which do not constitute an 8-deletable set (so that if both were deleted, R2 would be violated). We find, using Propositions 4.2 and 4.3, that the only possible cases are those shown in Figure 15 and their 90° rotations, where the pairs of adjacent pixels, {a, 6}, are chosen so that C{p) = 1 and C{q) = 1 (i.e., a = 1 and 6 = 0 is not allowed). Preservation conditions must be added to the F P T deletion conditions to guarantee that at least one of p and q is not deleted in each case. Finally, we must avoid the complete deletion of a 2 x 2 square component of I's. These requirements reveal the design space for connectivity preserving fully parallel thinning algorithms which satisfy the F P T deletion conditions. We now give an example of an algorithm in which the preservation conditions are relatively simple.
• 173. 172 a 0 1 b p q b 1 0 a a 0 1 b p q Q 1 1 0 0 1 0 p q 0 0 0 1 1 0 a b p q b a 0 1 1 0 a Q p q b 1 1 (1) (2) (3) (4) (5) 1 0 0 1 1 1 1 1 1 0 p q 0 b p q 0 0 p q b 0 p q 0 1 0 0 a 0 1 1 0 a 1 1 (6) (7) (8) (9) Figure 15. Cases where the Vs p and q are both FPT-deletable but {p^q} is not 8- deletable. The values of pixels that are left blank are irrelevant; and either a = 0 or 6 = 1 in each adjacent pair {a, 6}, which ensures that C{p) = C[q) = 1. Algorithm FPTN The following completely parallel reduction operator is applied repeatedly. A pixel p = 1 is deleted if it satisfies the FPT deletion conditions, and its neighborhood does not match any of the following patterns, or the 90° rotations of (a-e): I z y I 0 1 1 0 1 1 0 0 0 O p l I p O p i p i O p l O O p l O I y z I 1 0 0 1 1 1 O i l 0 (a) (b) (c) (d) (e) (f) where {y^z} contains at least one 0. The algorithm terminates when no deletions occur at an iteration. Condition (a) preserves p from deletion in cases (5), (6), and (8) of Figure 15; condition (b) preserves q in cases (2), (3), and (7); conditions (c), (d) and (e) preserve p in cases (1), (4) and (9), respectively; and condition (f) prevents deletion of the 2 x 2 square. This operator has an optimally small eleven-pixel support. Typical performance of FPTN is illustrated in Figure 16. The iteration counts for FPTN are not better than those of HSCPN and GH92-AFP2. We will see in the next section that, in fact, these algorithms are already nearly optimally fast.
• 174. 173 1 1 1 1 2 • • 2 3 2 2 1 • 1 • 1 1 1 1 1 1 1 1 1 Figure 16. Example of thinning by FPTN. Same notation as in Figure 5. 8. I T E R A T I O N C O U N T S Designers of parallel thinning algorithms strive to reduce the iteration count (i.e., the total number of iterations required). Specific iteration counts can be measured by applying an algorithm to any given test image. It would be nice to have an estimate of the best achievable iteration count for any such image. With this we would be able to measure how close an algorithm's iteration count is to optimal for a chosen test image. We now develop such estimates, which we call lower bound estimates. In order to avoid the creation of holes, thinning algorithms usually require that a deletable 1 be a border pixel. (This requirement is necessary for small supports such as those considered in this chapter, but parallel operators with sufficiently large supports may be able to delete interior I's while preserving connectivity properties [46].) For any algorithm which deletes only border I's, there would appear to be a lower bound on the iteration count imposed by the "thickness" of the objects in the image. For example, an algorithm which deletes only border I's requires at least _w/2 iterations to produce a medial curve of width one from an upright rectangle of size w x l^ w < l. For general patterns a lower bound might be estimated by deleting border I's at successive parallel iterations (without regard to connectivity preservation) and counting the number of iterations required to reach a "final result". However, determining an appropriate final result is problematical. We could allow deletion to proceed until all remaining pixels are border pixels; let us denote the corresponding lower bound by /SQ. But we would then fail to delete any pixels of two-pixel wide upright rectangles. To address such cases we define a more refined lower bound estimate by performing deletion until all remaining pixels are border pixels, at which point we allow the estimate to include one more iteration if at least one "deletable" pixel remains. For this purpose we define two alternative deletability conditions: D l . A{p) = 1 and B{p) > 2 D 2 . [C{p) = 1 and B{p) > 2] or [C{p) = 1 and B{p) = 2 and A{p) > 1].
• 175. 174 Condition Dl is appropriate for i4(p)=l-based thinning algorithms in which the E2 end- point definition is used. Condition D2 is appropriate for C(p)=l-based algorithms in which E3 is used. We define two refined lower bound estimates, /^i and /?2, where ^i uses Dl and ^2 uses D2. We can give explicit definitions of the l3i in the following manner. For any set of I's, 5*, let t{S) = m^x{d4{p,S') peS} where d^{p^S') denotes the length of the shortest 4-path between p and a 0. 5 will be empty after exactly t{S) iterations; hence A = t(S) - 1. Next let i?(5) = {p€5M4(p,5') = <(5)} which is the set of I's of 5 removed at the t(5)-th iteration. We then have . . { i(S) if R[S) contains a pixel p satisfying Dl i(S^ — 1 otherwise. /?2 is defined analogously, but using D2 instead of Dl. (Note that the Dl and D2 conditions are computed for -^(5), not for 5.) Consider the following example images whose I's are shown: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (a) (b) /?o = 1 for both examples; ^1 = 2 for (a) and ^ — for (b); and /52 = 2 for both examples. ^ estimates the time performance achievable by an A(p)=l-based reduction operator which uses the E2 endpoint definition; whereas ^2 is more appropriate for C(p)=l-based operators which use the E3 definition. For any image we have /3Q < /^i < ^2- The I3i are not correct lower bounds for all images. Indeed, using an observation made originally by Arcelli [2], we can construct images like the following whose I's (including p = I) are shown: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 p 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
• 176. 175 In this image no 1 can be deleted without violating connectivity preservation and any correct thinning algorithm will terminate in 0 iterations; but ^Q = f3i = /32 = 2 . (Eckhardt et al. [20, 21] consider classes of similar irreducible sets with interior I's and with holes.) Thus the ^'s are only estimates of the best results achievable. Table 1 gives typical results for HSCPN, GH92-AFP2 and GH92-AFP3 for artificial and natural test images. Details of the test sets are given in [28]. The artificially created rectangle test set included rectangles of various orientations and widths. HSCPN and GH92-AFP2 are FP class algorithms and their iteration counts are compared to ^i. GH92- AFP3, which has a more liberal deletion condition (similar to that of a C(p)=l-based algorithm), is compared to ^2- The reported iteration counts do not include the final iteration, at which no changes occur. The three algorithms approach closely or are even better than their corresponding ^ estimates and for this reason we believe that they are nearly optimally fast. GH92-AFP3 produces the thinnest medial curves yet reported for a connectivity preserving fully parallel thinning algorithm. Since GH92-AFP3 produces thin results with near-optimal iteration counts, it may be an ideal choice for practitioners looking for fast effective fully parallel thinning algorithms with an optimally small operator support. Table 1 Lower bound estimates for four sets of test patterns, and iteration counts for three algo- rithms applied to these patterns. Entries are average numbers of iterations; percentages are relative to /?i for the first two algorithms and relative to ^2 for the third. Lower Bounds Thinning Algorithms Test Pattern Sets ^ ^1 ^2 HSCPN GH92-AFP2 GH92-AFP3~ English Letters 4.25 4.75 4.75 4.58 (-3.5%) 4.58 (-3.5%) 4.67 (-1.8%) Chinese Characters 5.67 5.83 6.17 5.75 (-1.4%) 5.75 (-1.4%) 6.17 ( 0.0%) Arabic Words 4.92 5.08 5.33 5.17 ( 1.6%) 5.00 (-1.6%) 5.25 (-1.5%) Rectangles 3.71 3.88 4.15 3.90 ( 0.5%) 3.90 ( 0.5%) 4.18 ( 0.7%) The actual computing time for a given thinning algorithm implemented on a specific machine will depend on the time complexity of the implementation of the operator(s) as well as the iteration counts. But if we assume that sufficient hardware is available to enable the computation of any given local operator in some fixed time—this would be reasonable if, for example, operators are stored in lookup tables—then iteration counts are an appropriate measure of computing time. Further, when the iteration counts for an algorithm are given, it is possible to predict the performance of an implementation of the algorithm on any particular machine by evaluating the time complexities of the required operators. Chen and Hsu [9] use the number of 3 x 3 neighborhoods of a 1 for which the 1 is deleted as another measure of parallel thinning operator efficiency. A variety of issues relevant to the realization of parallel thinning algorithms on parallel architectures are addressed in [10, 33, 40, 47, 49].
• 177. 176 9. S U M M A R Y A variety of approaches to parallel thinning using operators with small supports have been reviewed, with some emphasis on how one may preserve, and prove one has preserved, connectivity. Simple connectivity preservation tests have been presented for A{p)=l-heised and C(p)=l-based parallel thinning operators and examples have been given of how to use these tests to prove connectivity preservation for various thinning algorithms. For funda- mental classes of parallel thinning algorithms, including fully parallel, two-subiteration, and two-subfield, conditions have been identified using these tests which are sufficient for preservation of connectivity. Thus design spaces for connectivity preserving operators belonging to these classes have been described. Some fundamental limitations on fully parallel thinning algorithms have been reviewed, including constraints on support size and shape. The outputs of the algorithms considered in this chapter tend to be fairly similar, usually differing mainly in how well the endpoint condition prevents excessive erosion and in the thinness of the medial curve. The algorithms are more clearly distinguished by their iteration counts. Most existing fully parallel thinning algorithms seem to be nearly optimally fast. This suggests that little further progress is attainable in improving their time performance. There is some irony in the fact that the early thinning algorithms of Rutovitz [58] and Deutsch [13, 14] were very similar to recently defined fully parallel algorithms (e.g., GH92-AFP3 [28]) which appear to be near-optimal. Acknowledgment The author enjoyed the incisive comments of the editors, T.Y. Kong and A. Rosenfeld, regarding many facets of the material in this chapter. R E F E R E N C E S 1 C. Arcelli. A condition for digital points removal. Signal Processing^ 1:283-285, 1979. 2 C. Arcelli. Pattern thinning by contour tracing. Comput. Graphics Image Process., 17:130-144, 1981. 3 C. Arcelli, L. Cordelia, and S. Levialdi. Parallel thinning of binary pictures. Elec- tronics Letters, 11:148-149, 1975. 4 C. Arcelli, P.C.K. Kwok, and G. Sanniti di Baja. Parallel pattern compression by octagonal propagation. Int. Journal of Pattern Recognition and Artificial IntelL, 7:1077-1102, 1993. 5 H. Blum. A transformation for extracting new descriptors of shape. In W. Wat hen- Dunn, editor, Models for the Perception of Speech and Visual Form, pages 362-380. MIT Press, Cambridge, MA, 1967. 6 N.G. Bourbakis. A parallel-symmetric thinning algorithm. Pattern Recognition, 22:387-396, 1989. 7 Y.S. Chen and W.H. Hsu. A 1-subcycle parallel thinning algorithm for producing perfect 8-curves and obtaining isotropic skeleton of an L-shape pattern. In Proceedings
• 178. 177 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pages 208-215, San Diego, CA, June 4-8, 1989. 8 Y.S. Chen and W.H. Hsu. A systematic approach for designing 2-subcycle and pseudo 1-subcycle parallel thinning algorithms. Pattern Recognition, 22:267-282, 1989. 9 Y.S. Chen and W.H. Hsu. A comparison of some one-pass parallel thinnings. Pattern Recognition Letters, 11:35-41, 1990. 10 R.T. Chin, H.K. Wan, D.L. Stover, and R.D. Iverson. A one-pass thinning algorithm and its parallel implementation. Comput. Vision Graphics Image Process., 40:30-40, 1987. 11 E.R. Davies and A.P.N. Plummer. Thinning algorithms: A critique and a new methodology. Pattern Recognition, 14:53-63, 1981. 12 A.L. DeCegama. The Technology of Parallel Processing: Parallel Processing Archi- tectures and VLSI Hardware, volume 1. Prentice-Hall, Englewood Cliffs, NJ, 1989. 13 E.S. Deutsch. Towards isotropic image reduction. In Proceedings IFIP Congress 1971, pages 161-172, Ljubljana, Yugoslavia, 1971. North-Holland. 14 E.S. Deutsch. Thinning algorithms on rectangular, hexagonal, and triangular arrays. Comm. ACM, 15:827-837, 1972. 15 M.J.B. Duff and T.J. Fountain, editors. Cellular Logic Image Processing. Academic Press, New York, 1986. 16 C.R. Dyer and A. Rosenfeld. Thinning algorithms for grayscale pictures. IEEE Trans. Pattern Anal. Mach. IntelL, PAMI-1:88-89, 1979. 17 U. Eckhardt. Digital topology I. A classification of 3 x 3 neighborhoods with appli- cation to parallel thinning in digital pictures. Technical Report Reihe A, Preprint 8, Hamburger Beitrage zur Angewandten Mathematik, Hamburg, Germany, August 1987. 18 U. Eckhardt. Digital topology II. Perfect points on the inner boundary. Technical Report Reihe A, Preprint 11, Hamburger Beitrage zur Angewandten Mathematik, Hamburg, Germany, November 1987. 19 U. Eckhardt. A note on Rutovitz' method for parallel thinning. Pattern Recognition Letters, 8:35-38, 1988. 20 U. Eckhardt and G. Maderlechner. Parallel reduction of digital sets. Siemens Forsch.- u. Entwickl.-Ber., 17:184-189, 1988. 21 U. Eckhardt and G. Maderlechner. The structure of irreducible digital sets obtained by thinning algorithms. In Proceedings Ninth IA PR International Conference on Pattern Recognition, pages 727-729, Rome, Italy, November 14-17, 1988. 22 U. Eckhardt and G. Maderlechner. Thinning of binary images. Technical Report Reihe B, Bericht 11, Hamburger Beitrage zur Angewandten Mathematik, Hamburg, Germany, April 1989. 23 T.J. Fountain and M.J. Shute, editors. Multiprocessor Computer Architectures. North-Holland, Amsterdam, 1990. 24 V. Goetcherian. From binary to grey tone image processing using fuzzy logic concepts. Pattern Recognition, 12:7-15, 1980. 25 M. Gokmen and R.W. Hall. Parallel shrinking algorithms using 2-subfields ap- proaches. Comput. Vision Graphics Image Process., 52:191-209, 1990. 26 M.J.E. Golay. Hexagonal parallel pattern transformations. IEEE Trans. Computers,
• 179. 178 C-18:733-740, 1969. 27 Z. Guo and R.W. Hall. Parallel thinning with two-subiteration algorithms. Comm. ACM, 32:359-373, 1989. 28 Z. Guo and R.W. Hall. Fast fully parallel thinning algorithms. CVGIP: Image Un- derstanding, 55:317-328, 1992. 29 R.W. Hall. Fast parallel thinning algorithms: Parallel speed and connectivity preser- vation. Comm. ACM, 32:124-131, 1989. 30 R.W. Hall. Comments on 'A parallel-symmetric thinning algorithm' by Bourbakis. Pattern Recognition, 25:439-441, 1992. 31 R.W. Hall. Tests for connectivity preservation for parallel reduction operators. Topol- ogy and Its Applications, 46:199-217, 1992. 32 R.W. Hall. Optimally small operator supports for fully parallel thinning algorithms. IEEE Trans. Pattern Anal. Mach. IntelL, PAMI-15:828-833, 1993. 33 S. Heydorn and P Weidner. Optimization and performance analysis of thinning algo- rithms on parallel computers. Parallel Computing, 17:17-27, 1991. 34 C.J. Hilditch. Linear skeletons from square cupboards. In B. Meltzer and D. Michie, editors, Machine Intelligence 4^ pages 403-420. American Elsevier, New York, 1969. 35 C.J. Hilditch. Comparison of thinning algorithms on a parallel processor. Image and Vision Computing, 1:115-132, 1983. 36 C M . Holt, A. Stewart, M. Clint, and R.H. Perrott. An improved parallel thinning algorithm. Comm. ACM, 30:156-160, 1987. 37 C.V. Kameswara Rao, D.E. Danielsson, and B. Kruse. Checking connectivity preser- vation properties of some types of picture processing operations. Comput. Graphics Image Process., 8:299-309, 1978. 38 J. Kit tier and M.J.B. Duff, editors. Image Processing System Architectures. Wiley, New York, 1985. 39 T.Y. Kong and A. Rosenfeld. Digital topology: Introduction and survey. Comput. Vision Graphics Image Process., 48:357-393, 1989. 40 J.T. Kuehn, J.A. Fessler, and H.J. Siegel. Parallel image thinning and vectorization on PASM. In Proceedings IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pages 368-374, San Francisco, CA, June 10-13, 1985. 41 L. Lam, S-W. Lee, and C.Y. Suen. Thinning methodologies-A comprehensive survey. IEEE Trans. Pattern Anal. Mach. IntelL, PAMM4:869-885, 1992. 42 H. Li and Q. F. Stout, editors. Reconfigurable Massively Parallel Computers. Prentice Hall, Englewood Cliffs, NJ, 1991. 43 X. Li and A. Basu. Variable-resolution character thinning. Pattern Recognition Let- ters, 12:241-248, 1991. 44 H.E. Lii and P.S.P. Wang. A comment on "A fast parallel algorithm for thinning digital patterns". Comm. ACM, 29:239-242, 1986. 45 N.J. Naccache and R. Shinghal. An investigation into the skeletonization approach of Hilditch. Pattern Recognition, 17:279-284, 1984. 46 L. O'Gorman. k x k thinning. Comput. Vision Graphics Image Process., 51:195-215, 1990. 47 J. Olszewski. A flexible thinning algorithm allowing parallel, sequential and dis- tributed application. ACM Trans. Math. Software, 18:35-45, 1992.
• 180. 179 48 T. Pavlidis. Algorithms for Graphics and Image Processing. Springer-Verlag, Berlin, 1982. Chap. 9. 49 T. Pavlidis. An asynchronous thinning algorithm. Comput. Graphics Image Process.^ 20:133-157, 1982. 50 R. Plamondon and C.Y. Suen. Thinning of digitized characters from subjective exper- iments: A proposal for a systematic evaluation protocol of algorithms. In A. Krzyzak, T. Kasvand, and C.Y. Suen, editors, Computer Vision and Shape Recognition. World Scientific, Singapore, 1989. 51 K. Preston. Feature extraction by Golay hexagonal pattern transforms. IEEE Trans. Computers, C-20:1007-1014, 1971. 52 K. Preston and M.J.B. Duff. Modern Cellular Automata - Theory and Applications. Plenum Press, New York, 1984. 53 C. Ronse. A topological characterization of thinning. Theoret. Comput. Sci., 43:31- 41, 1986. 54 C. Ronse. Minimal test patterns for connectivity preservation in parallel thinning algorithms for binary digital images. Discrete Applied Math., 21:67-79, 1988. 55 A. Rosenfeld. Connectivity in digital pictures. J. ACM, 17:146-160, 1970. 56 A. Rosenfeld. A characterization of parallel thinning algorithms. Information and Control, 29:286-291, 1975. 57 A. Rosenfeld and A.C. Kak. Digital Picture Processing, volume 2. Academic Press, New York, second edition, 1982. 58 D. Rutovitz. Pattern recognition. J. Royal Statist. Soc, 129:504-530, 1966. 59 R.W. Smith. Computer processing of line images: A survey. Pattern Recognition, 20:7-15, 1987. 60 J.H. Sossa. An improved parallel algorithm for thinning digital patterns. Pattern Recognition Letters, 10:77-80, 1989. 61 R. Stefanelli and A. Rosenfeld. Some parallel thinning algorithms for digital pictures. J. ACM, 18:255-264, 1971. 62 S. Suzuki and K. Abe. Binary picture thinning by an iterative parallel two-subcycle operation. Pattern Recognition, 20:297-307, 1987. 63 H. Tamura. A comparison of line thinning algorithms from dfgital geometry viewpoint. In Proceedings Fourth lAPR International Conference on Pattern Recognition, pages 715-719, Tokyo, Japan,1978. 64 S. Yokoi, J. Toriwaki, and T. Fukumura. An analysis of topological properties of digitized binary pictures using local features. Comput. Graphics Image Process., 4:63- 73, 1975. 65 T.Y. Zhang and C.Y. Suen. A fast parallel algorithm for thinning digital patterns. Comm. ACM, 27:236-239, 1984.
• 181. Topological Algorithms for Digital Image Processing T.Y. Kong and A. Rosenfeld (Editors) © 1996 Elsevier Science B.V. All rights reserved. 181 ON THE SOUNDNESS OF SURFACE VOXELIZATIONS D. Cohen-Or * A. E. Kaufman ^ T. Y. Kong ^ ^School of Mathematical Sciences, Tel Aviv University, Ramat Aviv 69978, Israel ^Department of Computer Science, State University of New York at Stony Brook, Stony Brook, NY 11794-4400, U.S.A. ^^Department of Computer Science, Queens College, City University of Nev^ York, Flushing, NY 11367-1597, U.S.A. Abstract A voxelization of a mathematically defined continuous object in Euclidean 3-space is a set of voxels that may be used as a discrete representation of the continuous object. The generation of voxelizations is an important part of volume graphics. This chapter deals with the voxelization of surfaces. In this case the voxelization should be a thin connected set of voxels with appropriate local separation properties. The voxelization should be free of small holes that would allow a discrete ray in its complement to pass from one side of the continuous surface to the other. No part of the continuous surface should be far from the voxelization, and no part of the voxelization should be far from the surface. We state several mathematical conditions which express these requirements in a precise way. Some of the conditions were proposed a number of years ago (in a rather different context) by Morgenthaler and Rosenfeld. Two voxelizations of planes in 3-space are described, and shown to satisfy all of the conditions. 1. Introduction In recent years the use of 3-dimensional digital images has been encouraged by advances in computer hardware and memory systems, and the development of more efficient ren- dering algorithms for such images. Volume graphics is an emerging field that deals with the creation, manipulation and rendering of 3-dimensional digital images [4]. Voxeliza- tion algorithms play an important role in volume graphics. These algorithms are used to generate a set of voxels that is a discrete representation of a mathematically defined con- tinuous object in (Euclidean) 3-space, such as a curve or a surface specified by equations. The set of voxels generated is called a voxelization of the continuous object. The voxelization is expected to satisfy certain conditions. Topological properties of the continuous object that is voxelized, such as its connectedness, should be reflected in analogous properties of the voxelization. Moreover, the union of the voxels in the voxelization should closely approximate the continuous object. In this chapter we give a set of conditions to be satisfied by voxelizations of surfaces in 3-space. Two voxelizations of planes in 3-space will be described, and both of them will be shown to satisfy the given conditions.