Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with...

13
Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses Yi Pan a, * , Keqin Li b a Computer Science Department, University of Dayton, Dayton, OH 45469-2160, USA b Department of Mathematics and Computer Science, State University of New York, New Paltz, New York, NY 12561-2499, USA Received 1 September 1998; received in revised form 16 February 1999; accepted 29 April 1999 Abstract The computation of Euclidean distance maps (EDM), also called Euclidean distance transform, is a basic operation in computer vision, pattern recognition, and robotics. Fast computation of the EDM is needed since most of the applications using the EDM require real-time computation. It is shown in L. Chen and H.Y.H. Chuang [Information Processing Letters, 51, pp. 25–29 (1994)] that a lower bound Xn 2 is required for any sequential EDM algorithm due to the fact that in any EDM algorithm each of the n 2 pixels has to be scanned at least once. Recently, many parallel EDM algorithms have been proposed to speedup its computation. Chen and Chuang proposed an algorithm for computing the EDM on an n n mesh in On time [L. Chen and H.Y.H. Chuang Parallel Computing, 21, pp. 841–852 (1995)]. Clearly, the VLSI complexities of both the sequential and the mesh algorithm described in L. Chen and H.Y.H. Chuang [Parallel Computing, 21, pp. 841–852 (1995)] are AT 2 On 4 , where A is the VLSI layout area of the design and T is the computation time using area A when implemented in VLSI. In this paper, we propose a new and faster parallel algorithm for computing the EDM problem on the reconfigurable VLSI mesh model. For the same problem, our algorithm runs in O1 time on a two-dimensional n 2 n 2 reconfigurable mesh. We show that the VLSI complexity of our algorithm is the same as those of the above sequential algorithm Information Sciences 120 (1999) 209–221 www.elsevier.com/locate/ins * Corresponding author. E-mail address: [email protected], [email protected] (Y. Pan) 0020-0255/99/$ - see front matter Ó 1999 Elsevier Science Inc. All rights reserved. PII: S 0 0 2 0 - 0 2 5 5 ( 9 9 ) 0 0 0 8 4 - 5

Transcript of Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with...

Page 1: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

Constant-time algorithm for computing theEuclidean distance maps of binary images on

2D meshes with recon®gurable buses

Yi Pan a,*, Keqin Li b

a Computer Science Department, University of Dayton, Dayton, OH 45469-2160, USAb Department of Mathematics and Computer Science, State University of New York, New Paltz,

New York, NY 12561-2499, USA

Received 1 September 1998; received in revised form 16 February 1999; accepted 29 April 1999

Abstract

The computation of Euclidean distance maps (EDM), also called Euclidean distance

transform, is a basic operation in computer vision, pattern recognition, and robotics.

Fast computation of the EDM is needed since most of the applications using the EDM

require real-time computation. It is shown in L. Chen and H.Y.H. Chuang [Information

Processing Letters, 51, pp. 25±29 (1994)] that a lower bound X�n2� is required for any

sequential EDM algorithm due to the fact that in any EDM algorithm each of the n2

pixels has to be scanned at least once. Recently, many parallel EDM algorithms have

been proposed to speedup its computation. Chen and Chuang proposed an algorithm

for computing the EDM on an n� n mesh in O�n� time [L. Chen and H.Y.H. Chuang

Parallel Computing, 21, pp. 841±852 (1995)]. Clearly, the VLSI complexities of both the

sequential and the mesh algorithm described in L. Chen and H.Y.H. Chuang [Parallel

Computing, 21, pp. 841±852 (1995)] are AT 2 � O�n4�, where A is the VLSI layout area

of the design and T is the computation time using area A when implemented in VLSI. In

this paper, we propose a new and faster parallel algorithm for computing the EDM

problem on the recon®gurable VLSI mesh model. For the same problem, our algorithm

runs in O�1� time on a two-dimensional n2 � n2 recon®gurable mesh. We show that the

VLSI complexity of our algorithm is the same as those of the above sequential algorithm

Information Sciences 120 (1999) 209±221www.elsevier.com/locate/ins

* Corresponding author.

E-mail address: [email protected], [email protected] (Y. Pan)

