connect-the-dots: a new heuristic

9
COMPUTER VISION, GRAPHICS, AND IMAGE PROCESSING 39, 258-266 (1987) NOTE Connect-the-Dots: A New Heuristic JOSEPH O'ROURKE, HEATHER BOOTH, AND RICHARD WASHINGTON Department of Computer Science, Johns Hopkins University, Baltimore, Maryland 21218 Received July 24, 1984; accepted August 5, 1986 The problem considered in this paper is that of finding a simple polygon through a given set of points in the plane that is "natural" in some perceptual sense. We propose that a particular geometric object called the minimal spanning Voronoi tree captures the essence of the problem. Despite the fact that we can neither prove the existence of this geometric object nor design an exact algorithm for finding it, a search heuristic results in remarkably pleasing solutions to the problem. © 1987 Academic Press, Inc. 1. INTRODUCTION We consider a problem that is usually a simple task for humans: Given a set of points in the plane, find a "natural" simple polygon that has these (and only these) points as vertices--in short, "connect-the-dots." We will make no attempt to quantify the naturalness of a solution, but rather choose examples where there is a fairly clear best choice. Many schemes have been considered for connecting patterns of points into perceptually justified chains: minimal spanning trees [14], the relative neighborhood graph [12], the Gabriel graph [12], the sphere of influence graph [2], and so on [1, 6, 10, 12, 13]. But, as far as we are aware, ours is the first attempt under the condition that the result must be a simple polygon: one without self-intersection, without holes, and bounding a single connected region. This condition could easily arise in practice, where, say, a vision system extracts boundary points around a machine part and an internal model of the part needs to be constructed. The simple polygon constraint makes the problem quite distinct from others previously considered. For example, all the above perceptual-adjacency graphs are constructed according to some type of nearest-neighbor criteria. Connecting points solely on the basis of local nearest neighbors is doomed to fail for our problem, however, because there is no way to ensure that the constructed path will both close and touch all the points. The method we will describe mixes local nearness with global coverage and simplicity constraints. 2. MINIMAL SPANNING VORONOI TREES Let there be given n distinct points in the plane. These determine (2) distinct edges, which together form the complete graph on n nodes. A simple polygon of n vertices has n edges. So the task is to choose n edges from the (~) to satisfy our 258 0734-189X/87 $3.00 Copyright © 1987 by Academic Press, Inc. All rights of reproduction in any form reserved.

Upload: joseph-orourke

Post on 04-Jul-2016

223 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Connect-the-dots: A new heuristic

COMPUTER VISION, GRAPHICS, AND IMAGE PROCESSING 39, 258-266 (1987)

NOTE

Connect-the-Dots: A New Heuristic

JOSEPH O'ROURKE, HEATHER BOOTH, AND RICHARD WASHINGTON

Department of Computer Science, Johns Hopkins University, Baltimore, Maryland 21218

Received July 24, 1984; accepted August 5, 1986

The problem considered in this paper is that of finding a simple polygon through a given set of points in the plane that is "natural" in some perceptual sense. We propose that a particular geometric object called the minimal spanning Voronoi tree captures the essence of the problem. Despite the fact that we can neither prove the existence of this geometric object nor design an exact algorithm for finding it, a search heuristic results in remarkably pleasing solutions to the problem. © 1987 Academic Press, Inc.

1. INTRODUCTION

We consider a problem that is usually a simple task for humans: Given a set of points in the plane, find a "natural" simple polygon that has these (and only these) points as vertices--in short, "connect-the-dots." We will make no attempt to quantify the naturalness of a solution, but rather choose examples where there is a fairly clear best choice.

Many schemes have been considered for connecting patterns of points into perceptually justified chains: minimal spanning trees [14], the relative neighborhood graph [12], the Gabriel graph [12], the sphere of influence graph [2], and so on [1, 6, 10, 12, 13]. But, as far as we are aware, ours is the first attempt under the condition that the result must be a simple polygon: one without self-intersection, without holes, and bounding a single connected region. This condition could easily arise in practice, where, say, a vision system extracts boundary points around a machine part and an internal model of the part needs to be constructed.

The simple polygon constraint makes the problem quite distinct from others previously considered. For example, all the above perceptual-adjacency graphs are constructed according to some type of nearest-neighbor criteria. Connecting points solely on the basis of local nearest neighbors is doomed to fail for our problem, however, because there is no way to ensure that the constructed path will both close and touch all the points. The method we will describe mixes local nearness with global coverage and simplicity constraints.

