1. Trang chủ
  2. » Công Nghệ Thông Tin

topological algorithms for digital image processing

293 457 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Topological algorithms for digital image processing
Trường học Unknown University
Chuyên ngành Digital Image Processing
Thể loại Thesis
Năm xuất bản Unknown
Thành phố Unknown
Định dạng
Số trang 293
Dung lượng 14,62 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

This chapter describes algorithms for connected component labeling and region adjacency graph construction.. If it is non-zero, then there is an equivalence class and the value of LABEL

Trang 4

Objects in t h r e e dimensions, and their two-dimensional images, are a p p r o x i m a t e d

dig-itally by sets of voxels ("volume elements") or pixels ("picture elements"), respectively Digital geometry is t h e study of geometric properties of digitized objects (or digitized

images of objects); it deals b o t h with t h e definitions of such properties and with

algo-r i t h m s foalgo-r theialgo-r computation In paalgo-rticulaalgo-r, digital topology deals with palgo-ropealgo-rties of a

"topological" n a t u r e (particularly, properties t h a t involve t h e concepts of connectedness

or adjacency, b u t do not depend on size or shape), and with algorithms t h a t c o m p u t e

or preserve such properties Topological properties and algorithms play a fundamental role in t h e 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 t h e same is therefore

t r u e for images of t h e object obtained from any viewpoint T h u s if a three- (or two-) dimensional digital image can be segmented into "object" and "background" voxels (or pixels), t h e connected components of t h e object voxels or pixels are t h e individual objects

(or their images) Connected component labeling is t h e process of assigning a distinct label

to t h e voxels (pixels) t h a t belong to each distinct object T h e first chapter, by Shapiro, defines t h e 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 b o t h two- and three-dimensional digital images An algorithm for constructing t h e graph representing t h e pairwise adjacencies of t h e components is also presented An appendix to this chapter, coauthored by t h e editors, provides a simple proof of t h e correctness of Lumia's algorithms

T h e second chapter, coauthored by Hall and t h e editors, discusses shrinking algorithms,

which reduce t h e sizes of t h e components in an image Shrinking to a topological equivalent

