COMPUTER GRAPHICS AND IMAGE PROCESSING (1975) 4, (339-360)
Regular Arcs in Digital Contours C . A R C E L L I AND
A. MASSAROTTI
Laboratorio di Cibernetlca del C.N.R., Via Toiano 2, Arco Felice, Naples, Italy Communicated by A. Rosenfeld Received D e c e m b e r 9, 1974 The concept of regularity plays an important role in the study of the arcs of a digital contour. In this paper, the structure o f regular digital arcs is investigated and, once given a general definition of straightness for digital contour arcs, a necessary and su~cient condition for the straightness of regular arcs is given. This condition only depends on parameters characterizing the macrodescription of the regular digital arc; its equivalence with the chord property is also shown. The knowledge of the structure of regular digital arcs can be a good starting point for the study of nonregular digital arcs, so that it could be possible to formulate a general algorithm to detect both concavity and convexity.
1. INTRODUCTION Geometric properties are often taken into account to describe pictures and it is interesting to notice that most of them characterize those regions of a picture which constitute fixation points [1,2]. In a binary picture these points are present at the contour and at any abrupt change of direction of the contour. As a consequence fixation points correspond to those parts of the contour with greater curvature and, once it is assumed that the contour curve is regular, in the Euclidean plane it is possible to determine exactly [3] the value of such curvatures. On the other hand, if we call A the binary digital image of a real figure d , obtained by using any digitization scheme, we are not able to detect on the discrete plane all the contour variations of d , but only a subset of them. This is true no matter how small the elementary unit of the binary digital picture is chosen, since A corresponds not only to d , but to all the family of real pictures which are in the same tolerance class with d [4]. Nevertheless we can assume that only the detectable contour variations are meaningful provided that the dimensions of the elementary unit are less than those of the smallest detail we want to appreciate on d . Unluckily also in this case, although many algorithms for concavity or for convexity detection have been proposed (an extensive list is given in [5]), there has not yet been given a necessary and sufficient condition which allows one to recognize an arc, i.e., a connected subset, of a digital contour as straight or alternatively as concave (c~) or convex (cx). We want to quote here the solution [6] given to a similar problem in which the digital picture to investigate is a digital arc, as defined in [7], obtained as digitization of a real straight line segment. The necessary and sufficient condition that such a digital arc (d.a.) be straight can be formulated as follows. Let p, q be points (elements) of d.a. and ~ the real line segment joining p with q; then d.a. is straight iff for every p, q in d.a. the distance of every real point of ~ from d.a. 339 Copyright© 1975 by AoademiePress, Inc. All rightsof reproductionin any form reserved.
340
ARCELLI AND MASSAROTTI
is less than one, where the distance between points with coordinates (i,j), (h,k) is defined as max (1i- h(, rJ - kl). When this happens d.a. is said to possess the chord property. In this way a precise means to determine the straightness of d.a. is given and remarkable progress is made with respect to the qualitative criterion [8] until recently used to characterize a straight line, coded with Freeman's chain Code. According to this criterion a straight line should possess the following three properties. (i) It contains codes of no more than two different values; (ii) the two code values differ by unity, modulo 8; (iii) one of the code values always occurs singly and is as uniformly spaced as possible among codes of the other value. Unfortunately, to test whether d.a. possesses the chord property requires a large amount of computation. We think that this is due to the fact that, although some structural features have been discussed in [6], d.a. has been considered rather as a sequence of digital elements than as a sequence of subarcs having certain peculiar properties. In this paper we will consider arcs, i.e., connected subsets, of a digital contour and will show that, by using a structural description, it is possible to give a necessary and sufficient condition for their straightness. Generally the search and the definition of the structure of a picture consists in the formal description of some pictorial intuition, which in turn often depends on the personality of the investigator. On the other hand in our case we can focus the search by taking into account the properties of a regular curve defined in the Euclidean plane [3] such as the contour of a real figure usually is. Moreover we can notice that the only meaningful real arcs to examine are those with the same kind of curvature (concavity or convexity) and therefore without points of inflexion. Then in such arcs the derivative is a monotonic function, i.e., geometrically speaking, the angle made by the tangent to the contour curve with the axis of abscissas changes monotonically when we move along the contour and furthermore the contour always lies in the same semiplane on the right or on the left of the tangent. We see the straightness of an arc of a digital contour (d.a. from now on) as the nonexistence of concavity or convexity in at least one real arc of which such a d.a. is the digitization. Conversely we will say that d.a. is cv(c~.) iff all the real arcs are c~(cx). In the sequel it is shown that if in the Euclidean plane all the real arcs are c o(cx), then in the discrete plane the corresponding d.a. does not possess the chord property and vice versa. In this way, however complex the structure of d.a. is, it is straight iff it has the chord property. Furthermore, the concepts of k-monotonicity and k-regularity have been introduced and a hierarchy of structural descriptions has been established together with rules which allow one to pass from one level to the next and vice versa. Finally, and this is the principal result, it is shown that the chord property can be expressed as a function of macroparameters characterizing that level in which it is possible to describe d.a. as monotonic and regular. The d.a.'s we consider have been coded according to Freeman's chain code and, except for some remarks on d.a.'s with a chain constituted of more than two codes (for which it is trivial to make a decision about concavity or convexity), we have undertaken the study of d.a.'s which satisfy the previously mentioned three properties that a digital straight line should possess.
R E G U L A R ARCS IN D I G I T A L CONTOURS
341
2. CONTOUR VARIATIONS By the term binary picture we will mean every bounded subset ~ of the Euclidean plane, for every point p of which a two-valued function f ( p ) , with values 0 and 1, is defined. L e t d = {p;p E N , f ( p ) = 1} and S~ "=- {p;p E .~,J'(p) = 0} and let us assume that ~¢ is closed and simply connected. If we now divide N into squares su as a chess board we obtain a set P = {s~;1 ~< i ~< n,l ~
VP ~ su, "zip E su
f ( p ) '= 1, such t h a t f ( p ) = 0.
T h e set P, union of the sets A = {su;su = 1} and A = {su;su = 0}, will be called a binary digital picture. As the contour of A we will define the set C = {s,~;s~j ~ A,d(s~j,A)--- 1}, where the distance function d is taken as follows d( su,sh~) = li -- hi + IJ -- kl. C is an 8-connected digital curve, although not necessarily a simple curve [7]. In the sequel we will consider also the sets d ' = { p ; p E su,su = 1} and .~' -= {p;p ~ ~ - d ' } . Since the squares contain their boundaries, the set ~¢' is closed and ~ will be its boundary. Chain encoding [8] can be used to establish a 1- I correspondence between the contour and a sequence of codes: to every element su of C a code is associated which indicates the position, among the possible eight, occupied by the element following clockwise su along the contour. Every code can also be seen as a vector with length 1 of ~/2 and with tail and head respectively centered on the barycenter of the element to which the code is referred and on that of the element following it in C. As a consequence the contour can be expressed in a compact form as a polygon where the direction and the length of every edge is identified by a pair of numbers, the first of which corresponds to the code common to a sequence of successive elements of C and the second to the number of such elements. E v e r y su belonging to C contains both points of d and of ~ . We will suppose that inside every edge of C the real contour cg of ~¢ is devoid of points of inflexion; in fact the curvature variations of cg, when they exist, have dimensions smaller than those o f the element su It follows that to decide whether ,~¢ is c~ or c~ along a part of its contour, we will consider a d.a. constituted of more than one edge. Let us remember now that in the Euclidean plane the real arc cg., subset of the contour of ~¢ and without points of inflexion, is c~(c~) if and only if the straight line segment joining any two of its points, e.g., its extremes, contains at least one (does not contain any) point o f ~ ' . Then we will say that the d.a. C * is c~(c~) if and only if all the real arcs cg., to which C* corresponds in the discrete plane, turn their concavity toward the outside (the inside) of ~¢. Let us now consider C * as a ° s e q u e n c e of elements of A, i.e., C * = a~,a2, • • . ,ak; then C* is nonrepeating when a~ = aj if and only if i = j . It is trivial to observe that C * is always c~ when it is repeating. In the opposite
342
ARCELLI
AND
MASSAROTTI
case l e t ~ = say t h a t
{p;p q ~',d(p,~)
= 1} and ~ be the boundary o f d ' ,
(i) C * is q E ae N ~ (ii) C* is q E ae n J d(r,T/") ~ 1.
co if and only if, with two chosen, there exists a point r c~ if and only if, with two chosen, there exists at least
then we
suitable points p ~ a~ N ~ E p-~ N ~¢' such that d ( r , ~ ) suitable points p ~ a~ n J one point r E p-~--n ~¢' such
and >1 I;
and that
W h e n (i) holds, at least one whole element a~ belonging to C* is included b e t w e e n ~ and the segment p-'q so that at least one point of ~ belongs to p-0. Points p , q must be chosen so as to maximize that part of ~ ' included between p-q a n d ~ , i.e., p , q are such that max~,r~{d(x, ~ ) } > ~ar~x {d(y, ~)};
{'VnI ~E aka~An ~3,~'mn~#q.p;
As for (ii), it implies that r belongs to ~'. Since the position of the points of d inside a~ and au is unknown, points p , q must be chosen so that, if an r E ~ ' exists such that r E pq, any other segment with extremes in a~ and a~ contains one or more points of ~¢. T h e n p , q are such that max {d(x,7/')} < max {d(y,7/')}; x e p-@
~e ~'~
J'Vm ~ al n ~ , m # p, [Vn ~ a k n 7/",rl # q.
3. MONOTONIC DIGITAL ARCS In this section we will introduce the concept of k-monotonicity (k = 1,2, . . . ,n) for a digital arc with special reference to the cases with k = 1,2. Let the d.a. C* be represented as a sequence of edges of the contour polygon, C* = (ca,hi), (cz,h~), . . . ,(cm,hm), where ci is the orientation and ht the length of the ith edge, (q,h~) meaning ordered pair. Then C * is 1-monotonic iff the difference modulo 8 between successive codes is ci+1 =
Cl >
0
(or q+~ --' q < 0),
gi.
It is trivial to observe that a 1-monotonic d.a. with m > 2 is never straight and is c~(c:~) if the 1-monotonicity is decreasing (increasing). On the contrary, if m = 2,
the following holds. PROPOSITION 3.1. C * is c,(c~) if c2 "--Ca <~--2 (c~ "--c~ >~ + 2 ) . PROPOSITION 3.2. C * is c~(cz) if c2 "--c~=--I (c,--' c ~ = + l ) and h1>t 2,h2 >- 2. Calling 1-decidable a 1-monotonic d.a. which is nonstraight, we see from above that a 1-monotonic d.a. is non-1-decidable iff it has only two edges, one of which is of unitary length, and Ic2-" c~l = i. F r o m now on we will refer to d.a.'s which lie in the first octant. This is only for simplicity's sake and will not cause loss of generality since the same reasoning can be repeated and equally holds in the remaining octants. Every d.a. will be indicated in an equivalent way with C { when considered as a sequence of digital elements and with g'* when considered as a sequence of adjacent oriented straight line segments.
343
R E G U L A R ARCS IN D I G I T A L C O N T O U R S
I
l
K
]~
FIO. 1. Non-l-decidable digital arcs.
The 1-monotonic d.a.'s which in the first octant are non-1-decidable are shown in Fig. 1: the d.a.'s of types I and II (III and IV) are potentially c~(c~) arcs, Consider now a d.a. C 1, union of non-l-decidable d.a.'s with the same type of potential curvature; we will find which structure C ~ should possess to be nonstraight. First we assume that in C 1 all the non-l-decidable d.a.'s belong to only one of the two classes of arcs which characterize potentially c~(c~) arcs in Fig. 1; otherwise it would be easy to show that there exists at least one nonstraight subarc of C 1 so that C a is nonstraight. The subarc is 1-decidable when C 1 is made up with the ordered pair II, I (III, IV) and 2-decidable (see below for this definition) when the ordered pair is I, II (IV, III). This last case will b e discussed more extensively in Section 6. Examine now go1: it is a sequence of alternatively equally oriented edges where all the even (odd) positions are filled b y unitary length edges. If we call o~~ these edges and k~ the remaining ones, then g,x is described by a sequence of ordered pairs (k?,col) ((¢o~,X~)). C ~ is said to be a 2-monotonic d.a. iff the sequence kl,k I . . . . . kn~ is monotonic, i.e.: kl ~ k~÷x,
Vi (nonincreasing monotonicity; shortly/z 1 = - - 1 )
or
)t~+~,
Vi (nondecreasing monotonicity; shortly/x ~= +1).
Assuming for simplicity that the ordered pairs are of type (M, oil), the geometrical interpretation o f a 2-monotonic d.a. is the following. L e t t~ be the oriented segment joining the extremes o f the pair (Xl, oJa ) and indicate with o~ the v e r t e x angle between t~ and t~+~, where by vertex angle we mean the interior angle between two adjacent edges o f the sequence g~2 = t~, t~, . . . , t~ considered in turn here as new descriptions of the contour. Then if C ~ is 2-monotonic it follows that a~ ~> 7r, Vi, or ~ ~ % Vi. In the sequel we will consider only kregular arcs; when k = 2 the 2-monotonic d.a. C ~ is said to be 2-regular iff it has the same type of potential curvature possessed by the non-l-decidable d.a.'s o f which it is the union. This happens when, calling/3 the v e r t e x angle between kl and ro1, we have o~i I> 7r
if
fl > ~"
(or ~i ~< 7r
if
/3 < 7r),
Vi.
Notice that a 2-monotonic C 1, which is non-2-regular, always contains a 2regular subarc and this is obtained from C ~ by disregarding in g'l the initial edge kl and the final edge oJ ~ and by inverting the order of the pair (k~,o~), e.g., (kl,oJ 1) becomes ((ol,kl). P R O P O S I T I O N 3.3. A 2-monotonic d.a., sequence of ordered pairs (k~,o2)((~oLk~)), is 2-regular iff/x ~ = - 1 (/z ~ = + 1). B y construction a 2-regular d.a. can be c~(c~) only when the non-l-decidable
344
ARCELLI AND MASSAROTTI
d.a.'s, of which it is made up, are potentially c~,(cx). Then, referring to Fig. 1 and recalling Proposition 3.3., it is easy to see that the following holds. P R O P O S I T I O N 3.4. A necessary condition for a 2-regular d.a. to be cv(c:~) is that 41 has one of the configurations (a) or (b), ((c), or (d)): (a) (b) (c) (d)
/~1 =--1 /.~1= + 1 /.~a=--1 /x a = +1
and and and and
Jk1 k~ k1 ka
horizontally oriented, diagonally oriented, diagonal, horizontal.
To decide about the nonstraightness of C 1 = ai,a2, • • • ,ak~, we must consider w h e t h e r in P-0 a real point exists such that its distance d from ~ or 5~ is greater than or equal to one; where p,q are suitable real points of al and ale1, respectively. It is interesting to notice that it is possible to study in the same way both concavity and convexity; in fact, since we k n o w a priori the t y p e of the potential curvature of the 2-regular d.a., which is determined by the value <> ~r of the interior angle defined b y the pair (k~,oJ~), we need only to k n o w whether d.a. is straight. If we indicate by ~l the set of real points belonging to got, then the following holds. T H E O R E M 3.1. A 2-regular d.a. is straight iff the set g~l has the chord property. PROOF. F o r clarity's sake, we will refer the proof to four 2-regular d.a.'s (dotted digital elements in Fig. 2). The (a), (b) d.a.'s are described by the ordered pair (ojX,kl), and the (c) and (d) d.a.'s by the ordered pair (h~,oJ1). The corresponding ~-i's are represented by dashed lines and the real points p E a~ and q E akl, chosen in positions such that the requirements mentioned in Section 2 be satisfied, are also shown. L e t us examine, first, Cases (a), (b) (potentially c~ d.a.'s) and call 7r* (heavy line in the figure) the subset of ~ with boundary points p and q. We k n o w that d.a. is c~: iff at least a real point in ~-~ exists such that it belongs also to ~ or, in an equivalent way, such that its distance d from ~ * is equal to one. If we consider the barycenters b~ and bk, of the digital elements aa and akl, it is easy to verify that a correspondence exists between such points, extremes o f ~ ~, and points p,q; in fact they belong to parallel straight line segments with same length. Moreover, the geometrical shapes of ~ * and Na are equal. N o w translate N~ until its extremes bl,b~ coincide with p and q; then Nx reaches a position coinciding with 7/'* and we can say that d.a. is c~ iff a real point r, belonging to the segment b~be~, exists such that d(r,N ~) t> 1 or, in other words, iff g'~ does not possess the chord property.
FIG. 2. Convex (a), straight (b), (c), and concave (d) digital contour arcs. Suitable points p and q have been circled, while ~'l's are represented by the dashed lines. Heavy lines correspond to sets V'* and ~'*.
REGULAR ARCS IN D I G I T A L CONTOURS
345
Similar arguments hold with respect to the Cases (c), (d), i.e., potentially c, d.a.'s. Calling ~ * the subset of ~ with boundary points p and q (heavy line in Fig. 2(c), (d)), d.a. is c~ iff at least a real point in p--q exists such that it belongs also to ~ or, equivalently, its distance from ~ * is equal to one. Since the same correspondence exists between p,q and ba, bk,, we can translate ~1 until its extremes coincide with p,q. Then ffl reaches a position which is the geometrical locus of the points with distance d = 1 from ~ ; as a consequence we can say that d.a. is c~ iffa real point r U blbkl exists such that d(r,gvl) ~ 1, i.e. iffW1 does not possess the chord property. Summarizing, d.a. is straight iff ~ has the chord property. Q.E.D. Notice that, although we use a distance function different from [6], the geometrical meaning of the chord property remains unchanged. In practice, to decide about the straightness of d.a., we will look for the real point r ~ ~ ~1 with maximum distance from btb"--i, and will find under which conditions its distance is greater or equal to one. It is important to notice that, since ~ lies in the first octant, the distance d of a point r ~ ~ ~a from b~b~,, is equal to the length of the segment ~ , where r is the projection along the direction of the y axis of r a on b~b---~,. Furthermore, in order that the length of r'~r be locally maximum, the point r ~ must coincide with a vertex corresponding to a convex interior angle of the polygon g~ U b~b~,. The position of H can be precisely established, in fact calling hl the multiplicity of kt with respect to the corresponding Freeman code (i.e., the number of equal codes by which kl is built up) the following holds. T H E O R E M 3.2. A point r ~ E Nz, bearing maximum distance d from bxblc~, is one of the extremes of the edge XJ, such that (1) hJ~ ~ h~, hk+~ <~ f? (2) hJc >- ~1, hJc-i <~ -hI
when/s ~= - 1 , when/z ~ = + 1 ,
where ~1 = (Z~'=l h~)/n F o r the proof, see Appendix. When more than one point exists with maximum distance from b~b~,, we will consider the first point encountered running along g~ from the left to the right. Since H is the vertex of the kth pair (M~, o~), we have that if/z ~ = - 1 , i.e., the order is (k~,o~ ~) (see Proposition 3.3), the point r I is reached starting from the second extreme of the kth pair and moving along N1 for a path s = / z ~o~a. Vice versa, if/z a = +1, i.e., the order is ( ~ , X ~ ) , H is reached starting from the second extreme of the (k - 1)th pair and moving alongN a for a path s =/zlo~ a. We now give the necessary and sufficient condition: T H E O R E M 3.3. A 2-regular d.a. C a, constituted by n pairs of edges, n t> 4, is nonstraight iff ]h~-- h~] + [h~- h~n_t] i> 2. F o r the proof, see Appendix. Let us notice that, for the proof just given, h~ and h~_~ cannot correspond either to the first or to the last 2ta of CL Then, if n < 4, C ~ is not straight iff I h l - h~! >~ 2 (see Appendix, proof 3.3, Paragraphs I(b), I(d)). For reasons of
346
ARCELLI AND MASSAROTTI
c o m p a c t n e s s in the n e x t sections w e will consider straightness conditions as a l w a y s referred to d.a.'s with m o r e than three pairs o f edges, the case n < 4 b e i n g easily deducible b y what has b e e n said before. I f C 1 is nonstraight, w e will s a y t h a t it is 2-decidable, i.e., it is certainly c~ or cx. In the opposite case C 1 will b e called non-2-decidable, i.e., it is a straight d.a. which only eventually m a y b e l o n g to a w i d e r cv or cx d.a. containing it. 4. A B O U T n - R E G U L A R I T Y
I n this section we will outline the geometrical structure o f an n-regular d.a. F o r simplicity's s a k e w e examine the case n = 3; the remaining arcs, n > 3, can b e easily built b y iterating the s a m e procedure. I f w e disregard the trivial case of non-2-decidability in which one always has h~ - h|+~, t h e n the 2-regular d.a. C ~ is non-2-decidable iff: h~ ± 1 = h~ . . . . .
h~n
or
h] = h~ . . . . .
h~_l = h~ -- 1.
In this case, the s e q u e n c e g z = ,1,'2t z~, . . . , t~ can be written as 1) t~) = (co2,k e)
4 2 = (t~, ( n - -
or
4 2= ((n-
1) t~,t~) - (kz&o2).
Since C ~ is 2-regular, it follows that ga~ has the s a m e t y p e of potential curvature o f the n o n - l - d e c i d a b l e pairs (k~,oo ~) constituting it; on the o t h e r hand, the pair (k2,~o 2) can h a v e either the s a m e o r d e r (see Fig. 3(b), (c), (e), (h)) or the inverted o r d e r (see Fig. 3(a), (d), (f), (g)) with respect to the pair (kl,a~9. C o n s i d e r now s u c h a non-2-decidable C ~ as e m b e d d e d in a wider context, i.e., assume that it
p~ -
,u~ +1
1
d) .Lit=+ 1
pl= + 1
Z
g)
h)
=-i
FIG. 3. Non-2-decidable regular arcs.
R E G U L A R ARCS IN D I G I T A L CONTOURS
347
belongs to a d.a. C 2, sequence of non-2-decidable 2-regular d.a.'s C~'s. Such C}'s are assumed to have the same type of potential curvature and to be constituted b y pairs ()L1,£O1) with the same order. Moreover, C 2 is non-2-decidable in e v e r y junction region between a Ca and the successive CI÷1 as well as in the whole subarc Ca tO CI+1. As a consequence C 2 is a non-2-monotonic d.a. and can b e described as a sequence of equally ordered pairs (oJ2,k~) (or {h~,coz)) in which the edges to2's and X~'s are directed along only two directions and all the to2's have equal length. We will say that C z is 3-monotonic iff the sequence of )t~'s is monotonic, namely, iff X~ ~ ~+~,
Vi
(i.e.,/~ = -- 1),
k~ < X~+l,
Vi
(i.e.,/z ~ = + 1).
or
I f we consider the oriented segment t~ joining the extremes of the pair (At, to~) we can give a definition of 3-regularity for C 2 which is similar to that o f 2regularity given before for C 1. Moreover, the following holds. P R O P O S I T I O N 4.1. A 3-monotonic d.a., sequence of ordered pairs (A~,co2} ((toa,k~)) is 3-regular iff/z 2 = - 1 (/z 2= + 1 ) . W e can notice that a 3-regular d.a. C 2, i.e., C ~ = a l , a z , . . . , a k , , is represented in an equivalent w a y by ~,2 and by g"~; while the former is a monotonic sequence o f edges, the latter is the union of monotonic sequences, each one corresponding to a non-2-decidable C~ (i.e., to a pair of edges in ~ ) . T h e n every pair (Ag,toz) can be thought of as produced by a monotonic sequence of ( h ~ + 1) pairs (kl,t~ ~) according to the following rules. (1)
A~ = h~ (h ~ + oJa),
( 2 ) ~t}2 = ~1~ + (..01,
(4) X,ol-- (h ~ ± 1)e', (5)
~tl1 = C " ,
(3) X~ = h ~ c', where e',c" are the unitary vectors (Freeman's codes) characterizing the directions of k I and co~. Rule (4) can be written in a compact form as
(4') x~ = ( h ~ - ~ ) e ' . In fact, recalling that C 2 is 3-regular, from Proposition 4.1 we have: ~2 = _ 1 ~ the order is {k2,o~2) and/x 2 = +1 ~ the o r d e r is {to2;A2}. T h e n if /z z = - l , if follows that, since to= (and hence X~) is placed at the end o f the sequence of/t~'s in g~, we have k~ = (h =+ 1)c' i f p ~ 1 = -q-1 and X~ = (h ~- 1)e' if /~=-1. Vice versa, i f / z ~ = +1, it follows that, since o~= (and hence X~) is placed at the beginning of the sequence of APs in 8"~, there results ~---(h 1 - 1)c' i f / z 1 = + 1 and k~ = (h ~ + 1)c' if/z ~ = - 1. In conclusion, w e can write X~ = (h ~ --/z~/s~)c'. F o r the 3-regular d.a. C z we could also prove a theorem analogous to T h e o r e m 3.3. On the other hand, let us assume that C ~ is non-3-decidable; then it can b e thought of as e m b e d d e d in a wider context, constituted b y a 4-regular d.a. c a ; also in this case we could repeat the same reasoning just given. In the next seetion it will be shown that an (n + 1 )-regular d.a. C'q union o f non-n-decidable n-
348
A R C E L L I A N D MASSAROTTI
regular d.a.'s is (n + 1)-decidable ff and only if it possesses such an appropriate geometrical structure as that characterized by the relation Ih~~- h~l + Ihg - hnn-l[ ~ 2. 5. DECIDABILITY OF DIGITAL ARCS
L e t us consider the d.a. C a, union of non-n-decidable n-regular d.a.'s cons t r u t t e d as outlined in the preceding section. T h e n C a can be represented as a s e q u e n c e N'~ o f an even n u m b e r of edges t~, where all the edges placed in an even (odd) position have equal length; from now on such edges will be ca/led oJa's. W e say that C ~ is (n + 1 ) -monotonic iff, calling k~ the ith edge placed in an odd (even) position, the sequence h1,~2, " • • • ,k~is monotonic, i.e., M' ~< Xt%i,
Vi (/zn = + 1 ) ,
x~" >-- x~+l,
Vi (tzn = -
or
1).
F u r t h e r m o r e , C" is (n + 1)-regular iff, considering the vector t/~+1 in corres p o n d e n c e with every pair (kT,~n), a definition analogous to t h a t given for C 1 equally holds. F o r an (n 4- 1)-monotonic d.a. a proposition similar to Propositions 3.3 and 4.1 can also be expressed. W e m a y notice that C ~, the sequence of the digital elements a~,a2, • • • ,ak, of the c o n t o u r of A, can be represented b y any of the sequences ~ , ~ z , . . . ,~,t, w h o s e edges h a v e the extremes coincident with the barycenters o f some o f the c o n t o u r elements and are directed along only two directions specified by c' and e " in g~, by ~ and e~2 in ~,2, . . . , by Xn and ~ " in g'". In practice we can perceive only ~e~ which, disregarding unitary length edges, is a sequence of edges with o n l y two lengths and these lengths are consecutive integers. Moreover, the w a y according to which such lengths are distributed is quite varied sinceC n must satisfy the only condition of being non-k-decidable in each o f its subarcs, k = 1,2, . . . ,n. I n fact, we can find 2 ~ such d.a.'s satisfying this condition. L e t us r e m e m b e r that, while ~ is a monotonic sequence, the g~'s (i = 1,2, . . . , n - I) are only unions of monotonic sequences, each of which c o r r e s p o n d s to a n o n - ( / + 1) -decidable subarc of C '~. By comparing such monotonic sequences with ~ we see that they all are regular and have the same type o f potential curvature. M o r e o v e r , if we consider the set of real points g'~, the following relation is true.
(~1 n ~'ft) C (~1 n ~ " - ' )
c
• • • c (,~ n r~).
C o n s i d e r now the polygon Spk = ~k U b--~, where b~ and bk, are the barycenters o f the digital elements a~ and ak,, respectively; we can observe that e v e r y v e r t e x z{ (z~ ~ b~,z{ # bkn) of 5 pk coincides with a vertex o f Sp~-I corresponding to an interior angle greater than ~r. Then, since in e v e r y ~k the interior angles are alternatively <7r and >7r, there exist in 5 pk-i, on the left and on the right o f z~, two vertices with interior angles smaller than ¢r. In the sequel we will find under which conditions the (n + 1 )-regular d.a. C '~ is nonstraight. Since it can easily be proved (analogously to T h e o r e m 3.1) that C a
R E G U L A R ARCS I N D I G I T A L CONTOURS
349
is straight iff the set go1 has the chord property, we determine first the position of the point r 1 E ~1, bearing maximum distance d from bl--b~,. The following theorems hold: T H E O R E M 5.1. A point r n E ~ " , beating maximum distance d from b----~k,, is one of the extremes of the edge ~ such that, indicating by hl~ the multiplicity of M' with respect to the oriented segment (k "-a + oJ"-a), there results: (1) h~ ~ h", (2) h~ ~ h~,
h~+x ~< ~n h~_~ ~ h"
when ~" = - 1 , when ~ n = +1,
where h" is the mean value of the h~'s. F o r the proof, we can proceed as in the proof of Theorem 3.2. In fact, both go,, and go~ are monotonic sequences of edges and have the same geometrical structure. Reference can therefore be made to Proof 3.2 given in the Appendix. T H E O R E M 5.2. Given an (n + 1)-regular d.a. w i t h / z " = +1 ( / z " = - l ) , the position of a point r ~ E go~, bearing maximum distance d from b~bk,, is reached starting from the second extreme of an appropriate ( k - 1)th pair (kth pair) of ~'" and moving along go",go~-l, . . . , ~ , ~ 1 successively for a path s = XlL~/zto~~. F o r the proof, see Appendix. As done before for C 2, we can think of every pair of edges (X~,oJ") in C " as produced by a monotonic sequence of pairs (X"-~,oj,-~). In this case the rules ar e:
(1) x~ = h~ (X"-' + o~"-~), (2) a~" = ~t~,-1 + oJ"-I, (3) x ,,-~ = h . - ~ (X .-= + o.-~), (4) ~,g-' ---- (h "-~ + 1) (2t"-e + oJ"-~). Since the reasoning of Section 4 holds here, the last rule can be rewritten as (4') k~-' = (h "-~ - / z n / z "-~) (X"-2 + oJ"-z). Furthermore, let us remember that (5) k a = h~e ', (6) x ~ = (h' - ~ ) e ' ,
(7) ~ = c " . W e can now prove the following T H E O R E M 5.3. Given an (n + 1 ) -regular d.a. C", the projections along the x axis and the y axis of the oriented straight segment s = Zl'=~/~o~~ can be expressed by means of the corresponding projections of ~"(X " ~ + o~"-a). Indeed,
[~o~ #~']~
= [ ~ ' , ( x .-~ +
o~.-')]~,
~if ~?H and/x ~= + 1 , [~IL~/z~o~]u = [/~n(,X"-~ + o~"-x)]v + 1 [or A~D and/z ~ = - - 1 , [Xl~=~/z*o~]v = [/~n(X~-~ + o~"-~)]~
- -
[if ~.IH and/x 1 = --1, 1 [or k~D and/z ~ = + 1 ,
where H and D mean, respectively, that M is directed horizontally or diagonally. F o r the proof, see Appendix.
350
ARCELLI AND MASSAROTTI
According to this theorem we can express the coordinates of a point r a E N~, bearing maximum distance from [hbk,, as functions only of some parameters characterizing c a and C "-a (i.e,, tx",kn-',a} ~-~) rather than of parameters characterizing every C ~, 1 ~ i ~< n, such as the cot's. Let us consider the (n ÷ 1)-regular C"; this arc can be either potentially cv or pote.ntially c:~, depending on the type of potential curvature possessed by the pair (ka,oJ~). A necessary and sufficient condition, to determine whether it is nonstraight, is given by T H E O R E M 5.4. An (n ÷ 1)-regular d.a. C" is nonstraight iff the following holds: Ih'~ h~l+lh~-hnn_i[ ~>2. For the proof, see Appendix. As a consequence we can say: C O R O L L A R Y 5.1. An ( n + l)-regular d.a. has the chord property, i.e., is straight, iff Ihl~-- hnn[+ [h~ - hg_~[ < 2.
6. CONCLUDING REMARKS The adopted digitization scheme allows us to know exactly the state f(p) of every real point p E s~j, s~j E A. In this way we can verify whether, for all the real arcs r4~ corresponding to a digital arc, one of the following properties is true: (a)Vi, there is at least one point of T~ belonging to th¢ straight line segment with two points of ~ as extremes (convexity); (b)Vi, there is at least one point of belonging to a straight line segment with two points of qg~ as extremes (concavity). In an analogous way we could consider the following digitization scheme. s~j = 0 ~ s~ = 1 ~
Vp ~ stj, ~[p ~ s tj
f ( p ) = O, such t h a t f ( p ) = 1,
but in this case the contour should have been defined as an internal contour, i.e., C = {si~;sij E A , d ( s , j , A ) = 1}. In the preceding sections we have studied the structure possessed by the class of the regular digital arcs. If we represent such arcs as sequences of oriented straight line segments, then every (i + 1)-regular arc $'~ is obtained by means of a geometrical construction such that, for every (kq: 1)-monotonic go~ _C ge~,k ~< i, the potential curvature possessed by the pairs (kk,o~ k) of £,k coincides with that of one of the pairs (k',co 1) of g~'. When constructing g~k as a union of non-k-decidable arcs, we have assumed that neither golc nor any of its subarcs are k-decidable or trivial cases of (k + 1 )-decidability. These last cases, which are degenerate cases, have been discussed when we introduced the 2monotonic digital arcs in Section 3, by considering for instance an arc constituted by the sequence I, II. If we refer to Fig. 4, we see that the arc g'1 U g"~ can be expressed as a sequence of oriented straight line segments: h~c',c . . ,e . . ,n2c~", where both hl and h~ are assumed to be ~> 2. Since this sequence can be rewritten as a sequence of ( h i + l ) ordered pairs ( h ] c ' , e " ) ,
REGULAR ARCS IN DIGITAL CONTOURS
i ~I
351
4 1
FIo. 4. A degenerate 2-regular digital arc.
(0,c"), . . . , (0,e"), where 0 is the null vector, we see that the first three pairs constitute a 2-regular arc which does not satisfy the chord property (see Theorem 3.3). Analogous reasoning holds for an equally structured gek; in fact, k k t~, tf, hkt in this case the arc g'~ U g"~ can be expressed as hltt, 2 ,,k and afterward as ( h ~ , t~>, (t~, t~>, (0, t~}, . . . , (0, t~>. We have shown that the equivalence "straightness ~ chord property" holds for arcs of digital contours, in the sense that if the chord property is not verified in a connected subset C* of the digital contour, then all the real arcs, to which C* corresponds, are not straight. It is also interesting to notice that a regular digital arc has most of the structural features that Rosenfeld [6] has shown or conjectured the digitizations of straight lines must possess; particularly, such digitizations can be represented in an equivalent way by successive and more and more compact hierarchical descriptions. We have essentially used the concept of monotonicity to determine the structure of a regular arc; once given such a structure, it is easy to find that point r of the segment p'# bearing maximum distance from the arc. This point r, which can sometimes belong to the midpoint square considered by Hodes [9], has distance t>1 from the arc if and only if Ihl - hal + Ih, - hn-~] /> 2. In this way a single test allows one to decide about the straightness of a digital arc, while, if we use the chord property criterion, the number of tests should depend, for any pair p,q, on the number of suitable intermediate real points between p and q. On the other hand we must notice that, for a correct comparison of these two methods, we should also consider the computation involved in identifying the structure. In any case it is clear that the complexity of a picture property depends on the amount of computation required to detect it rather than on its formal definition. APPENDIX
Geometrical points will be represented by capital letters; in particular the barycenters of the first and the last digital element of the digital arc will be called P and Q, respectively. P R O O F 3.2. F o r space restrictions, the d.a.'s illustrated in the figures are such that the corresponding ga's have only eight edges. (i) /x 1 = - - 1 .
Since d.a. is 2-regular, for Proposition 3.4 it can be either potentially c~ or potentially cz: the two cases are shown in Figs. 5 and 6, orthogonal Cartesian system Oxy, respectively. Let g,1 = PABCDEFGQ and let D' and F' be the points in which the prolongations of the edges CD and EF meet the segment PQ. Let us call C ' , E ' the points in which ff-Q is intersected by the straight lines parallel to the y axis and passing through C,E.
352
ARCELLI AND MASSAROTTI 0'
Xr
E' r_.U---I 0
,Z,__o__,-E ,.,~____________L~__ _
P 0
A
_L
L
"c -
._"_./
M N
x
FIG. 5. A 2-regular arc which is potentially c., when referred to the system Oxy, and potentially c~, when referred to the system O'x'y'.
Triangles P L D ' and P N Q are similar, thus:
P L / ( L C + C--D') -----P-N/N--Q,
i.e.,
C-D' = PL (NQ/ff-N) - L"C.
Also, triangles P M F ' and P N Q are similar; hence:
P M / ( M E + E-ff') = P-N/N--Q,
i.e.,
E-if' -----PM ( N Q / P N ) - M-E.
L e t us assume in general that ~ and ~ correspond to k~ and Xk+2, 1 . then indicating by d~ and dk+l the lengths of C--C' and E E ' , it is easy to observe that
dk >>-dk+t,C:ff C--D'- E-ff' >i 0 ,¢:),( P--L- PM) ( N Q / P N ) - ( L C - M E ) ~ 0 ¢=>(x~=,lx~l ~+~ Ix,1l) (nlo, I/x't=~[xll) + Io.,~1 >~ o. ~,=, N o w let h~ = Ixll and h a = (Y:'?=lh~)/n; then dk I> dk+l '¢=> hk+a ~< h 1. x~
N__G. Q , (,/"
,
0
[ y,
'[/ P
o
~
FIG. 6. A 2-regular arc which is potentially c~, when referred to the system Oxy, and potentially c,,, when referred to the system O'x'y'.
R E G U L A R ARCS I N D I G I T A L
353
CONTOURS
Since the 2-monotonicity is nonincreasing and the transitive property holds, if hk+a ~< h x there results
dk ~ d~,
k-t- l <~j <- n.
Such a dk is maximum if and only if hk ~ ~1. N o t i c e that, since the digital arc can be non-strictly monotonic, we have
dk = dk+l . . . . .
dk,~
iff
h i + , = hk+2 . . . . .
hk+, = h 1.
H e n c e more than one point of 71, bearing maximum distance from P--Q, can exist. (ii) /~1 =
.qL1.
W e refer now to Figs. 5 and 6, orthogonal Cartesian system O'x'y'. We h a v e ~ = Q G F E D C B A P and points C ' , D ' , E ' , F ' , are determined as in (i). Since the same arguments as before hold here, we have
£--~' 1> U-C'C=>E-P' - U B ' ~ 0. I f w e assume that E D corresponds to the edge kk and CB to kk+l, there results
dk >t dk+l~z:~h}, >1 h ~. H e n c e , if hl >t ill, b y the transitive property we have
d~dj,
k+I
<~j<-n.
Such a die is maximum iff h~-i ~< h 1. Also, when/z 1 = + 1 , the digital arc can be non-strictly monotonic; then: dk = dk+~ . . . . .
dk+~
iff
h~ = h~+l ~ . . . .
h[.+~= h ~
and more than one point of ~'~, bearing maximum distance from PQ, can exist. Q.E.D. P R O O F 3.3. T h e point R ~ E N~, bearing maximum distance from fi-0Q, is placed in a position/z1¢o ~ far from the point/~, which is the second extreme o f the tth pair ( t = k ff/z 1 = - - 1 , t = k 1 i f / z a = + l ) . If we set the origin o f the coordinates at the first extreme P of 8 "1 and recall that the arc is situated in the first octant, then the coordinates of R 1 and of its projection R on P--QQare given by R~ = R x + ~1,o~1 = z I o ~ l ~ l + tivoli + ~11,o~1, R~ = Ru 4-/.dlo]~ I - ~,=dX,~l + Rx = R~, n
1
1
n
~1
F r o m the definitions both of concavity and of convexity, we know that C ~ is nonstraight iff IR~ - R~] >t 1.
I. C~ is c ~ : ~ ( R u -
R~) >. 1.
If we set k) = h~ q' and o 1 = c " (where e',e" are Freeman's codes) and call c'~,c'~,C"x,c"~ the moduli of c~,c~,cz ' ' " ,c u" , then we can explicitly write the inequality as follows:
354
ARCELLI
!
[ c ~t t =t l h t + (t + /z)c~']
AND
MASSAROTTI
n
t t [c~Y.t=~h~ + nc'~'] [cxY'i=lh~' " + nc 'qxJ - - [cuY.i=lh~ + (t + / x ) c ; ' ]
>~ 1.
N o t i c e that, since no confusion can arise, we h a v e omitted the apices 1 in h? and /z 1. By developing the relation above, we obtain I
I?
I
II
?
Tl
II
( c , c x -- czc~ ) [ ( t ÷ tz)Y.I~lht -- n~,~=lh~] >>- c x X , f l h i + nc~ (i) 13,1 = --l,
(1)
t = k.
B y Proposition 3.4, k~ is horizontally oriented and as a c o n s e q u e n c e ¢o ~ is diagonally oriented; then ! c= = l,
el!
c ~! = O ,
%l ! = 1.
= = 1,
L e t us substitute in (1): - [ ( k - 1)~7=~h~- n~;~=lh~] I> ~:~h~ + n. (n -- k)(~;~ffilh~- kF, t~k+lhl ~ n.
(2)
This relation can be written as follows. ( h ~ - h~+x) + ( h ~ - hk+2) + • ' • + (h~-- ha) + ,
•
.
•
,
,
.
(h~ .
.
.
.
h~+~) + (h~ .
.
.
,
•
°
*
h,,+~) + •
•
.
,
• • •+ .
.
.
.
.
(h~ -
.
°
h,) •
°
.
(3) .
.
.
.
.
,
,
•
+ (hk -- hk+~) + (hie -- h/~+2) + ' " ' q- (hlc - h~) ~> n. Since R ~ belongs to the k'th pair a n d / z ~ = - 1 , from T h e o r e m 3.2 there results h~ > h, h ~ h~÷l, hence hk > hk+i. N o t i c e that, since we have c o n s i d e r e d R ~ as the first point ( e n c o u n t e r e d running along ~ clockwise) with m a x i m u m distance d from P Q , in the case hk = h = hk+~ it would mean that all the edges k1 o f ~ have the same length and (3) is n e v e r satisfied, i.e., C ~ is not co. Disregarding this case, every t e r m of the first m e m b e r of (3) is > 0. T h e n t w o possibilities can occur: (a) (h~ - h~) : - ~.
From (3) we (n-k--1)-11>
obtain k ( n - k) - n >I O, 0, a n d t h i s i s t r u e i f f l < k < n - l ,
or
equivalently, wheren>~4.
(k-
1)
(b) (h~-- h,) ~> 2. F r o m (3) we obtain k ( n - k ) + 1 - n >I 0 h e n c e ( k this is always true for arty value o f k < n. ( i i ) / z I = + 1,
t = k -
1)(n- k-
l) >~ 0, and
1.
By Proposition 3.4, k~ is diagonally oriented; then c'~ = 1,
c~' = 1 ,
cz" = 1,
c~" = 0.
L e t us substitute in (1): (k - 1)Z~=~h~ - n~-_-~ ht t> n, (k - 1):~}~h~ - (n - k + 1)~l'___-~h~~> n.
(4)
355
REGULAR ARCS IN DIGITAL CONTOURS (h~ - ~
h~) + • • . + ( h k hk-i) + (h~+~ - h~) + (h~+~ - h~) + . .
h~) + .
.
.
.
(h~ .
.
.
.
.
.
.
,
.
.
.
.
.
.
°
,
.
.
.
• + (hk+~ -- hk-~) .
.
.
o
°
.
+ (h.--ha)+(hn--h2)+"
•
.
,
°
(5) .
,
•
.
' "+(h.-hk-a)
.
•
°
~>n.
Since R 1 belongs to the kth pair a n d / z 1 = + l , from T h e o r e m 3.2 there results hk >~ h > hk-~. Also, if hk = h = hk-1, we can repeat the considerations of (i) above and conclude that C 1 is never c.. By disregarding this last case, we conclude that every term of the first member is > 0. Two possibilities can occur: (c) ( h a - h~) = 1.
F r o m (5) we obtain ( n - k + 1 ) ( k - 1 ) - n i> 0, hence ( n - k ) ( k - 2 ) - 1 ~ 0, and this is true iff 2 < k < n, where n ~> 4. (d) ( h n - ha) >~ 2. F r o m (5) we obtain ( n - - k + D ( k - 1 ) - n + 1 >I 0, hence ( n - k ) ( k - 2) ~ 0, and this is true for any value o f k > 1. Summarizing (i) and (ii) we can say that c ~ i s cv
<=:> Ihl -
h~l +
Ihl -
h~-il >t 2.
II. Consider now the case of convexity. C 1 is c~ ~:> (R~ -- R~) >I 1. If we develop the inequality as done in I, we obtain --
(~C t
~
C xI I
(i) /z ~ = - - 1 ,
--
' " ) [(t + ~)E~=lh~ c,~cu
-
-
' n t, n2~=lhi] ~> czE~=lh~ + ncx.
t = k.
By Proposition 3.4, kl is diagonal; then c'~ = 1,
%' = 1,
cz" = 1,
c~" = 0.
Substituting in (6), we have nE~klht - kET=ih~ >- n. This relation coincides with (2), hence it is satisfied iff Iha - h.I + I h 2 -
(ii) /za = +1,
h.-al ~> 2.
t = k - 1.
B y Proposition 3.4, ~ is horizontal; then c' = 1
'-0,
c"=l
"=1.
Substituting in (6) we have (k-
1 ) ~ = ~ h i - n~,~-_-~h~ >~ n.
This relation coincides with (4), hence it is satisfied iff Iha - h.I + Ih~ - h.-il ~ 2.
(6)
356
ARCELLI
AND
MASSAROTTI
In conclusion, according to what has been shown in I, II, we can say that C 1 is nonstraight ¢ = > l h l - h~J + I h l - h~-ll >I 2
Q.E.D.
P R O O F 5.2. F r o m Theorem 5.1 we know that a point R n E 8an, bearing maximum distance d from PQ, belongs to the kth pair of C n and is reached by moving in a path /xn~ n, starting from the second extreme of the kth pair if / ~ = = - 1 or of the ( k - 1)th pair if # ' l = +1. On the other hand, by construction the point R n belongs also to the polygon 6~ - 1 , where it is the vertex of an interior angle > ~-. We show now that the point R n-l, reached from R ~ by moving in a path/~n-~ton-~ on 5 an-~, is such that d(R n-i, PQ) >I d(Zn-~,PQ), where Z n-~ is any vertex o f ~ ~-1 (in particular R ") . Let us assume t h a t / ~ = - 1 , i.e., the order is (X~,to~); analogous arguments will hold for/~n = +1. We discuss the two cases corresponding to the values of ~.L~z-1"
(i) ~,~-1 = - 1 . Let us refer to Fig. 7, where the kth pair (k~,to '~) is illustrated together with a part of the segment PQ. The point R " is shown as well as the monotonic sequence 8~-1 by which the kth pair of 8~'~ is derived. H and K are the points in which the prolongations of the segments R'*R"-~ and ~ meet P---Q, while A,B,C,D are the points where P--0Qis intersected by the lines parallel to the y axis and passing through R n-~, Rn,C*,D *. The indication of the spanning of k ~k,ta'~,kn-~,,~"~-~,ta n-~ is also given. Let us observe now that in the trapezium ARn-~RnB we have A-R-~-=r > B-'-R-~;moreover, the triangles ARn-~H and C C * K are similar. Then A R n - I [ - ' C - - ' ~ -----Rn-~H/C*K = ( ~ +
R'ZH)/(C*D * + D ' K ) .
(7)
Also the triangles B R nH and DD *K are similar; then B R a/DD * = R nH/D *K.
Since D * ~ ~n and R " is the point of ~ " bearing maximum distance from P--QQ,it follows that B R " > DD * ~ R n H > D *K. Substituting in (7) and recalling that R"-~R" = ~ = Ja, n-~ I , there results A R n-1 > CC* K
i/'!
't
0
i
X~
i
k
.
i i
to
./
n
i FI~. 7. Part of an (n + 1)-regular arc with ~,~-1= - 1 .
REGULAR
ARCS IN
DIGITAL
CONTOURS
357
c
/ /
~
i
n4 n
i
, n-i
i
n
!
F~O. 8. Part of an (n + l ) - r e g u l a r arc w i t h / z "-~ = + 1 .
(ii) /,n-1 = + 1 . Let us refer to Fig. 8. We can repeat here the considerations in (i) and we obtain finally that AR- - ~ > C-C--~. Summarizing in both Cases (i) and (ii), the point R "-1 is reached from R" by moving along ~ in a path/z"-~o "-~. The R "-~ so found is the point of g"-~" bearing maximum distance from P---QQand moreover such a point belongs also to g"-~ where it is a vertex of an interior angle >re. Consider now the vertices of g"-= which lie near and in opposite positions with respect to R '~-*, Then we have a geometrical structure which is identical to that shown before in (i) or in (ii) and, if we move in a path/z"-'-a~ "-2 along ~ starting from R --1, we reach the point R n-2 such that d(R "-2, ~ ) >- d(Z"-S,~Q), where Z ~-2 is any vertex of g"-=. Since the same geometrical considerations hold equally for the pairs (~---¢-~,~'~;-~), (g,-3,g~-4), . . . , (g~,gl), we finally find that the point R 1 E ~ , bearing maximum distance from PQ, is reached starting from the second extreme of the kth (or ( k - 1 ) t h ) pair and by moving along ~-~,g--~, . . . ,g~,gi successively for a path equal to £~'=~/,~o~~. Q.E.D. P R O O F 5.3. Let us compare the two oriented straight segments. We will transform every member by applying the production rules and will simplify them by erasing equal segments.
Z~-~ ~.~m~+
~.rx,,-i -4- m.-~) + -
(X
+
~"(X "-I + m "-~)
+
+ e"-=),
- / z " - l ( k "-2 + (o "-2) + / * " - l o J " - I + E~=~/zko ~ + O, __/An-l(kn-2 .oF o.)n-2) -~ / j n - l ( ~ . ~ - 2 qL o,) n--2 ) -~ E T..~I2 tA tO) t -4-0,
--t.'~-~/z"-~lz"-2(k"-3 + oJ .-3) + tz.-2o~,,-~ + £~_~3 tzk~ ~+ O, ,
,
.
,
,
-
-
.
,
,
.
°
.
,
,
.
,
,
,
.
,
.
.
,
.
.
.
.
.
,
.
~a/zap,2(kl -Jr- ¢o 1) q- / z 2 ( k 1 q- ¢-o~) -b /z*a~ 1 -- O, - ~=(X 1 - ~.~) +/z*a~ 1 + 0, - - / i i c ' -t- /llC '' -- O.
C o n s i d e r n o w t h e p r o j e c t i o n s a l o n g the x and y axes:
,
o
°
,
,
,
o
.
.
.
.
358
ARCELLI
AND
MASSAROTTI
E - ~ l e ' + ~ l e " ] x + [0Ix,
(8)
EO]~.
(9)
E-~lc ' + ~c"]~
-
Since in (8) and (9) the segments are oriented along the same directions, the comparisons can be equivalently performed by considering their moduli. While it is clear that in (8) the equality always holds, relation (9) must be specified according to both the value o f / ~ and to the direction of c'. In fact, (a) (b) (c) (d)
if/z 1 = + 1 , then (9) becomes [--c' + e"]~ + [0],j; if/z ~ = - 1 , then (9) becomes [ e ' - e " ] ~ + Eo]~; if c' is horizontal, then cv' - - 0, c~" = 1 ; if c' is diagonal, then c~---- 1, c~' = 0.
It is now easy to observe that from (8), (9), and (a)-(d) the theorem is proved. Q.E.D. P R O O F 5.4. Let us set the origin of the coordinates at the first extreme P of -~a. Then we know from Theorems 5.2 and 5.3 the coordinates o f R 1 ~ ~ and can determine those of its projection R on P'--Q. If we call k the second extreme of the tth pair (t = k if/z ~ = - 1, t = k - 1 if/z '~ = + 1) then such coordinates are ,
R:~ = R~, Ru=Rx(X~kallqnu] +
,,
tlco~l +
rt ]o~ n~])/( ]~nt=~l~[ n
+ nloJ~l)
From the definitions both of concavity and of convexity, we know that C" is nonstraight iff IRu -- R~[ ~> 1. I. C" is c, ,(::::>(Ru- R~) >~ 1. Since by construction C" is regular as well as all the monotonic sequences by which it is built up and, moreover, all such sequences have the same type of potential curvature as C a, it is easy to see that the (n + D-regular C" is Cv only if ( a ) / ~ = +1 and k 1 is diagonally oriented, or (b)/z t = - 1 and k ~ is horizontally oriented. As a consequence in the expression of R 1 the last term is equal to (-1) and C" is
c~,¢:~,R~-- (k~+/z"([X~-l]
+ [o~-x[
~> O.
If we now write ~ in terms o f / t "-~ and oJ"-a, i.e.,
XI' = hl~(X"-~ + a~"-a), and set
the inequality becomes
+ n 4'~) -- (~b~Y~[=lh~ + tqba +/zn~bz) ~> O. t~-~ ~ Z~~=~h"~ + t~bs +/z"~ba) (4~2X~=ah~ ,~ By simplifying we obtain:
(q~N,, - ~b~4~) (nX[=~ h'~ - tX?~ahp + ~ " n ) >~ O.
359
REGULAR ARCS IN DIGITAL CONTOURS
(i) ~n = - 1 ,
t = k.
Since in this case the o r d e r o f the pair is (k",co n) and C n, situated in the first octant, is potential c~, w e see that the angle made b y con with the x axis is greater than the c o r r e s p o n d i n g angle m a d e by 2q~. T h e n ~4/C]~ 3 ~" (~2/(~1,
i.e.,
~bl~b4- - (~2(])3 • 0,
W e can n o w say t h a t C n is c, iff
(k-
1)E'~=lh?- --~=1~x'~-lz'n,~>t n,
and this is true (see (2) in P r o o f 3.3) for ]h~~ - h~[ + ] h ~ - ~_~[ I> 2. (ii) /z n = + 1,
t = k -
1.
T h e o r d e r of the pair is now (con,kn) ; hence we have 4~2/q5~ > ~b4/~b3,
i.e.,
~b~b4 -- ~2~b < 0.
T h e n C n is c~, iff (k - 1)EI~=lh~ - n~.~hV~ >~ n, and this is true (see (4) in P r o o f 3.3) for Ih~~ - h~l + h g - h~-~l I> 2. II. C" is cz ¢:~
(R~
-- R~)
~> 1.
B y repeating the s a m e considerations as in I, we can say that C n is c~: only ff (a) /z ~ = +1 and k j is horizontally oriented, or (b) /z ~ = - 1 and k ~ is diagonally oriented. T h e n the last term in the expression of R~ is equal to (+1) and C n is cx ¢ : : > / ~ +/,Ln([k~-l[ "Jr-160~-11) - - R u ~> 0. Since the inequality is identical to the one given in I, except for the factor ( - 1 ) which multiplies the first m e m b e r , it can be written as follows. -- (qS~qS,-- q52qS~)(nE~=~h~z - t~r~=~h~+ I~nn) ~ O. (i) /z n = - - 1 , t = k. T h e order of the p a i r is (Xn,con), while C n is potentially c~; then ~b2/~b~ > ~b,/~b3,
i.e.,
~b~qS,- ~ b ~ < 0.
H e n c e C n is cx ,(==>(n-k)E~=~h?--kX~+~h? >>-n, I h ~ - hg I + [h'~- hg-~l ~ 2. (ii) /z ~ = + 1,
t = k -
and
this
is
true
for
this
is true
for
1.
T h e order o f the p a i r is (co",h n) ; then qS~/~b~ < ~b4/qS~,
i.e.,
~b~b4- ~b~qSa > 0.
H e n c e C n is c~ ~ (k-1)E'~=~hn-ny,,~-_--?h n >i n, I h T - hg[ + [ h g - hg-xl ~> 2.
and
In conclusion we c a n say that C" is nonstraight <=:> [ h 7 - hg[ + [ h g - hg_~[ ~> 2.
Q.E.D.
360
ACKNOWLEDGMENTS The authors wish to thank Mrs. A. M. Hilliard and Mr, U. Cascini for the great help given in the preparation of the manuscript and of the illustrations.
REFERENCES 1. F. Attneave and M. D. Amoult, The quantitative study of shape and pattern perception, Psychol. Bull. 53, 1956, 452-471. 2. A. L. Yarbus, Eye Movements and Vision, Plenum Press, New York, 1967. 3. R. A. Rankin, An Introduction to Mathematical Analysis, Pergamon Press, London, 1963. 4. M. Minsky and S. Papert, Perceptrons: An Introduction to Computational Geometry, MIT Press, Cambridge, Mass., 1969. 5. C. Arcelli and L. Cordelia, Concavity point detection by iterative arrays, Computer Graphics Image Processing 3, 1974, 34-47. 6. A. Rosenfeld, Convex digital arcs, Computer Science Center, University of Maryland, TR-251, 1973, also in 1EEE Trans. Computers C.23, 1974, 1264-1269. 7. A. Rosenfeld, Arcs and curves in digital pictures, J. Assoc. Comput. Mach. 20, 1973, 81-87. 8. H. Freeman, Computer processing of line-drawing images, Computing Surveys 6, 1974, 57-97. 9. L. Hodes, Discrete approximation of continuous convex blobs, SIAM J. Appl. Math. 19, 1970, 477-485.