A note on average distances in digital sets

A note on average distances in digital sets

Pattern Recognition Letters 5 (1987) 281-283 North-Holland April 1987 A note on average distances in digital sets Azriel R O S E N F E L D Center f ...

218KB Sizes 0 Downloads 99 Views

Pattern Recognition Letters 5 (1987) 281-283 North-Holland

April 1987

A note on average distances in digital sets Azriel R O S E N F E L D Center f o r 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 o f S, there exists a point P in S whose average distance from the P~'s differs from a7 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 exactly 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 exists 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 coordinates in t-dimensional space). Two lattice points will be called c-adjacent, where O<_c
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 o f 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 o f a in the continuous 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 o f ~+, 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 o f Sandra German in preparing this paper. 0167-8655/87/$3.50 © 1987, Elsevier Science Publishers B.V. (North-Holland)

281

V o l u m e 5, N u m b e r 4

PATTERN

RECOGNITION

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

Hi=l

d(Qj, Pi),

and for 1 _
_1

d(Pk, Qi)-
mi=l

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

_l

e(ej, e)-<±

Hi=l

mi=l

e(e;, e ) > 1

Hi=l

e(p , e;).

mi=l

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

1 n j= ~ \n

)

i= ~

~m =i

d(Pk, Oil-)

for all l_
n

n

m

E E d(Qj, P~)> E E d(Pk, Q,),

j=li=l

k=li=l

which is impossible since d is symmetric. Hence d exists. The p r o o f in the digital case is a little different. Since S is finite, dn(S) is a bounded set o f nonnegative 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 from 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, since

d ( A i - 1, la]) <- d ( A i - I, A i ) + d ( A i , Pj) = 1 +

d(Ai, ~) and vice versa. Hence the sum o f 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 n o n e m p t y intersection. Let e be a point in this intersection, and let h be the closest integer to e; thus ]h-e[<-4. If 282

A p r i l 1987

an=tin(A) or bn=drz(B) is within 4 of h, we are done. If not, we must have d a ( A ) = a a < h - g < h4, contradiction. 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 from P to the P,-'s lies within ½ of the integer aT= h.

e(p. e,).

Suppose, to the contrary, that we had

±

LETTERS

3. Nonuniqueness In the continuous case, a7 is unique; but the p r o o f 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 [IlL let S be the 'ball' o f radius s, consisting o f all lattice points having distances _
Volume 5, Number 4

PATTERN RECOGNITION LETTERS

case; for any n and any Pt .... , P,,, we can find a P whose average distance f r o m 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 r g u m e n t remains valid if we allow repetitions in the Pfls.) N o t e that in the continuous 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. A n alternative is to use the 'intrinsic' 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 r o m A to B, where the A i ' s are in S and Ai is c-adjacent to A i - I , l
April 1987

so that one o f these averages >_ r/2 and the other <_r/2. In the c o n t i n u o u s case, since the average distance f r o m P to the Pi's is a c o n t i n u o u s function o f P, as P moves f r o m U to V the average distance must pass t h r o u g h 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 r o m U to V, the average distance t o o 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 uniqueness, take n = 2, P~ = U, P2 = V; then for any P we have ½(d(P, P1)+d(P, ~ ) ) = r / 2 , so that in the c o n t i n u o u s 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 c o n t i n u o u s (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 c o o r d i n a t e can c h a n g e at a time, the n u m b e r o f moves in any given principal direction must be equal to the n u m b e r o f moves in the opposite direction, so that the total n u m b e r o f moves in each pair o f opposite directions is even.) T o show existence, let U, V be a pair o f antipodal points on the curve, i.e., a pair o f points r/2 apart. T h e n for any P, we have d(Pi, U) + d(Pi, V) = r/2; hence

/7

U) + i

d(Pi, V) = rn/2n = r/2, i=1

so that one o f these averages _>r/4 and the other <_r/4. Thus, exactly as in the preceding p a r a g r a p h , in the c o n t i n u o u s case, or in the digital case if r is a multiple o f 4, a = r/4 is unique.

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

[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 Processing. Second edition, Academic Press, New York, Chapter I1.

283