a note on average distances in digital sets

3
Pattern Recognition Letters 5 (1987) 281-283 April 1987 North-Holland A note on average distances in digital sets Azriel ROSENFELD Center for Automation Research, University of Maryland, College Park, MD 20742, USA Abstract: For any compact connected metric space S, there exists a unique nonnegative real number a such that, for any positive integer n and any points Pi ..... Pn of S, there exists a point P in S whose average distance from the P,'s is exactly d. In this note we prove that for any finite connected digital set S and integer-valued metric defined on S, there exists a nonnegative integer a such that, for any positive integer n and any points PI, ..., Pn of S, there exists a point P in S whose average distance from the P~'s differs from a 7 by at most ~; but /3 is not necessarily unique. Key words: Digital sets. 1. Introduction It is shown in [1] that for any compact connected metric space S, there exists a unique nonnegative real number d such that, for any positive integer n and any points PI ..... Pn of S, there exists a point P in S whose average distance from the P/'s is ex- actly d. In this note we prove an analogous result for integer-valued metrics on digital sets: for any finite connected digital set S and ('standard') integer-valued metric defined on S, there exists a nonnegative integer d such that, for any positive integer n and any points Pl ..... Pn of S, there ex- ists a point P in S whose average distance from the Pi's differs from a by at most ½; but a is not necessarily unique. Here a digital set is a subset of Z t (the set of lattice points having integer coor- dinates in t-dimensional space). Two lattice points will be called c-adjacent, where O<_c<t, if c of their coordinates are equal, and the remaining coordinates differ by 1; c-connectedness is the reflexive closure of c-adjacency. (For t=2 [2], l-connectedness as defined here is usually called 4-connectedness, and 0-connectedness is usually called 8-connectedness.) Our digital result holds for any t and c, provided the metric is such that two points have distance 1 iff they are c-adjacent. (For t = 2 and c = 1, this defines city block distance, and for t = 2, c= 0 it defines chessboard distance.) In Section 2 we prove the existence of a in both the continuous and digital cases. In Section 3 we show by example that a is not necessarily unique in the digital case, and also give examples of digital sets for which a is in fact unique. In Section 4 we consider cases where distance is measured intrinsic to S, and in particular where S is a simple arc or curve. 2. Existence We first prove the existence of a in the con- tinuous case; the proof is taken from [1]. Let H-- {PI..... Pn}, and let dn(P) be the average distance of P from Pi ..... Pn. Evidently dn is a continuous function from S into the nonnegative real numbers ~+. Hence dn(S) is a compact connected subset of ~+, and so is an interval, say [an, bn]. Clearly a exists iff Nn [an, bn] is nonempty. We prove nonemptiness by showing that for any /7= The support of the Air Force Office of Scientific Research under Grant AFOSR-86-0092 is gratefully acknowledged, as is the help of Sandra German in preparing this paper. 0167-8655/87/$3.50 © 1987, Elsevier Science Publishers B.V. (North-Holland) 281

Upload: azriel-rosenfeld

Post on 21-Jun-2016

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: A note on average distances in digital sets

Pattern Recognition Letters 5 (1987) 281-283 April 1987

North-Holland

A note on average distances in digital sets

Azriel R O S E N F E L D Center for Automation Research, University o f Maryland, College Park, MD 20742, USA

Abstract: For any compact connected metric space S, there exists a unique nonnegative real number a such that, for any positive integer n and any points Pi . . . . . Pn of S, there exists a point P in S whose average distance from the P,'s is exactly d. In this note we prove that for any finite connected digital set S and integer-valued metric defined on S, there exists a nonnegative integer a such that, for any positive integer n and any points PI, ..., Pn of S, there exists a point P in S whose average distance from the P~'s differs from a 7 by at most ~; but /3 is not necessarily unique.

Key words: Digital sets.

1. Introduction

It is shown in [1] that for any compact connected metric space S, there exists a unique nonnegative real number d such that, for any positive integer n and any points PI . . . . . Pn of S, there exists a point P in S whose average distance from the P/'s is ex- actly d. In this note we prove an analogous result for integer-valued metrics on digital sets: for any finite connected digital set S and ( 's tandard') integer-valued metric defined on S, there exists a nonnegative integer d such that, for any positive integer n and any points Pl . . . . . Pn of S, there ex- ists a point P in S whose average distance from the Pi's differs from a by at most ½; but a is not necessarily unique. Here a digital set is a subset of Z t (the set of lattice points having integer coor- dinates in t-dimensional space). Two lattice points will be called c-adjacent, where O<_c<t, if c of their coordinates are equal, and the remaining coordinates differ by 1; c-connectedness is the reflexive closure of c-adjacency. (For t = 2 [2], l-connectedness as defined here is usually called 4-connectedness, and 0-connectedness is usually called 8-connectedness.) Our digital result holds