2. MINIMAL SPANNING VORONOI TREES

Let there be given n distinct points in the plane. These determine (2) distinct edges, which together form the complete graph on n nodes. A simple polygon of n vertices has n edges. So the task is to choose n edges from the (~) to satisfy our

258

0734-189X/87 $3.00 Copyright © 1987 by Academic Press, Inc. All rights of reproduction in any form reserved.

Page 2: Connect-the-dots: A new heuristic

CONNECT THE DOTS: A NEW HEURISTIC 259

problem. A brute force search, which would cost

( ( ! ) ) = o ( . . ) ,

is clearly out of the question. We first reduce our search space from the complete graph to the Delannay

triangulation of the set of points (as suggested, e.g., in [A]), which has only O(n) edges. The Delaunay triangulation is the dual graph of the Voronoi diagram. The Voronoi diagram partitions the plane into regions (Voronoi polygons), one for each point of the original set Pi, whose interior points are closer to pi than to any other pj, j :~ i. The Voronoi diagram and Delaunay triangulation can be computed in O(nlog n) time; see [11,12, or 4] for a discussion of their properties. We only need the most basic properties here: the Delaunay triangulation is a planar graph, indeed a triangulation, with at most 3n-6 edges, and Delannay neighbors are "near" in the sense that their Voronoi polygons share an edge. Restricting the search to the Delaunay triangulation is how we employ local nearness. Note, however, that naive search is still not feasible, since (3,~6) = 0(3").

Now our problem is to find a natural simple polygon embedded as a subgraph within the Delaunay triangulation. Such a polygonal path must touch each and every vertex just once, and so, in graph theory terminology, it is a Hamiltonian cycle [5]. The crucial question then arises: does every Delannay triangulation admit a Hamiltonian cycle? This question has remained open since Shamos first posed a variant of it in his thesis [11]. It is known that certain degenerate Delaunay triangulation (those that arise from sets containing four cocircular points) may not have Hamiltonian cycles [7], but the question remains open for points in "general position," our main concern here. Despite the fact that we cannot prove that the object we are looking for exists, we have never encountered a non-degenerate case where it does not, so the open question does not greatly hamper the practicality of our heuristic.

We now turn to the issue of closure. It seems very difficult to use the standard boundary extraction approach [1] of growing an open path, and then forcing it to close just after it touches the last point; this method is more appropriate when holes and multiple pieces are permitted. Accordingly, we propose to build the polygon in such a way that at each stage of the algorithm, we have a simple polygon, but one which does not yet touch every point. We do this by agglomerating triangle faces from the Delaunay triangulation. Starting with two adjacent triangles, triangles are added to the boundary of the current polygon so that it remains simple. This process is repeated until every point of the set is part of the polygon's boundary, or a cul-de-sac is reached (more on this latter possibility in the following section).

There are still far too many choices for a search. How can we ensure that the result is "natural"? The crucial observation is that every collection of Delaunay triangles forming a simple polygon can be associated with a tree in the Voronoi diagram. Each Voronoi point (a vertex of the Voronoi diagram) is the circumcenter of a Delaunay triangle. Two adjacent Delaunay triangles correspond then to an edge of the Voronoi diagram. Since the dual of any triangulation of a simple polygon is a tree, each polygon corresponds to a tree in the Voronoi diagram.

Thus we see that the constraint that our polygon be simple translates into the constraint that we only consider trees in the Voronoi diagram (this is not quite

Page 3: Connect-the-dots: A new heuristic

260 O'ROURKE, BOOTH, AND WASHINGTON

accurate, and will be amended in the next section). The constraint that the polygon touch every point can be captured by only considering spanning trees. Normally a spanning tree is defined as one that touches every point in a set, but here the points spanned are in the dual graph rather than in the original.

The final condition to be met is that the polygon be "natural." We propose that this constraint can be captured by choosing the shortest or minimal spanning Voronoi tree. t Our reasoning is as follows. The medial or symmetric axis is a well-known perceptual central "skeleton" for a polygon [3]. The Voronoi diagram is a type of skeleton for a set of discrete points. In fact, the concept of Voronoi diagram can be extended to line segments, paths, and polygons [8]. The Voronoi diagram of a polygon is the symmetric axis of the polygon with a few extra edges at reflex vertices [9]. A spanning Voronoi tree is an approximation to the Voronoi diagram of the polygon it represents. A "natural" polygon is one with a short Voronoi tree and, therefore, a short Voronoi diagram and, therefore, a short symmetric axis; and a short symmetric axis is the most concise "explanation" for the original point set. These claims can only be justified by empirical data.

3. HEURISTIC SEARCH FOR MINIMAL SPANNING VORONOI TREES

The discussion of the preceding section leads to the following definition: a minimal spanning Voronoi tree for a set of points is a shortest subgraph of the Voronoi diagram of the set whose corresponding collection of Delaunay triangles form the triangulation of a simple polygon that spans every point of the set. We have not been able to design an algorithm for finding this object exactly. However, we have found that a greedy growth-from-seed approach that approximates it works remarkably well as long as all possible seeds are tried. The growth algorithm is as follows.

function grow_tree (seed: Voronoi edge); begin

Tree ~ seed; while growth still possible do begin

Select the shortest edge e that (1) touches Tree, and (2) whose addition to Tree maintains the simplicity

of the implied polygon. (if no such e exists then growth is no longer possible) Tree ~ Tree + e

end; return Tree

end

The check for polygon simplicity (condition (2) above) must not only ensure that no cycle is created in Tree, but also that two Delaunay triangles do not touch at a single vertex, which violates simplicity but does not create a cycle.

1This proposal is related in spirit to Zahn's use of "minimal spanning tree skeletons" [14] but differs considerably in detail.

Page 4: Connect-the-dots: A new heuristic

CONNECT THE DOTS: A NEW HEURISTIC 261

We found that this procedure can get locked into a poor tree with an unlucky seed, but that trying every seed works quite well:

(Heuristic search}

Compute the Voronoi diagram and Delaunay triangulation of the set of points. for each edge e of the Voronoi diagram do begin

Tree ~ grow_tree (e); if Tree is spanning and shortest so far then save.

end; return shortest Tree

i / /

/

), /