0020-0255/99/$ - see front matter Ó 1999 Elsevier Science Inc. All rights reserved.

PII: S 0 0 2 0 - 0 2 5 5 ( 9 9 ) 0 0 0 8 4 - 5

Page 2: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

and the mesh algorithm, while it uses much less time. To our best knowledge, this is the

®rst constant-time EDM algorithm on any parallel computational model. Ó 1999

Elsevier Science Inc. All rights reserved.

Keywords: Euclidean distance maps; Image analysis; Recon®gurable mesh; VLSI

1. Introduction

The computation of distance maps (DM) of a binary image, also calledEuclidean distance transform, converts a binary image of black and whitepixels into a new image where each pixel has a value equal to the distance to thenearest black pixel. Basically, there are two categories of DM depending on thetype of metric used: Euclidean distance maps (EDM) and non-Euclidean dis-tance maps (NDM). Most of the NDM algorithms are based on the city block(CB) distance or the chamfer 3±4 distance [3] which are both approximations ofthe Euclidean distance. Although NDM algorithms are normally simpler, theEDM has a wider range of applications. Euclidean distance metric is consid-ered superior to other distance metrics due to its many desired properties inapplications. For example, one of the desired properties is that Euclideandistance transform is rotation invariant [6]. On the other hand, Euclideandistance transform is time consuming and requires parallel computation tospeedup. Euclidean distance transform is also a basic operation in computervision, pattern recognition, and robotics [4,14]. For instance, if the black pixelsrepresent obstacles, then the Euclidean distance from the set of all black pixelsin an image tells us how far the point �i; j� is from these obstacles. This in-formation is useful when one tries to move a robot in the free space (whitepixels of the image) and to keep it away from the obstacles (black pixels).

Consider a black and white n� n binary image: i.e., a two-dimensional arraywhere aij � 0 or 1, for i; j � 0; 1; 2; nÿ 1. The index i stands for the row andthe index j for column. Pixel (0, 0) is the upper left point in the image. TheEDM is to ®nd for each point �i; j� its Euclidean distance from the set of allblack pixels B � f�i; j� : aij � 1g. In other words, we compute the array

dij � min�x;y�2B

f��iÿ x�2 � �jÿ y�2�1=2g; 06 i; j6 nÿ 1: �1�

Many sequential and parallel algorithms have been proposed for computingthe EDM [1±3,5±7,9,15]. Yamada [16] presented an EDM algorithm that runsin O�n� time using n2 processors on an eight-neighbor connected mesh. Ko-lountzakis and Kutulakos [8] presented an O�n2 log n� sequential algorithm forthe EDM problem. They also showed that the time complexity of their algo-rithm is O��n2 logn�=r� on an EREW PRAM model with r6 n processors.Chen and Chuang improved the algorithm in [3] by reducing the time

210 Y. Pan, K. Li / Information Sciences 120 (1999) 209±221

Page 3: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

complexity to O�n2=r � n log r� on an EREW PRAM model. Lee et al. [9]studied this problem on mesh of trees and the hypercube computers. Boss-omaier et al. [1] studied the speedup and e�ciency of YamadaÕs algorithm onthe CM-2 connection machine, and introduced new techniques to improve itsperformance. More recently, Chen and Chuang [3] proposed an algorithm forcomputing the EDM on a mesh-connected SIMD computer. For an n� nimage, their algorithm runs in O�n� time on a two-dimensional n� n torus-connected processor mesh. The best algorithm reported in the literature re-quires O� logn� time on either a mesh of trees or a hypercube [9].

In this paper, we propose a constant-time parallel algorithm for computingthe Euclidean distance maps on recon®gurable meshes. Our algorithm reducesthe time complexity signi®cantly and to our best knowledge, it is the ®rstconstant-time EDM algorithm on any parallel computer model. The algorithmis especially useful when real-time computation of the EDM is needed.Moreover, the VLSI complexity of our algorithm is the same as those of thesequential algorithm in [2] and the mesh algorithm in [3]. This paper is or-ganized as follows. We ®rst present the computation model used. Since ourparallel algorithm is based on the sequential EDM algorithm proposed byChen and Chuang [3], we describe the sequential algorithm in Section 3. Ournew parallel algorithm is presented in Section 4. Finally, we conclude thispaper in Section 5.