for any t and c, provided the metric is such that two points have distance 1 iff they are c-adjacent. (For t = 2 and c = 1, this defines city block distance, and for t = 2, c= 0 it defines chessboard distance.)

In Section 2 we prove the existence of a in both the continuous and digital cases. In Section 3 we show by example that a is not necessarily unique in the digital case, and also give examples of digital sets for which a is in fact unique. In Section 4 we consider cases where distance is measured intrinsic to S, and in particular where S is a simple arc or curve.

2. Existence

We first prove the existence of a in the con- t inuous case; the proof is taken from [1]. Let H- - {PI ..... Pn}, and let dn(P) be the average distance o f P from Pi . . . . . Pn. Evidently dn is a continuous function from S into the nonnegative real numbers ~+ . Hence dn(S) is a compact connected subset of ~+, and so is an interval, say [an, bn]. Clearly a exists iff Nn [an, bn] is nonempty. We prove nonemptiness by showing that for any /7=

The support of the Air Force Office of Scientific Research under Grant AFOSR-86-0092 is gratefully acknowledged, as is the help of Sandra German in preparing this paper.

0167-8655/87/$3.50 © 1987, Elsevier Science Publishers B.V. (North-Holland) 281

Page 2: A note on average distances in digital sets

Volume 5, N u m b e r 4 P A T T E R N R E C O G N I T I O N L E T T E R S Apr i l 1987

{PI ..... Pn} and II '={Q I ..... Qm} we have ar t< brt,. To see this, note first that for 1 <j<_m we have

art< d(Qj, Pi), Hi=l

and for 1 _< k < n we have

_1 d(Pk, Qi)-< bw. m i = l

Thus it suffices to show that for some j and some k we have

_l e(ej, e)-< ± e(p. e,).

Hi=l m i = l

Suppose, to the contrary, that we had

± e(e;, e ) > 1 e(p , e;). Hi=l m i = l

for all l<_j~m and all l<_k<_n. Then summing over j we have

1 n ) ~m d(Pk, Oil-)

j = ~ \ n i= ~ = i

for all l_<k_<n, and summing these last in-

equalities over k we get

m n n m

E E d(Qj, P~) > E E d(Pk, Q,), j = l i = l k = l i = l

which is impossible since d is symmetric. Hence d exists.

The p roof in the digital case is a little different. Since S is finite, dn(S) is a bounded set o f non- negative rational numbers; let its least and greatest

elements be an and brt, where art=drt(A), brt= da(B). Since S is c-connected, there exists a path A =Ao ..... Ar=B f rom A to B such that each A i is

a lattice point in S, and Ai is c-adjacent to A i_ i, 1 <<.i<<.r. As we move along the path, the distance to each Pj- can change by at most 1 at each step,

s i n c e d ( A i - 1, la]) <- d ( A i - I, A i ) + d ( A i , Pj ) = 1 +

d(Ai, ~) and vice versa. Hence the sum of the distances to all the Py's can change by at most n, and the average by at most 1, at each step.

By the same argument as in the continuous case, the intervals [art, bu] have a nonempty intersec- tion. Let e be a point in this intersection, and let h be the closest integer to e; thus ]h-e[<-4. I f

an=tin(A) or bn=drz(B) is within 4 of h, we are done. I f not, we must have da(A)=aa<h-g< h<h+½<bn=drt(B), since if an and bn were both on the same side of the interval [h - ½, h + ½], so would e be, and we would have ]h-el>4, con- tradiction. As we saw in the last paragraph, as we

move along the path A = A o ..... At=B, the average distance changes by at most 1 at each step; hence for some A] the average distance lies in the interval [h - 4, h + ½]. Thus for a n y / 7 there exists P=Aj such that the average distance f rom P to the P,-'s lies within ½ of the integer aT= h.

3. Nonuniqueness

In the continuous case, a 7 is unique; but the p roof is nonelementary [1]. In the digital case, as we shall now see, a7 is sometimes, but not always, unique.