FIGURE 1

Page 5: Connect-the-dots: A new heuristic

262 O'ROURKE, BOOTH, AND WASHINGTON

The worst-case time complexity of this search is O(n3): grow_tree could cost O(n2), as O(n) edges are added, and finding the next one to add could cost O(n); finally, grow_tree is called O(n)times. However, finding a new edge in grow_tree seems to require only a constant effort in practice, so the algorithm performs at a complexity closer to O(n2).

We now turn to some examples of the heuristic's performance. Figures 1-5 illustrate the algorithm operating on five different examples. For each example the point set is shown alone in the (a) part. The (b) part displays the Delaunay triangulation (solid), the bounded edges of the Voronoi diagram (dotted), and the shortest Voronoi tree (dashed). Note that the unbounded Voronoi edges can be ignored, since they will never be included in a shortest tree. The (c) part shows the simple polygon (solid) corresponding to the minimal spanning voronoi tree (dashed), as well as the associated Delaunay triangulation (dotted).

The points in Fig. 1 have no obvious perceptual pattern, and the algorithm produces a reasonable result. The uncluttered nature of this example allows the relationships between the various graphs and trees to be clearly discerned. The example of Fig. 2 presents a problem to any algorithm that requires a single polygon as output, as it is perceptually two disconnected pieces. The algorithm produces the

D

a

0

a

O 0

0 D

D ~

D

D

\ \

\ \ \

" ' " f i " ' ,

f l

FIGURE 2

Page 6: Connect-the-dots: A new heuristic

C O N N E C T THE DOTS: A N E W HEURISTIC 263

~ o

o ~

o

o o

o

e

a ~ o

o

o o

o

- . , - 7 . . -C? -~ , . . /

" ~ i " > " ~>~

FIGURE 3

"thinnest" bridge possible between the two pieces. Figure 3 is a chromosome-like shape with clear boundary definition. The algorithm finds the most natural solution. Note the similarity between the minimal spanning Voronoi tree and the symmetric axis of the shape.

Before settling on the algorithm presented in this paper, we explored algorithms that started with the convex hull of the point set, and then "shrank" the hull to include the internal points. Figures 4 and 5 are examples of shapes that are difficult for shrinking heuristics to handle well (especially Fig. 5), as a large portion of the polygon's boundary lies within the hull. Our algorithm works well in both cases; again, note the similarity between the shortest trees (dashed) and the symmetric axes of the shapes.