2. The recon®gurable mesh model

A recon®gurable mesh consists of a bus in the shape of a mesh whichconnects a set of processors, but which can be split dynamically by localswitches at each processor. By setting these switches, the processors partitionthe bus into a number of subbusses through which the processors can thencommunicate. Thus the communication pattern between processors is ¯exible,and moreover, it can be adjusted during the execution of an algorithm.

The recon®gurable mesh has begun to receive a great deal of attention asboth a practical machine to build, and a good theoretical model of parallelcomputation. On the practical side, recon®gurable mesh have been constructedfor use in vision and VLSI applications [10]. On the theoretical side, the re-con®gurable mesh has been shown to be able to solve some fundamentaltheoretical problems very quickly. In fact, the recon®gurable mesh can solvesome problems faster than the PRAM, the model most often used for theo-retical parallel computation. For instance, an N processor recon®gurable meshcan ®nd the parity of N bits in constant time [11,13], while an N processorPRAM requires X� log N= log log N� time.

A two-dimensional recon®gurable mesh consists of an N1 � N2 array ofprocessors which are connected to a grid-shaped recon®gurable bus system.

Y. Pan, K. Li / Information Sciences 120 (1999) 209±221 211

Page 4: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

Each processor can perform arithmetic and logical operations and is identi®edby a unique index �i; j�; 06 i < N1; 06 j < N2. The processor with index (i; j�is denoted by PE�i; j�. We assume that each arithmetic operation requires onetime unit. The con®guration of the bus system is dynamically changeable byadjusting the local connection among ports within each processor. Only oneprocessor is allowed to broadcast a value within the same subbus. Each pro-cessor can communicate with other processors by broadcasting values on thebus system. We assume that each broadcasting requires one time unit. In Fig. 1,we depict a 4� 4 recon®gurable mesh. The four ports are called south (S),north (N), west (W) and east (E), respectively.

A subarray is denoted by replacing certain indices by *'s. For example, theith row of processors in a two-dimensional recon®gurable mesh is representedby ARR�i; ��. Similarly, ARR��; j�; 06 j < N2, is the jth column of proces-sors. These N2 subarrays (columns) can execute algorithms independently andconcurrently. Finally, a memory location L in PE�i; j� is denoted as L�i; j�.

The complexity of parallel computation on VLSI has been measured interms of AT 2 product, where A is the VLSI layout area of the design and T isthe computation time using area A. For a two-dimensional n� n recon®gur-able array, the VLSI layout area has been shown to be the same as a plain two-dimensional mesh of the same size. Thus, a recon®gurable mesh can be im-plemented in VLSI very e�ciently.

3. Sequential algorithms

Many sequential algorithms exist for computing the EDM. Since our par-allel algorithms are mainly based on the sequential algorithm proposed by

Fig. 1. A two-dimensional 4� 4 recon®gurable mesh.

212 Y. Pan, K. Li / Information Sciences 120 (1999) 209±221

Page 5: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

Chen and Chuang [3], their algorithm is described in detail here. Their algo-rithm uses three two-dimensional data arrays p�i; j�; q�i; j�, and m�i; j�,06 i; j; k6 nÿ 1. p�i; k� is used to store the indices (x±y coordinates) of thehighest black pixel in the kth column on or below the ith row of the image, andq�i; k� is used to store those of the lowest black pixel in the kth column abovethe ith row of the image. p�i; k� and q�i; k� are initialized to �1;1�. Initialvalues in array m are assigned as follows: if the pixel on the ith row and jthcolumn is a black pixel, the m�i; j� � 0; otherwise m�i; j� � 1. Their algorithmconsists of two major parts. Part 1 computes data arrays p and q, and part 2computes array m�i; j� by ®nding the minimum values among m, p and q in thesame row. When the algorithm terminates, m�i; j� stores the distance from �i; j�to the nearest black pixel in the image. For each pixel at (i; k�, p�i; k� recordsthe indices of the ®rst black pixel encountered when the kth column of array mis scanned from the ith row down to the ®rst row. Similarly, q�i; k� records theindices of the last black pixel encountered when the kth column of array m isscanned from the nth row down to the �i� 1�th row. At the end of part 1,p�i; k� and q�i; k� store the indices of the closest black pixels on the kth columnbelow and above row i, respectively. In part 2, each m�i; j� is replacedby the smallest of the following values: its initial value, D�p�i; k�; �i; j��,and D�q�i; k�; �i; j��, where k � 0; 1; 2; . . . nÿ 1 and D��x1; x2�; �y1; y2�� ���x1 ÿ y1�2 ��x2 ÿ y2��1=2

is the distance between index points �x1; x2� and�y1; y2�. By using arrays p and q, they avoid computing and comparing dis-tances of point �i; j� to all black pixels in the image since p�i; k� and q�i; k� storethe indices of the closest black pixels in column k on both sides of the pixel at�i; k�. In this way, they reduce the time used in the algorithm. In our algorithm,we use a similar idea to speed up the computation.

4. Parallel algorithm

The array used in our presentation is a two-dimensional n2 � n2 re-con®gurable mesh. The processor with index �i; j� is denoted by PE�i; j�, where06 i; j < n2. The whole mesh is logically divided into n rows and n columnswith equal sizes. Hence, there are n� n subarrays each of which is of size n� n.These subarrays are denoted as ARR�k; l�, where 06 k; l < n. A row of nsubarrays of size n� n is denoted as ARR�k; ��, 06 k < n. Similarly, a columnof n subarrays of size n� n is denoted as ARR��; l�, where 06 l < n. ProcessorPE�i; j� can also be described using the row and column indices in a subarrayand the row and column indices of the subarray in the whole array. If wedenote PE�k; l��s; t�, for 06 k; l; s; t < n, as the processor with row index s andcolumn index t in the subarray ARR�k; l�, then PE�i; j� � PE�k; l��s; t� i�i � n � k � s and j � n � l� t. Fig. 2 is a 16� 16 two-dimensional array di-vided into 16 subarrays of size 4� 4. As shown in the ®gure, PE�5; 9� using

Y. Pan, K. Li / Information Sciences 120 (1999) 209±221 213

Page 6: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

global indices can also be denoted as PE�1; 2��1; 1�. Clearly, the processor is insubarray ARR�1; 2� and the indices in the subarray is (1,1). We will use bothnotations interchangeably during the discussion of our algorithm whenever wefeel they are appropriate.

Our algorithm for computing the EDM is based on the sequential algorithmproposed by Chen and Chuang [3] and described in the preceding section. Thealgorithm consists of several steps and is formally described below.

4.1. The EDM algorithm

Assume that initially each pixel aij is stored in the lowest row of processorsin a column major order; i.e., in PE�0; j�, for 06 j < n2. In other words,a�0; l��0; t� � at;l; 06 l; t < n. Fig. 3 is a 4� 4 image and its initial con®gura-tion in the 16� 16 mesh is shown in Fig. 2.

Step 1. Broadcast the n2 pixels via column buses such thatPE�l; l�; 06 l < n2 contains the pixel aij, where l � n � i� j. Fig. 4 is the datadistribution after step 1 assuming we have an initial con®guration of Fig. 2.

Step 2. Broadcast the n2 pixels via row buses such that PE�l; k� receives thepixel from PE�l; l�. PE�l; k��s; t�, where l � t, contains pixel ast. Clearly,processors of column 0 in subarrays ARR�0; k� contain pixel column 0 in theoriginal image. Processors of column 1 in subarrays ARR�1; k� contain pixel

Fig. 2. Two processor index schemes.

214 Y. Pan, K. Li / Information Sciences 120 (1999) 209±221

Page 7: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

column 1 in the original image. In general, processors of column i in sub-arrays ARR�i; k� contain pixel column i in the original image, as shown inFig. 5.

Step 3. In this step, we calculate the index values for each q�i; j� on subarray�j; i�. Since a point �i; j� and its p�i; j� are always in the same column and thushave the same column index, we need to calculate the row index of the closestblack pixel in the jth column on or above the ith row in the original image. Inthe following, this value is recorded in location UP_NEAREST. Similarly, apoint �i; j� and its p�i; j� are always in the same column and thus have the samecolumn index, we need to calculate the row index of the closest black pixel inthe jth column on or below the ith row in the original image. This index isrecorded in location DOWN_NEAREST in the algorithm.

Fig. 4. Diagonal processors get image pixels via column broadcast.

Fig. 3. A 4� 4 image.

Y. Pan, K. Li / Information Sciences 120 (1999) 209±221 215

Page 8: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

We ®rst partition the whole array into n� n subarrays each of size n� n. Allsubarrays perform the following concurrently. Initially, UP NEAREST �k; l��i; j� � i if its local pixel value a�k; l��i; j� � 1. Otherwise, UP NEAREST �k; l��i; j� � 1. Only processor PE�k; l��i; j� for k � j in a subarray performs thefollowing. Other processors are in idle state during this step. PE�k; l��i; j� es-tablishes the local connection fN ; Sg if its pixel value a�k; l��i; j� � 0, for06 i; j6 nÿ 1. PE�k; l��i; j� broadcasts its row index i to port S if its pixel valuea�k; l��i; j� � 1, for 06 i; j6 nÿ 1. If PE�k; l��i; j� receives an index i0 from portN, stores this index in a local memory; i.e., UP NEAREST �k; l��i; j� � i0. Fig. 6 isthe bus con®guration for the image shown in Fig. 3. Basically, a processorhaving a white pixel connects its column bus and a processor having a blackpixel disconnects its column bus so that its own row index is broadcast down tothe processors in the same column. Fig. 6 also shows that only processors witha black pixel broadcast their row indices. For example, in column 0 of subarrayARR�0; l�, only PE�0; l��0; 0� and PE�0; l��2; 0� broadcast their row indices 0 and2, respectively on the column bus. Because PE�0; l��2; 0� disconnects its column,PE�0; l��3; 0� receives a value of 2 from its column bus. Fig. 7 gives theUP NEAREST values after the broadcast operation. Notice that the processorsin the ®rst row or the processors which do not have a ``1'' above them in thesame column never receive any value from the column bus. Hence, theirUP NEAREST values are either 1 or their initial row indices. Also notice thatprocessors with a black pixel never receives any value from the column buses

Fig. 5. Pixel values after row broadcast.

216 Y. Pan, K. Li / Information Sciences 120 (1999) 209±221

Page 9: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

Fig. 7. UP NEAREST values after column broadcast.

Fig. 6. Bus con®guration for computing UP NEAREST .

Y. Pan, K. Li / Information Sciences 120 (1999) 209±221 217

Page 10: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

and their UP NEAREST values are their initial row indices. For example,UP NEAREST �1; l��1; 1� � 1, UP NEAREST �2; l��1; 2� � 1 and UP NEAREST�3; l��3; 3� � 3. On the other hand, UP NEAREST �1; l��0; 1� � 1.

Step 4. In this step, we calculate the index values for p�i; j�. Using the sameargument, it is enough to calculate the row index of the closest black pixel inthe kth column on or below the ith row in the original image. Initially,DOWN NEAREST �k; l��i; j� � i if its local pixel value a�k; l��i; j� � 1. Otherwise,DOWN NEAREST �k; l��i; j� � 1. Only PE�k; l��i; j� for k � j performs the fol-lowing. Other processors are in idle state during this step. PE�k; l��i; j� estab-lishes the local connection fN ; Sg if its pixel value a�k; l��i; j� � 0, for06 i; j6 nÿ 1. PE�k; l��i; j� broadcasts its row index i to port N if its pixel valuea�k; l��i; j� � 1, for 06 i; j6 nÿ 1. If PE�k; l��i; j� receives a row index i00 fromport S, stores this index in its local location DOWN NEAREST �k; l��i; j� � i00.Clearly, a processor in the last row, or a processor with a white pixel but noprocessor with a black pixel below it in the same column, or a processor with ablack pixel never receives any value from the column bus. Hence, theirDOWN NEAREST values are either1 or their initial row indices after this step.

Step 5. Broadcast the calculated values UP NEAREST �k; l��l; j� andDOWN NEAREST �k; l��l; j� via column buses so that every processor in rowl of the ®rst row of subarrays, ARR�0; l�, receives them. That is,UP NEAREST �0; l��l; j� � UP NEAREST �k; l��l; j� and DOWN NEAREST �k; l��0; j� � DOWN NEAREST �k; l��l; j�. Fig. 8 shows this data movement operationfor UP NEAREST values calculated in Fig. 7.

Step 6. Broadcast the values received in the last step to all processors in row0 of every subarray via column buses. That is, UP NEAREST �k; l��0; j��UP NEAREST �0; l��l; j� and DOWN NEAREST �k; l��0; j� � DOWN NEAREST�0; l��l; j�. Fig. 9 shows the result after this step. The numbers in the darkrectangles are the sources of the broadcast.

After this step, row 0 in subarray ARR�i; 0� contains q�0; j� and p�0; j� sinceq�0; j� � �UP NEAREST �k; 0��0; j�; j� and p�0; j� � �DOWN NEAREST �k; 0��0; j�; j�. Similarly, row 0 in subarray ARR�i; 1� contains q�1; j� and p�1; j�. Ingeneral, row 0 in subarray ARR�i; k� contains q�k; j� and p�k; j�. These valuesare used to calculate the EDM values in the next step. By employing the valuesof UP NEAREST and DOWN NEAREST , we avoid the need of computing andcomparing distances between a point and all black pixels in the original image,thus speed up the computation.

Step 7. Calculate the EDM values for all the points in the image. We usesubarray ARR�i; j�; 06 i; j < n; to calculate EDM values at point �j; i� in theoriginal image. The EDM values are calculated concurrently in each subarray.Assume that UP NEAREST �k; l��0; j� � i0 and DOWN NEAREST �k; l��0; j� � i00.In the following, UP DIST �i; j� is a memory location storing the distance be-tween point q�i; k� and point �i; j� and DOWN DIST �i; j� is a memory locationstoring the distance between point p�i; k� and point �i; j�. Since ARR�k; l� is

218 Y. Pan, K. Li / Information Sciences 120 (1999) 209±221

Page 11: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

Fig. 9. Data movement in Step 6.

Fig. 8. Data movement in Step 5.

Y. Pan, K. Li / Information Sciences 120 (1999) 209±221 219

Page 12: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

responsible for computing the EDM value at point �l; k� in the original image,l and k are the row and column indices in the original image. Hence,PE�k; l��0; j� can calculate DOWN DIST �k; l��0; j� � ��i0 ÿ l�2 � �jÿ k��1=2

andUP DIST �k; l��0; j� � ��i00 ÿ l�2 � �jÿ k��1=2

. Then, PE�k; l��0; j� comparesDOWN DIST �k; l��0; j� and UP DIST �k; l��0; j�, and put the smaller inDIST �k; l��0; j�. Finally, use the subarray ARR�k; l� of n � n processors to ®ndthe minimum of the n distances DIST �k; l��0; j�; 06 j6 nÿ 1.

The minimum of n numbers stored in the ®rst row in a two-dimensional n� nrecon®gurable mesh can be computed in O�1� time [12]. This can be done asfollows. Denote the n values as xi; 06 i6 nÿ 1. First, column broadcast can beused so that every processor PE�i; j� contains xj. Next, a row broadcast is usedwithin every row i so that processor PE�i; i� informs all processors as to thevalue of xi. At this point, every processor PE�i; j� contains data values xi and xj

and compares these two values. Now, all processors in column j use a logical ORto decide whether xj is the minimum and the result is stored in the top processorof column j. Finally, this value is broadcast to all processors in the array. Ifmore than one processors having the minimum value, it is still possible toperform the broadcast in O�1� time [12]. Thus, this step can be ®nished in O�1�.

At the end of the algorithm, the EDM result is in EDM�k; l��0; 0� �EDM�l; k� for 06 k; l6 nÿ 1. Since each step in the algorithm uses O�1� time,the total time used in the algorithm is also O�1�.

5. Conclusions

In this paper, we propose an O�1� time parallel algorithm for computing theEuclidean distance maps on the recon®gurable mesh model. The previous besttime complexity on a two-dimensional VLSI mesh is O�n� for an n� n image[3]. Our algorithm reduces the time complexity from O�n� to O�1� by addingsome switches in the mesh and using a larger array. Since a recon®gurablemesh and a plain mesh use the same VLSI area, the VLSI area used to im-plement a two-dimensional n2 � n2 recon®gurable array is O�n4�. Clearly, theVLSI complexities of both the sequential algorithm described in [2] and themesh algorithm reported in [3] are AT 2 � O�n4�. Thus, the VLSI complexity ofour algorithm is the same as those of the above sequential algorithm and themesh algorithm, while our algorithm reduces the time dramatically. It would beinteresting to see if we could reduce the number of processors used and stillachieve a constant time complexity.

Acknowledgements

Yi Pan's research was supported in part by the National Science Foundationunder Grants CCR-9211621, OSR-9350540 and CCR-9503882, by the Air

220 Y. Pan, K. Li / Information Sciences 120 (1999) 209±221

Page 13: Constant-time algorithm for computing the Euclidean distance maps of binary images on 2D meshes with reconfigurable buses

Force O�ce of Scienti®c Research under grant F49620-93-C-0063, by the AirForce Avionics Laboratory, Wright Laboratory, under Grant F33615-C-2218,and by Ohio Board of Regents through the Investment Fund Program and theResearch Challenge Grant Program. Keqin Li's research was supported in partby a SUNY-New Paltz 1995 Research and Creative Project Grant.

References

[1] T. Bossomaier, N. Isidoro, A. Loe�, Data parallel computation of Euclidean distance

transforms, Parallel Processing Letters 2 (4) (1992) 331±339.

[2] L. Chen, H.Y.H. Chuang, A fast algorithm for Euclidean distance maps of a 2D binary image,

Information Processing Letters 51 (1994) 25±29.

[3] L. Chen, H.Y.H. Chuang, An e�cient algorithm for complete Euclidean distance transform

on mesh-connected SIMD, Parallel Computing 21 (1995) 841±852.

[4] P. Danielsson, Euclidean distance mapping, Computer Graphics and Image Processing 14

(1980) 227±248.

[5] H. Eggers, Parallel Euclidean distance transformations in Zng, Pattern Recognition Letters

17(7) (1996) 751±757.

[6] H. Embrechts, D. Roose, A parallel Euclidean distance transformation algorithm, Computer

Vision and Image Understanding 63(1) (1996) 15±26.

[7] T. Hirata, A uni®ed linear-time algorithm for computing distance maps, Information

Processing Letters 58 (1996) 129±133.

[8] M.N. Kolountzakis, K.N. Kutulakos, Fast computation of Euclidean distance maps for

binary images, Information Processing Letters 43 (1992) 181±184.

[9] Y.H. Lee, S.J. Horng, T.W. Kao, Y.J. Chen, Parallel computation of the Euclidean distance

transform on the mesh of trees and the hypercube computer, Computer Vision and Image

Understanding 68 (1) (1997) 109±119.

[10] H. Li, Q.F. Stout, Recon®gurable Massively Parallel Computers, Prentice Hall, Englewood

Cli�s, NJ, 1991.

[11] H. Li, Q.F. Stout, Recon®gurable SIMD Massively Parallel Computers, in: Proceedings of the

IEEE, 1991, pp. 429±443.

[12] R. Miller, V.K. Prasanna-Kumar, D. Reisis, Q.F. Stout, Meshes with recon®gurable buses, in:

Proceedings of the MIT Conference on Advanced Research in VLSI, 1988, pp. 163±178.

[13] S. Olariu, J.L. Schwing, J. Zhang, On the power of two-dimensional processor arrays with

recon®gurable bus systems, Parallel Processing Letters 1 (1) (1991) 29±34.

[14] A. Rosenfeld, A.C. Kak, Digital Picture Processing, Academic Press, New York, 1982.

[15] O. Schwarzkopf, Parallel computation of distance transforms, Algorithmica 6 (1991) 685±697.

[16] H. Yamada, Complete Euclidean distance transformation by parallel operation, in: Proceed-

ings of the Seventh International Conference on Pattern Recognition, 1984, pp. 69±71.

Y. Pan, K. Li / Information Sciences 120 (1999) 209±221 221