reduces t h e n u m b e r of object pixels while preserving t h e topology of t h e image (i.e., not

changing t h e connectivity properties of t h e objects or t h e 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 T h e chapter discusses parallel algorithms for b o t h kinds of shrinking, but focuses on shrinking to a residue

Many i m p o r t a n t classes of two-dimensional "objects" are composed mostly or entirely

of elongated parts; for example, alphanumeric characters are composed of strokes T h e representation of such an object by a set of pixels can be simplified by a process known

as thinning, which reduces t h e elongated parts to one-pixel-thick arcs or closed curves,

without changing t h e connectivity properties of t h e object or of its background (Note t h a t elongatedness is not a topological property, but thinning is a topology-preserving process.)

T h e result of thinning a two-dimensional object is usually called t h e skeleton of t h e object

T h e third chapter, by Arcelli and Sanniti di Baja, reviews a variety of skeletonization

m e t h o d s , with emphasis on t h e adequacy with which t h e branches (constituent arcs or curves) of a skeleton represent t h e elongated parts of t h e original object It is easy to insure t h a t a skeletonization process preserves topology if t h e process is sequential (e.g.,

it deletes pixels from an object one at a t i m e ) , but more difficult if t h e process is highly parallel; t h e fourth chapter, by Hall, discusses parallel thinning algorithms and methods

of proving t h a t they preserve topology Neither of these chapters t r e a t s thinning of

Trang 5

three-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 dimensional Euclidean space, such as planes and spheres, is considered in the fifth chapter,

three-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

Trang 6

T.Y Kong and A Rosenfeld (Editors)

© 1996 Elsevier Science B.V All rights reserved

Connected Component Labeling and Adjacency Graph

analysis of t h e image is an operation called connected component labeling t h a t groups t h e

pixels into regions, such t h a t adjacent pixels have t h e same label, and pixels belonging to distinct regions have different labels Properties of t h e regions and relationships among

t h e m m a y t h e n be calculated T h e most common relationship, spatial adjacency, can be

represented by a region adjacency graph This chapter describes algorithms for connected

component labeling and region adjacency graph construction In addition to giving several sequential algorithms for two-dimensional connected component labeling, it also discusses several parallel algorithms and an algorithm for three-dimensional connected component labeling

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

Decomposition of an image into regions is a widely used technique in machine vision

In m a n y cases, t h e original gray tone image can be thresholded to produce a binary age whose pixels are labeled as foreground or background Objects of interest are t h e connected regions composed of the foreground pixels For example, in character recogni-tion, t h e image pixels comprising t h e characters form the foreground and t h e remaining pixels t h e background T h e general procedure is to produce t h e binary image, determine

im-t h e connecim-ted regions of iim-ts foreground pixels, calculaim-te properim-ties of im-these regions, and apply a decision procedure to classify regions or select regions of interest In character recognition, t h e goal is to classify each of t h e characters

In other applications, such as aerial image analysis, t h e image m a y be segmented into

m a n y regions representing m a n y different types of entities, such as buildings, streets, grassy areas and forests Each separate type of entity is represented by a different label and t h e points of t h a t entity are all assigned t h a t label by t h e segmentation process T h e result is called a symbolic image In this case, t h e general processing paradigm includes segmenting t h e original image, determining t h e connected regions of pixels having each

Trang 7

t h e regions, and applying a decision procedure to classify regions or sets of regions of interest

In b o t h t h e binary case and t h e more general case, t h e analysis begins with an operation

called connected component labeling t h a t groups adjacent image pixels t h a t have t h e same

label into regions In t h e general case, m a n y different relationships among t h e regions can be calculated T h e most common relationship is spatial adjacency, which can be

represented by a graph structure called a region adjacency graph This chapter describes

t h e algorithms required t o perform connected component labeling and t o construct t h e region adjacency graph

n a m e or index of t h e region to which t h e pixels belong A region has shape and position properties, statistical properties of t h e gray levels of t h e pixels in t h e region, and spatial relationships t o other regions

Two black pixels p and q belong to t h e same connected component C if there is a sequence of black pixels ( p c P i , • • • ,Pn) of C where po = p, Pn = q^ and pi is a neighbor of Pi-i (see Figure 2) for z = 1 , , n Thus t h e definition of a connected component depends

on t h e definition of neighbor W h e n only t h e north, south, east, and west neighbors of

a pixel are considered to be in its neighborhood, then t h e resulting regions are called

4-connected W h e n t h e north, south, east, west, northeast, northwest, southeast, and

southwest neighbors of a pixel are considered to be in its neighborhood, t h e resulting

regions are called 8-connected Whichever definition is used, t h e neighbors of a pixel are said t o b e adjacent to t h a t pixel T h e border of a connected component of black pixels

is t h e subset of pixels belonging to t h e component t h a t are adjacent t o white pixels (by whichever definition of adjacency is being used for t h e black pixels)

Rosenfeld (1970) has shown t h a t 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

Trang 8

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 b o t h black pixels and white pixels and not when 8-connectedness is used for b o t h black pixels and white pixels Figure 3 illustrates this phenomenon T h e 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 t h e other for white pixels

T h e 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 T h e speed of t h e algorithm t h a t performs t h e connected components operation is often critical to the feasibility of t h e application In t h e next three sections we discuss several algorithms t h a t label connected components using two sequential passes over t h e image

All t h e algorithms process a row of t h e image at a time Modifications to process a rectangular window subimage at a t i m e are straightforward All t h e algorithms assign new labels t o t h e first pixel of each component and a t t e m p t to propagate t h e label of a black pixel t o its black neighbors to t h e right or below it (we assume 4-adjacency with a left-to-right, t o p - t o - b o t t o m scan order) Consider t h e image shown in Figure 4 In t h e first row, two black pixels separated by three white pixels are encountered T h e first is

Trang 9

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 T H E CLASSICAL ALGORITHM

The classical algorithm, deemed so because it is based on the classical connected 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

Trang 10

t h e original binary image, and (b) t h e partially processed image

label propagates and each such equivalence found is entered in an equivalence table Each entry in t h e equivalence table consists of an ordered pair, t h e values of its components being t h e labels found t o be equivalent After t h e first pass, t h e equivalence classes are found by taking t h e transitive closure of t h e set of equivalences recorded in t h e equiva-lence table Each equivalence class is assigned a unique label, usually t h e m i n i m u m (or oldest) label in t h e class Finally, a second pass through t h e image performs a translation, assigning to each pixel t h e label of t h e equivalence class of its pass-1 label This process

is illustrated in Figure 5, and an implementation of t h e algorithm is given below

Trang 12

T h e notation N E I G H B O R S ( ( L , P ) ) refers to t h e already-encountered 1-valued neighbors

of pixel ( L , P ) T h e algorithm referred to as RESOLVE is simply t h e algorithm for finding

t h e connected components of t h e graph defined by t h e set of equivalences ( E Q T A B L E ) defined in pass 1 T h e nodes of t h e graph are region labels, and t h e edges are pairs

of labels t h a t have been found to be equivalent T h e procedure, which uses a s t a n d a r d depth-first search algorithm, can be stated as follows:

In this procedure, Ust-of-components is a list t h a t will contain t h e final resultant

equiv-alence classes T h e function D F S performs a depth-first search of t h e graph beginning

at t h e given node N and returns a list of all t h e nodes it has visited in t h e process It also m a r k s each node as it is visited A standard depth-first search algorithm is given in Horowitz and Sahni (1982) and in most other d a t a structures texts

In procedure CLASSICAL, determination of t h e smallest equivalents of t h e labels volves examining t h e labels in each equivalence class after all t h e equivalence classes have been explicitly constructed However, t h e smallest equivalent labels can be found a little more efficiently by using t h e fact t h a t if t h e labels in E Q T A B L E are processed in ascend-ing order, t h e n N is t h e smallest equivalent of each label visited by D F S ( N , E Q T A B L E )

Trang 13

in-t h r o u g h in-t h e image, plus in-t h e complexiin-ty of RESOLVE which depends on in-t h e n u m b e r of equivalent pairs in E Q T A B L E T h e main problem with t h e classical algorithm is t h e global table For large images with m a n y regions, t h e table can become very large On some machines there is not enough memory to hold the table On other machines t h a t use paging, t h e table gets paged in and out of memory frequently For example, on a VAX 11/780 system with 8 megabytes of memory, t h e classical algorithm ran (including I / O )

in 8.4 seconds with 1791 page faults on one 6000 pixel image, b u t took 5021 seconds with 23,674 page faults on one 920,000-pixel image This motivates algorithms t h a t avoid t h e use of t h e 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 S P A C E 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 t o t h e space problem is t h e use of a small local equivalence table t h a t stores only t h e equivalences detected from t h e current row of t h e image and t h e row t h a t precedes it T h u s t h e m a x i m u m number of equivalences is t h e number of pixels per row These equivalences are then resolved, and t h e pixels are relabeled in a second scan of

t h e row; t h e new labels are then propagated to t h e next row In this case not all t h e equivalencing is completed by t h e end of t h e first (top-down) pass, and a second pass is required for b o t h finding t h e remainder of t h e equivalences and assigning t h e final labels

T h e algorithm is illustrated in Figure 6 Note t h a t t h e second pass is b o t t o m - u p We will give t h e general algorithm (Lumia, Shapiro, and Zuniga, 1983) and t h e n describe, in more detail, an efficient run-length implementation

Trang 14

Figure 6 Results after t h e top-down pass of t h e local table m e t h o d on t h e binary image

of Figure 5 Note t h a t on t h e rows where equivalences were detected, t h e pixels have different labels from those they had after pass 1 of t h e classical algorithm For example,

on row 5 t h e four leading 3s were changed t o 2s on t h e second scan of t h a t row, after t h e equivalence of labels 2 and 3 was detected T h e b o t t o m up pass will now propagate t h e label 1 t o all pixels of t h e single connected component

Trang 15

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)