As a first example (see Example 2 of [I lL let S be the 'bal l ' o f radius s, consisting of all lattice

points having distances _<s f rom a given lattice point O. Let n = 1 and PI = O; then for any P in S we have d(P, O)<_s, so that we must have a_<s. On

the other hand, let n = 2 and let PI, P2 be a pair o f diametrically opposite points o f S; then d(Pz, "°2)=2s, and for any P in S we have 2s= d(Pi, P2)<d(Pl, P)+ d(P, P2), so that ½(d(P, P l ) + d(P, P2))<--s, implying that a < s . It follows that cT=s is unique. (The same proof shows that a7 is unique for a ball in the continuous case.)

As a second example (see Example I o f [1]), let S be a digital straight line segment of length s in one of the principal directions, i.e., consisting of a sequence of s + 1 collinear lattice points, each c-

adjacent to the preceding one: U=Uo, UI ..... Us= V. Let n = 2 and Pl = U, P2 = V; then for any P in S, say P = Uj, we have d(P, PI)=J and d(P, P2)=s-j, so that ½(d(P, Pl)+d(P, P2)) =4( j+s - j )=s /2 . I f s is even, it follows that c7=s/2 is unique; for n = 2 the average distance in always equal to the integer s/2, and so cannot be within {- of any other integer. On the other hand, suppose s is odd; in particular, let s= 1, so that S = {U, V}. I f n = 1, we have d(P, P 0 = e i t h e r 0 or 1, and if n = 2 we have 4(d(P, PI)+d(P, P2))= 4(0+ 1) =~ . Thus either a = 0 or aT= 1 works in this

282

Page 3: A note on average distances in digital sets

Volume 5, Number 4 PATTERN RECOGNITION LETTERS April 1987

case; for any n and any Pt . . . . , P,,, we can find a P

whose average distance f rom the P/ 's is within i, o f

0, and we can also find a P for which the average is within .4- o f 1. (The a rgument remains valid if we allow repetitions in the Pfls.) Note that in the con-

t inuous case, a is unique for any digital straight line segment, since here we require that there exist a P for which the average distance is exactly 3, so

that a can only be s/2. It would be o f interest to characterize those

digital sets S for which a is unique.

4. Intrinsic distance

Up to now we have assumed that distances are measured in Z t. An alternative is to use the ' in-

trinsic ' distance in S, i.e., to define the distance between two points A and B o f S as the length r o f

the shortest path A = A 0,Al . . . . . A r = B f rom A to B, where the A i ' s are in S and Ai is c-adjacent to

A i - I , l<i<-r. ~ In particular, let S be a simple digital c-arc, i.e., a sequence o f distinct lattice

points U=Uo, U1 . . . . . Ur = V such that U I is c- adjacent to U s (i<_j) if and only i f j = i - l ; then the intrinsic distance in S is simply the distance measured ' a long S ' . Similarly, o f S is a simple clos-

ed digital c-curve, i.e., a sequence o f distinct lattice

points U0, Ul . . . . . Ur-1 such that Ui is c-adjacent to Uj (i<_j) if and only i f j = i - 1 (modulo r), in-

trinsic distance becomes distance ' a long S ' . Using intrinsic distance allows us to generalize

our straight line segment example to an arbi t rary arc. We first give a simplified p r o o f o f the ex-

istence result for an arc. (We will treat bo th the cont inuous and digital cases; in the fo rmer case we

assume that S is a rectifiable simple arc o f finite length r and with endpoints U and V.) For any P~- we have d(P/, U) + d(P/, V) = r; hence

1 d(P/, U ) + ~ d(Pi, V) = r n / n = r , n Li=l i=t

i If s is 'convex'. in the sense that any two points of S are the endpoints of a geodesic (i.e., a minimal-length path in Z t) that lies entirely in S, then the intrinsic distance in S is the same as the distance in Z t.

so that one o f these averages >_ r/2 and the other

<_r/2. In the cont inuous case, since the average

distance f rom P to the Pi ' s is a cont inuous func-

tion o f P , as P moves f rom U to V the average distance must pass th rough the intermediate value

r/2. In the digital case, since each d(P, Pi) changes

by at most 1 at each step as P moves f rom U to V, the average distance too can change by at most 1 at each step, so must pass within ~ o f the integer

closest to r/2, as we saw in Section 2. For uni-

queness, take n = 2, P~ = U, P2 = V; then for any P

we have ½(d(P, P1)+d(P, ~ ) ) = r / 2 , so that in the

con t inuous case, or in the digital case if r is even,

the value a = r / 2 is unique; but for odd r in the digital case, 3 is not unique (e.g., let r = 1, as in

Section 3). We can also establish analogous results for a

con t inuous (rectifiable) or digital simple closed

curve; for simplicity, we assume that the length in

the digital case is even. (This is always true if we use ( t - l ) - a d j a c e n c y ; since only one coord ina te

can change at a time, the number o f moves in any given principal direction must be equal to the number o f moves in the opposi te direction, so that

the total number o f moves in each pair o f opposi te

directions is even.) To show existence, let U, V be a pair o f ant ipodal points on the curve, i.e., a pair o f points r/2 apart . Then for any P, we have

d(Pi, U) + d(Pi, V) = r/2; hence

- U) + d(Pi, V) = rn/2n = r/2, /7 i i = 1

so that one o f these averages _>r/4 and the other <_ r/4. Thus, exactly as in the preceding pa ragraph ,

in the con t inuous case, or in the digital case if r is a multiple o f 4, a = r/4 is unique.

References

[11 Cleary, J.. S.A. Morris, and D. Yost (1986). Numerical geometry - Numbers for sets. Am. Math. Monthly 93, 1986, 260-275.

[2] Rosenfeld, A. and A.C. Kak (1982). Digital Picture Pro- cessing. Second edition, Academic Press, New York, Chapter I1.

283