It is possible for our algorithm to reach a cul-de-sac from which it cannot add any edge without producing a non-simple polygon. Thus certain seeds may not lead to

Page 7: Connect-the-dots: A new heuristic

264 O'ROURKE, BOOTH, AND WASHINGTON

D o . .

o

o o a

o

D

o z

o 0 o

o

" o o

o o . n t~

o o a o a

FIGURE 4

spanning trees. We could not find an example, however, where every seed leads to a cul-de-sac, although we suspect that this could happen for some specific point set.

4. DISCUSSION

One of the attractions of the proposed method is that it can be directly extended to three (or higher) dimensions. The notions of Voronoi diagram generalizes naturally and methods for its computation have been studied [4]. The dual of a three-dimensional Voronoi diagram is a Delaunay tetrahedralization. Tetrahedra can be accumulated into a tree structure just as triangles were in two dimensions, and again, the minimal spanning Voronoi tree seems to be a reasonable candidate for defining "' natural" polyhedra.

Finally, we reiterate the open theoretical questions raised by this work:

(1) Does every Delaunay triangulation admit a Hamiltonian cycle? The three- dimensional equivalent is: Does every Delaunay tetrahedralization admit a "Ham-

Page 8: Connect-the-dots: A new heuristic

CONNECT THE DOTS: A NEW HEURISTIC 265

o

u

D

..." . - "

. . - ' ..

. J . .

. s " i. . ' ' ' ' ' '~ "'""

FIGURE 5

i l tonian s p h e r e " - - a col lect ion of triangle faces forming a closed surface of genus zero?

(2) D o e s there exist an efficient algorithm for finding m i n i m a l s p a n n i n g V o r o n o i trees?

Note added in proof Michael Dillencourt found a non-degenerate, non-Hamiltonian Delaunay tri- angulation, answering (1) negatively. His example is 2-connected, and the problem remains open for 3-connected Delaunay triangulations.

REFERENCES 1. N. Ahuja, Dot pattern processing using Voronoi neighborhoods, IEEE Trans. Pattern Anal. Math.

Intell. PAMI-4, 1982, 336-343. 2. D. Avis and J. Horton, Remarks on the Sphere of Influence Graph, McGill University Technical

Report, 1983.

Page 9: Connect-the-dots: A new heuristic

266 O'ROURKE, BOOTH, AND WASHINGTON

3. H. Btum, A transformation for extracting new descriptors of shape, in Syrup. Models for Perception of Speech and Visual Form (W. Whaten-Dunn, Ed.) MIT Press, Cambridge, MA, pp. 362-380, 1967.

4. A. Bowyer, Computing Dirichlet tessellations, Comput. J. 24. 1981, 162-166 5. J. A. Bondy and U. S. R. Murty, Graph Theory with Applications, Elsevier, New York, 1976. 6. J. Fairfield, Countoured shape generation: Forms that people see in dot patterns, in Proceedings,

IEEE Conf. Systems, Man, and Cybernetics, 1979, pp. 60-64 7. V. Kantabutra, Traveling salesman cycles are not always subgraphs of Voronoi duals, Info. Process.

Lett. 16, 1983, 11-12. 8. D. G. Kirkpatrick, Efficient computation of continuous skeletons, in Proceedings, 20th Symp. on

Foundations of Comput. Sci., Puerto Rico, Oct. 1979, pp. 18-27. 9. D. T. Lee, Medial axis transformation of a planar shape, IEEE Trans. Pattern Anal. and Mach.

lntell., PAMI-4, 1982, 363-369. 10. J. F. O'Callaghan, Computing the perceptual boundaries of dot patterns, Comput. Graphics Image

Process. 3, 1974, 141-162. 11. M. J. Shamos, Computational Geometry, Ph.D. thesis, Yale, 1978. 12. G. T. Toussaint, Pattern recognition and geometric complexity, in Proceedings, 5th Int. Conf. on

Pattern Recognition, Miami Beach, Dec. 1980, pp. 1324-1347. 13. G. T. Toussaint, Computational geometric problems in pattern recognition, in Pattern Recognition

Theory and Applications (J. Kitfler, Ed.), NATO Advanced Study Institute, Oxford University, 1981.

14. C. T. Zahn, Graph-theoretical methods for detecting and describing gestalt clusters, IEEE Trans. Comput. C-20, 1971, 68-86.