T h e complexity of t h e local table m e t h o d for an n x n image is also O(n^) -f n times

t h e complexity of RESOLVE for one row of equivalences However, in comparison with

t h e classical algorithm, t h e local table m e t h o d took 8.8 seconds with 1763 page faults on

t h e 6000-pixel image, but only 627 seconds with 15,391 page faults on t h e 920,000-pixel image, which is 8 times faster For an even larger 5,120,000-pixel image, t h e local table

m e t h o d ran 31 times faster t h a n t h e 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 O F T H E L O C A L

T A B L E M E T H O D

In m a n y industrial applications t h e 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, t h e local table

m e t h o d as implemented on t h e VAX 11/780 took 116 seconds to execute, including I / O

t i m e B u t industrial applications often require times of less t h a n one second To achieve this kind of efficiency, t h e algorithm can be implemented on a machine with some special

h a r d w a r e capabilities T h e hardware is used to rapidly extract a run-length encoding of

t h e image, and t h e software implementation can then work on t h e more compact length d a t a Ronse and Devijver (1984) advocate this approach

run-A run-length encoding of a binary image is a list of contiguous (typically, horizontal)

runs of black pixels For each run, t h e location of t h e starting pixel of t h e run and either its length or t h e location of its ending pixel must be recorded Figure 7 shows t h e run-length d a t a s t r u c t u r e used in our implementation Each run in t h e image is encoded by

t h e locations of its starting and ending pixels ( R O W , START_COL) is t h e location of t h e

s t a r t i n g pixel and ( R O W , END_COL) is t h e location of t h e ending pixel P E R M _ L A B E L

Trang 16

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

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 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

pro-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), , P E R M - L A B E L ( Q K ) 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

Trang 17

dynamically updating large equivalence classes, the union-find algorithm (Tarjan, 1975)

may be preferable

1 2 3

Previous row Current row

1, 2, and 3 have all been determined to be equivalent, so LABEL(l), LABEL(2), and 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

LA-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

Trang 18

of t h e larger class to change all its labels when only one element is being added W h e n b o t h classes are single-member or b o t h are multimember t h e label of t h e first class is selected

as t h e equivalence class field T h e equivalencing procedure, M A K E _ E Q U I V A L E N T , 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 R l 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

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."

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

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);

Trang 19

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:

t h e n begin Q := 0; QLAST := 0 end

else b e g i n Q := R0W_START(L-1); QLAST := R0W_END(L-1) end;

"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

E N D X O L ( 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."

Trang 20

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 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."

PLABEL < > 0 and LABEL(PLABEL) < > 0:

"P has permanent label and equivalence class;

assign the equivalence class label."

Trang 21

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) t h e n begin

LABEL(PERM_LABEL(P)) := PERM-LABEL(Q); PERM_LABEL(P) := PERM_LABEL(Q)

P := P + 1 END_COL(Q) = END-COL(P):

begin Q := Q+1; P := P + 1 end end case;

end end case end while

Trang 22

T h e r e is another significant difference between procedure RUN_LENGTH_ I M P L E

-M E N T A T I O N and procedure LOCAL_TABLE_-METHOD, in addition to their use

of different d a t a structures Procedure LOCAL_TABLE_METHOD computes alence classes using R E S O L V E b o t h in t h e top-down pass and in t h e b o t t o m - u p pass Procedure R U N X E N G T H J M P L E M E N T A T I O N updates equivalence classes in

equiv-t h e equiv-top-down pass using M A K E J E Q U I V A L E N T , buequiv-t in equiv-t h e b o equiv-t equiv-t o m - u p pass iequiv-t only propagates and replaces labels This gives correct results not only in procedure

R U N X E N G T H J M P L E M E N T A T I O N 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

T h e images handled by our algorithms so far are two-dimensional images Both t h e definition of connected components and t h e algorithms can be generahzed to three-

dimensional images, which are sequences of two-dimensional images called layers T h e

generalization of t h e definition results straightforwardly from t h e generalization of t h e

concept of a neighborhood Suppose t h a t a 3D image consists of N R O W S rows by NCOLS

columns by NLAYERS layers T h e n t h e neighborhood of a voxel (in 3D we use this t e r m 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: t h e 6-neighborhood, the 18-neighborhood, and t h e 26-neighborhood These are illustrated in Figure 9 Using these 3D neighborhoods, t h e definition of a 3D con-nected component is identical to t h e definition of a 2D connected component T h a t is,

two black voxels p and q belong to t h e 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

Figure 9 (a) Voxels, • , t h a t are 6-neighbors of voxel p; (b) voxels • , t h a t are 18-neighbors

of voxel p; (c) voxels, • , t h a t are 26-neighbors voxel p

T h e local table m e t h o d of computing connected components was generalized t o 3D by Lumia (1983) T h e 3D algorithm can be summarized as follows:

Trang 23

1 Label t h e 2D connected components in each layer in such a way t h a t different labels are used in different layers

2 P r o p a g a t e t h e label equivalences from t h e first t o t h e last layer, using t h e same basic process as in t h e two-dimensional local table algorithm, except t h a t t h e propagation

is now between t h e layers rather t h a n between t h e rows Repeat this process going from t h e last layer to t h e first layer

Figure 10 illustrates t h e 3D connected components algorithm on a simple 3-layer image

If t h e local table m e t h o d is used in each layer, its complexity for an n x n x n image is O(n^) + (n^ times t h e complexity of RESOLVE for each row) -f (n times t h e complexity

of R E S O L V E 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

T h e use of parallel architectures can speed up t h e 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 t i m e on an image of any size T h e connected components operator cannot be executed in t h e same way, because it has t o 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

T h e most c o m m o n algorithm is parallel propagation on a SIMD machine T h e idea of t h e

algorithm is t o 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 t h e algorithm, t h e label of a pixel is

p r o p a g a t e d t o its neighbors, using some suitable m e t h o d for resolving conflicts as in t h e sequential algorithms W h e n there is no further change to t h e image at some iteration,

t h e process is complete A simple example of this procedure is an algorithm t h a t begins

by assigning a unique label to each pixel of t h e image and then, at each iteration, replaces

t h e value of a pixel by t h e m i n i m u m of t h e values of itself and its neighbors Manohar and R a m a p r i y a n (1989) present other, more advanced algorithms

If t h e r e is one processor for each pixel of t h e image, t h e complexity of t h e parallel

propagation algorithm is 0 ( D ) , where D is t h e number of iterations needed t o propagate

a label from each pixel to every other pixel in t h e same component Each iteration takes

a constant a m o u n t of t i m e , since it involves a neighborhood of constant size W h e n t h e

components are convex we have D < n ior an n x n image If t h e components can be nonconvex, D can be O(n^)

If t h e machine has only mxm processors, m <Cn, t h e image can be divided into n^/m^ windows, each of size mxm, and t h e parallel algorithm can be applied t o 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 t h a t using a pyramid architecture can speed u p allel algorithms, and presented a components algorithm for a SIMD pyramid machine In such a machine, t h e base is an array of 2^ x 2^ nodes; t h e first ( b o t t o m m o s t ) level above

par-t h e base has one node (par-the parenpar-t) for each square block of four nodes in par-t h e base; par-t h e second level above t h e base has one node for each square block of four nodes in t h e first

Trang 25

level; a n d so on, so t h a t t h e topmost level has only a single node T h e neighborhood of a node in a pyramid includes itself, its 8-neighbors on its own level, its parent, a n d its four children T h e operation A N D P Y R ( X ) in a pyramid X with a binary image in its base a n d zeroes everywhere else is defined t o compute t h e new value of each node at each level as

t h e logical A N D of t h e old values of its four children T h e conditional dilation operation [DIL I Y](X) is defined t o dilate t h e black pixels in pyramid X, i.e t o propagate black values ( I ' s ) t o all their pyramidal neighbors, on t h e condition t h a t these neighbors are black pixels in pyramid Y If t h e base of X initially contains a single black seed pixel, t h e base of Y initially contains t h e binary image t o be labeled and t h e pixels in t h e remaining nodes of X a n d Y are initially white, then t h e propagation algorithm for t h e component

of t h e binary image t h a t contains t h e single seed pixel is given by

3 A D J A C E N C Y G R A P H C O N S T R U C T I O N

3 1 S T A T E M E N T O F T H E P R O B L E M

This section is concerned with t h e spatial relationships among regions in a symbolic (1?K^^' 1) image We assume t h a t some kind of segmentation process has already assigned

t o ^ pixel of t h e image a symbolic label t h a t represents t h e n a m e or category of t h e

pixel I ' h u s we are starting with a symbolic image T h e goal is t o determine t h e spatial

adjacencies among t h e connected regions t h a t have different labels and construct a graph,

t h e region adjacency graphs representing these spatial adjacencies T h e graph m a y t h e n b e

used in higher-level recognition/analysis algorithms Figure 12 shows a simple symbolic image representing a segmentation and t h e corresponding region adjacency graph

3 2 A S P A C E - E F F I C I E N T A L G O R I T H M

T h e algorithm for constructing a region adjacency graph is straightforward It processes

t h e image, looking at t h e current row and t h e one above it It detects horizontal and vertical adjacencies (and if 8-adjacency is specified, diagonal adjacencies) between pixels with different labels As new adjacencies are detected, new edges are added t o t h e region adjacency graph d a t a structure being constructed

T h e r e are two issues related to t h e efficiency of this algorithm T h e first involves space

It is possible for an image t o have tens of thousands of labels In this case, it m a y not b e feasible, or at least not appropriate in a paging environment, t o keep t h e entire s t r u c t u r e

in internal m e m o r y at once T h e second issue involves execution time W h e n scanning

an image, pixel by pixel, t h e same adjacency (i.e t h e adjacency of t h e same two region labels) will b e detected over and over again It is desirable t o enter each adjacency into

t h e d a t a s t r u c t u r e as few times as possible

Trang 27

Our algorithm addresses the first problem by implementing the graph data structure as

a hash table in which the hash key is a function of the region label Each entry indicates the label of its region, the number of adjacent regions, and the list of adjacent regions The list is a dynamically allocated linked list of single-size cells that can be freed when the algorithm has finished processing that region in the image and the list is written out to secondary storage The second problem can be addressed by the coding of the algorithm The adjacency detectors process pixels along one or two rows of the image at a time and keep track of current and previous labels Only when a new, different label is detected is

a new adjacency added to the graph structure Figure 13 illustrates the region adjacency graph (RAG) data structure for the graph of Figure 12b

The algorithm consists of the basic control mechanism, the adjacency detectors, and the utilities for detecting when regions and their adjacency lists can be written to secondary storage and their internal memory freed The adjacency detectors are given separately for readability, but can be combined for efficiency The following pseudocode defines the algorithm

Trang 28

new vale := I(L,P);

if (newvalp < > newvalc) and

(newvalp < > oldvalp or newvalc < > oldvalc)

Trang 29

curval := unused Jabel;

"Mark labels of pixels that appear on the current row."

"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)

t h e n begin OUTLIST(R,RAG); FREELIST(R,RAG) end else UNMARK(R)

Trang 30

T h e algorithm makes one pass over t h e image Whenever it detects an adjacency t h a t

is different from t h e most recently detected one, it a t t e m p t s to add t h e new adjacency

to t h e graph s t r u c t u r e This involves hashing to t h e entry for a region and adding t h e adjacency to an ordered, linked list, if it is not already present While t h e theoretical worst case complexity is O(n^) for an n x n image, for practical purposes, t h e algorithm executes in (9(n^) t i m e , since most regions have a small n u m b e r of neighboring regions

T h e required size of t h e hash table in memory is dependent on t h e m a x i m u m n u m b e r of

regions t h a t can be active at once, which is bounded by n, t h e n u m b e r of pixels in a row

of t h e image

4 S O M E A P P L I C A T I O N S

T h e connected components operator is a very basic operator t h a t is used in m a n y ent applications It was a part of t h e so-called "SRI Vision Module", a package developed

differ-at SRI Interndiffer-ational for analysis of binary images (Agin, 1980) T h e module consists of

thresholding, connected component labeling, property computation, and statistical tern recognition Variants of this sequence can be used for such diverse tasks as character recognition, where t h e components are characters or pieces of characters; surface-mounted device board inspection, where t h e components are t h e devices; and surface inspection, where t h e components are holes in or scratches on the surface

pat-Character recognition is a major field in its own right While printed characters in dard fonts are now recognized by commercial machines, handprinted character recognition

stan-is not yet as reliable, and h a n d w r i t t e n character recognition stan-is still a research problem A major problem with h a n d w r i t t e n character recognition and, to some extent, h a n d p r i n t e d character recognition is t h e segmentation of words into letters T h e connected components (extracted after a sequence of image processing operations, ending with a thresholding operation) m a y represent parts of characters, whole characters, or groups of characters Another major application area where connected component algorithms are i m p o r t a n t

is medical imaging W h e n a C T scan has been segmented into components ing organs and their surrounding bone and tissue, it may be necessary to use b o t h t h e properties of t h e components themselves and the properties of their neighboring regions

represent-to identify t h e organs Thus both the connected components operarepresent-tor and t h e region adjacency graph algorithm are useful Blob detection and recognition are also i m p o r t a n t

in military applications such as target detection and aerial image analysis

T h e concepts described in this chapter are also useful in more advanced areas of

com-p u t e r vision For examcom-ple, in motion detection, we may first detect comcom-ponents in a sequence of images and then determine their correspondences from one image to t h e next

to determine t h e motions of t h e objects in t h e scene Similarly, there are stereo algorithms

t h a t use component matching Thus connected components and their analysis are of very wide interest to t h e computer vision community

Trang 31

R E F E R E N C E S

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,

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 puting Machinery, Vol 17, 1970, pp 146-160

Com-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

Trang 32

T.Y Kong and A Rosenfeld (Editors)

© 1996 Elsevier Science B.V All rights reserved 27

Appendix: A Generalization of Lumia's Algorithm and a Proof of

Its Correctness

T Yung Kong Azriel Rosenfeld

This appendix gives a generalization of the "local table" methods of connected

compo-nent labeling described in Sections 2.3 - 2.5, and proves t h a t such methods work

1 R e l a t i v e C o m p o n e n t L a b e l i n g

A labeling of a set 5* is a function i with domain S] for every 5 G 5 , we call £{s) t h e

i-label of s Each element of {i{s) \ s ^ S} is called a label used by £

Let X and Y be disjoint sets of nodes of a graph G, and let ^ be a labeling of X We

say t h a t two nodes y i , ^2 € Y are adjacent relative to i in G if yi ^ ?/2 and at least one of

t h e following is true:

• yi and ?/2 are adjacent in G

• T h e r e exist (not necessarily distinct) nodes Xi, a;2 G -\^ with equal ^-labels, such t h a t

yi is adjacent to Xi and ?/2 is adjacent to X2 in G

T h e reflexive transitive closure of adjacency relative to ^ in G is an equivalence relation

on Y; each of t h e associated equivalence classes will be called a component ofY relative

to i in G Note t h a t ii X = 0, so t h a t i is the "empty labeling", t h e n nodes in Y are

adjacent relative to ^ in G if and only if they are adjacent in G, and a component of Y

relative to ^ in G is just t h e set of nodes of a component of t h e subgraph of G induced

by Y More generally, if i is any labeling of X such t h a t nodes with t h e same ^-label

always lie in t h e same component of G, then nodes of Y t h a t are adjacent relative to £ in

G always lie in t h e same component of G, which implies t h a t nodes of Y which lie in t h e

same component of Y relative to ^ in G lie in the same component of G

A component labeling of Y relative to £ in G is ei labeling £' of Y t h a t satisfies b o t h of

t h e following conditions:

• Two nodes of Y have t h e same ^'-label if and only if they belong t o t h e same

component of Y relative to £ in G

• If / is any label t h a t is used both by £' and by ^, then there are nodes x G X and

y £Y t h a t are adjacent in G such t h a t £{x) = £'{y) = L

T h e following l e m m a follows from t h e first of these two conditions, and t h e observation

at t h e end of t h e previous paragraph

L E M M A 1 Let X and Y be disjoint sets of nodes of a graph G Let £ be any labeling of

X such that nodes with the same £-label always lie in the same component of G, and let

£' be a component labeling ofY relative to £ in G Then nodes ofY with the same £'-label

always lie in the same component of G

Trang 33

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

Trang 34

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 t h a t yi is adjacent to xi and y2 is adjacent to X2

T h e possibility of performing pass 2 depends on t h e validity of this assumption for each

row Ri when rule R is about to be applied to t h a t row, and will be established in t h e

third paragraph of t h e 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 t h a t if two nodes in Ri^i have equal labels before application of rule R t o 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 t h e nodes are labeled at the end of pass 1 At this t i m e two nodes

in Ri have t h e same label if and only if they lie in t h e same component of Ri relative to

t h e labeling of Ri-i We first deduce from this t h a t the following conditions hold at t h e

end of pass 1:

1 W i t h i n each row, two nodes have equal labels if they are adjacent in G

2 W i t h i n each row Ri where z > 1, two nodes yi and ?/2 have equal labels if t h e r e exist two (not necessarily distinct) nodes 0:1,0:2 G Ri-i with equal labels such t h a t yi is adjacent to xi and ?/2 is adjacent to X2 in G

3 Equally labeled nodes always belong to t h e same component of G

Conditions 1 and 2 hold, since they are together equivalent to t h e condition t h a t two

nodes of Ri have equal labels if they are adjacent relative t o t h e labeling of Ri-i Equally labeled nodes in t h e row Ri must he in the same component of G (e.g., by L e m m a 1, whose hypotheses are satisfied when X = RQ = (/}, Y = Ri, £ is t h e e m p t y labeling ^o, and

£' = ii) Based on this, we see by induction on i (using L e m m a 1 with X = Ri-i, Y = Ri,

i ~ ii-i, and i' = ii) t h a t , for each row Ri, equally labeled nodes in Ri must lie in t h e same component of G It follows from this and t h e second condition in t h e definition of a component labeling relative to i t h a t two equally labeled nodes in consecutive rows also must lie in t h e same component of G T h e same is true of two equally labeled nodes in different, nonconsecutive, rows Ri and Rj, for if such nodes exist t h e n there must exist a node with t h e same label in each of t h e 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 t h e preceding row or a new label t h a t is not used in any previous row.) Hence condition 3 holds at t h e end of pass 1 Next, we verify t h a t it is always possible to perform pass 2 after pass 1 As we observed above (just after t h e s t a t e m e n t of pass 2) we need to show t h a t 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 t h a t application of rule R t o a row Rj

in pass 2 preserves t h e validity of condition 2 for t h e rows i?i, 2 < i — 1, which are t h e

rows to which rule R will subsequently be applied Application of rule R to Rj cannot affect t h e validity of condition 2 for the rows Ri^ i < j — 2, since no labels in these rows are changed Application of rule R t o Rj also preserves t h e validity of condition 2 for t h e row Ri, i = j — 1, since no labels in Rj-2 are changed and nodes in Rj-i t h a t have equal

Trang 35

labels before must have equal labels afterwards This confirms t h a t 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 t h e nodes in Ri-i with t h e same label as x^ which are given ?/'s label,

m u s t belong t o t h e same component as x (by condition 3), and must therefore belong to

t h e same component as y and all other nodes with t/'s label Thus conditions 1 and 3 still

hold at t h e end of pass 2

Consider t h e labels of any two adjacent nodes at the end of pass 2 One of t h e following

Each of t h e algorithms presented in Sections 2.3, 2.4 and 2.5 labels t h e I's of a 2-d or 3-d binary image array in a way t h a t is an instance of pass 1 above It t h e n performs a

b o t t o m - u p pass whose effect on the labels is the same as t h a t of pass 2 Note t h a t in t h e algorithm of Section 2.3, the following condition is satisfied at t h e start of t h e b o t t o m - u p pass:

• For 1 < z < n, whenever y G Ri is adjacent to x € Ri-i-, ^'s label is less t h a n or

equal t o ar's label

A consequence of this is t h a t in rule R , during pass 2, ?/'s label would always be t h e

m i n i m u m of t h e labels of x and y

Trang 36

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^

" D e p a r t m e n t of Electrical Engineering, University of P i t t s b u r g h , P i t t s b u r g h , PA 15261

^ D e p a r t m e n t of C o m p u t e r Science, Queens College, City University of New York,

Flushing, NY 11367

*^Center for A u t o m a t i o n Research, University of Maryland, College P a r k , M D 20742

A b s t r a c t

T h e general problem of shrinking binary images is addressed with emphasis on t h e

problem of shrinking t o a residue Past work in this area is reviewed, fundamental limits

are discussed and open questions are identified Emphasis is given t o techniques which

can b e used t o verify correct performance of shrinking algorithms, including successful

algorithm t e r m i n a t i o n and connectivity preservation New connectivity preservation tests

are developed for parallel 2D reductive-augmentative algorithms and t h e application of

these tests is d e m o n s t r a t e d for a variety of shrinking algorithms A new 2D completely

parallel single-operator shrinking algorithm is developed using connectivity preservation

requirements t o guide t h e design process Issues in 3D shrinking are also reviewed

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

T h e "shrinking" of binary images t o similarly connected representations t h a t have

smaller foregrounds (i.e., fewer Ts) has found application as a fundamental preprocessing

step in image processing T w o forms of such shrinking have been of greatest interest:

(1) T h e image is transformed t o a "topologically equivalent" image t h a t has fewer I's;

(2) connected components of t h e I's are shrunk t o isolated single-pixel residues (which

m a y t h e n be deleted) Figure 1 illustrates these two kinds of processes

Figure l a is an example of shrinking to a topological equivalent; it illustrates t h e effect of

a typical thinning algorithm T h e result is a t h i n closed curve of I's along t h e a p p r o x i m a t e

midline of t h e set of I's in t h e input image In Figures l b , d, and e, which are also

examples of shrinking t o a topological equivalent, t h e input images are transformed t o

smallest topological equivalents (i.e., topological equivalents having t h e smallest n u m b e r s

of I ' s ) In this case t h e resulting set of I's need not (and in Figure l b cannot) b e contained

in t h e original set of I ' s Shrinking t o a topological equivalent will be briefly discussed in

Section 2.6 T h e 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, t h e m a i n subject of this chapter is shrinking to a residue, in which every

simply-connected component of t h e I's (and possibly every component of t h e I's) of t h e

input image is transformed t o an isolated single-pixel residue, which again m a y or m a y

not belong t o t h e original set of I ' s This is illustrated in Figures I c - e Residues m a y be

Trang 37

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 C O N C E P T S , TERMINOLOGY A N D 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

Trang 38

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

Trang 39

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

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)] + b i 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^ ;this

c) 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

Trang 40

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 O i and O2 to be the same operator if they have the same support and O i 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

Ngày đăng: 05/06/2014, 11:59

TỪ KHÓA LIÊN QUAN