Revised version, February 1991, appeared in Information Processing Letters 38 (1991), 123{127 COMPUTING THE MINIMUM HAUSDORFF DISTANCE BETWEEN

Similar documents
An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem

On the Union of Fat Wedges and. Separating a Collection of Segments by a Line. Abstract

On the Complexity of Interval-Based Constraint. Networks. September 19, Abstract

Figure 1: A set of line segments and its critical sequence. as a critical segment. An extreme line is critical extreme if it passes through at least t

Optimum Alphabetic Binary Trees T. C. Hu and J. D. Morgenthaler Department of Computer Science and Engineering, School of Engineering, University of C

6. Concluding Remarks

Packing Two Disks into a Polygonal Environment

A technique for adding range restrictions to. August 30, Abstract. In a generalized searching problem, a set S of n colored geometric objects

Lower Bounds for Insertion Methods for TSP. Yossi Azar. Abstract. optimal tour. The lower bound holds even in the Euclidean Plane.

A Combined BIT and TIMESTAMP Algorithm for. the List Update Problem. Susanne Albers, Bernhard von Stengel, Ralph Werchner

where is a constant, 0 < <. In other words, the ratio between the shortest and longest paths from a node to a leaf is at least. An BB-tree allows ecie

On Dynamic Voronoi Diagrams and the. Minimum Hausdor Distance for Point Sets. Under Euclidean Motion in the Plane

The Polygon Exploration Problem II: The Angle Hull

Binary trees having a given number of nodes with 0, 1, and 2 children.

spline structure and become polynomials on cells without collinear edges. Results of this kind follow from the intrinsic supersmoothness of bivariate

HKUST Theoretical Computer Science Center Research Report HKUST-TCSC-99-06

Properties of a Function s Graph

For a set S of line segments, a separator can be found using duality. Under duality, the segments transform to double wedges, and a separator line tra

Lecture 3 February 9, 2010

Lecture 2 February 4, 2010

Connected Components of Underlying Graphs of Halving Lines

Recognition. Clark F. Olson. Cornell University. work on separate feature sets can be performed in

The Geometry of Carpentry and Joinery

Lecture 3: Art Gallery Problems and Polygon Triangulation

A General Class of Heuristics for Minimum Weight Perfect Matching and Fast Special Cases with Doubly and Triply Logarithmic Errors 1

Online algorithms for clustering problems

The problem of minimizing the elimination tree height for general graphs is N P-hard. However, there exist classes of graphs for which the problem can

G 6i try. On the Number of Minimal 1-Steiner Trees* Discrete Comput Geom 12:29-34 (1994)

Localization in Graphs. Richardson, TX Azriel Rosenfeld. Center for Automation Research. College Park, MD

A SIMPLE APPROXIMATION ALGORITHM FOR NONOVERLAPPING LOCAL ALIGNMENTS (WEIGHTED INDEPENDENT SETS OF AXIS PARALLEL RECTANGLES)

Search problems on 1-skeletons of regular. Abstract. For pursuit-evasion games played on 1-skeletons of regular polyhedrons

Point-Set Topology 1. TOPOLOGICAL SPACES AND CONTINUOUS FUNCTIONS

Applications of Geometric Spanner

Crossing Families. Abstract

Efficient minimum spanning tree construction without Delaunay triangulation

Vesa Halava Tero Harju. Walks on Borders of Polygons

10. Line Arrangements Lecture on Monday 2 nd November, 2009 by Michael Homann

HKUST Theoretical Computer Science Center Research Report HKUST-TCSC

Figure 1: The three positions allowed for a label. A rectilinear map consists of n disjoint horizontal and vertical line segments. We want to give eac

A Distributed Formation of Orthogonal Convex Polygons in Mesh-Connected Multicomputers

Improved Bounds for Intersecting Triangles and Halving Planes

1 Introduction and Results

time using O( n log n ) processors on the EREW PRAM. Thus, our algorithm improves on the previous results, either in time complexity or in the model o

On the Area of Overlap of Translated Polygons. Angela Y. Wu. The American University. Abstract

Math Analysis Chapter 1 Notes: Functions and Graphs

Rearrangement of DNA fragments: a branch-and-cut algorithm Abstract. In this paper we consider a problem that arises in the process of reconstruction

Tree-Weighted Neighbors and Geometric k Smallest Spanning Trees

arxiv: v1 [math.co] 17 Jan 2014

Separating Convex Sets in the Plane

Vladimir G. Deineko. Rene van Dal. Gunter Rote. Report 233 September 1992 CDLDO-4

APPROXIMATING THE MAXMIN AND MINMAX AREA TRIANGULATIONS USING ANGULAR CONSTRAINTS. J. Mark Keil, Tzvetalin S. Vassilev

Triangle Graphs and Simple Trapezoid Graphs

Math Analysis Chapter 1 Notes: Functions and Graphs

Superconcentrators of depth 2 and 3; odd levels help (rarely)

The Relative Neighbourhood Graph. of a Finite Planar Set. Godfried T. Toussaint

A Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable

Heap-on-Top Priority Queues. March Abstract. We introduce the heap-on-top (hot) priority queue data structure that combines the

Template Matching Rigid Motion

Computing farthest neighbors on a convex polytope

Unconstrained Optimization

Bottleneck Steiner Tree with Bounded Number of Steiner Vertices

ON THE NUMBER OF DIRECTIONS IN VISIBILITY REPRESENTATIONS OF. University of Ottawa, Department of Computer Science, Ottawa, ON, Canada

Ray shooting from convex ranges

Introduction to Algebraic and Geometric Topology Week 5

An O(n 2.75 ) algorithm for online topological ordering 1

would be included in is small: to be exact. Thus with probability1, the same partition n+1 n+1 would be produced regardless of whether p is in the inp

(for all > 0). In particular these bounds prove that none of the extent measures mentioned can change combinatorially more than O(n 2+ ) times. A quad

talk in Boca Raton in Part of the reason for not publishing the result for such a long time was his hope for an improvement in terms of the size

Lecture 9 - Matrix Multiplication Equivalences and Spectral Graph Theory 1

On the Area of Overlap of Translated Polygons

Edge disjoint monochromatic triangles in 2-colored graphs

Improved algorithms for constructing fault-tolerant spanners

13 th Annual Johns Hopkins Math Tournament Saturday, February 19, 2011 Automata Theory EUR solutions

Chapter 11 Arc Extraction and Segmentation

Shape-based Illustration Indexing and Retrieval. Stanford University. Abstract

AN ITERATIVE APPROACH TO THE IRREGULARITY STRENGTH OF TREES

An almost four-approximation algorithm for maximum weight triangulation

Geometric Pattern Matching. in d-dimensional Space. Abstract. boxes. We prove that the number of dierent translations that achieve the minimum

Smallest Intersecting Circle for a Set of Polygons

Enumeration of Full Graphs: Onset of the Asymptotic Region. Department of Mathematics. Massachusetts Institute of Technology. Cambridge, MA 02139

Restricted-Orientation Convexity in Higher-Dimensional Spaces

Template Matching Rigid Motion. Find transformation to align two images. Focus on geometric features

OBSTACLE DETECTION USING STRUCTURED BACKGROUND

4. Conclusion. 5. Acknowledgment. 6. References

Optimal Routing-Conscious Dynamic Placement for Reconfigurable Devices

CONNECTED SPACES AND HOW TO USE THEM

Faster Construction of Planar Two-centers

Optimal Parallel Randomized Renaming

An Efficient Approximation for the Generalized Assignment Problem

Compare quadrilaterals for similarities and differences *

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006

JOB SHOP SCHEDULING WITH UNIT LENGTH TASKS

Planar union of rectangles with sides parallel to the coordinate axis

Packing Chromatic Number of Distance Graphs

Conflict-free Covering

Geometric Data Structures Multi-dimensional queries Nearest neighbour problem References. Notes on Computational Geometry and Data Structures

[8] that this cannot happen on the projective plane (cf. also [2]) and the results of Robertson, Seymour, and Thomas [5] on linkless embeddings of gra

all the vertices). between u and v in the subgraph is at most t necessary to endow them with additional properties,

Bicriteria approach to the optimal location of surveillance cameras *

arxiv: v1 [cs.cg] 8 Jan 2018

Transcription:

Revised version, February 1991, appeared in Information Processing Letters 38 (1991), 123{127 COMPUTING THE MINIMUM HAUSDORFF DISTANCE BETWEEN TWO POINT SETS ON A LINE UNDER TRANSLATION Gunter Rote Technische Universitat Graz, Institut fur Mathematik, Steirergasse 30, A-8010 Graz, Austria. E-mail: roteftug.dnet.tu-graz.ac.at Given two sets of points on a line, wewant to translate one of them so that their Hausdor distance (the maximum of the distances from a point inany of the sets to the nearest point in the other set) is as small as possible. We present an optimal O(n log n) algorithm for this problem. Keywords: computational geometry, Hausdor distance, pattern recognition, pattern matching. 1 Introduction The Hausdor distance between two given sets of numbers A = fa 1 ;a 2 ;:::;a n g and B = fb 1 ;b 2 ;:::;b m g is dened as d(a; B) = maxn max a2a min b2b jb aj; max min ja b2b a2a In other words, the Hausdor distance between A and B is the smallest value d such that every point ofahas a point ofbwithin distance d and every point ofbhas a point ofa within distance d. The Hausdor distance can also be dened for point sets in two or more dimensions, where ja bj must be replaced by the Euclidean distance between a and b (or any other appropriate distance function). In applications like computer vision or pattern recognition, the set A might represent an \image" taken by a camera and B might represent a \template" against which A should be matched. Usually the relative position of the image A is not xed with respect to the coordinate system in which the template is given: we may translate A so that it becomes aligned with B and matches B as well as possible. In this paper, we solve the one-dimensional version of the problem for two point sets on a line (see gure 1, where the point sets are represented as the teeth of two combs). Formally, we compute n o min d(a + t; B) = min max max min (a + t)j; max j(a + t) bj : t2ir t2ir a2a a2a b2b jb b2b min Here the parameter t denotes the amount by which A is shifted. The algorithm takes O((m + n) log(m + n)) time and is described in the next section. Previously, the problem could only be solved in O(mn log(m + n)) time, see Huttenlocher and Kedem [5]. The concluding section discusses implementation issues, a lower bound for the time complexity, the limitations of our method, and some related problems. bj o : 1

B A t - Figure 1: Two sets of points. 2 The algorithm In a rst step we (conceptually) transform the problem to a variation dealing with the \non-symmetric" or \one-way" Hausdor distance: ~d(a; B) = max a2a min jb b2b aj: This will make the algorithm more convenient to explain, because we can now treat the sets A and B dierently without confusion. To transform the original problem, we take a reected copy ~ A of A and add it to the right ofb, suciently far apart (see gure 2). (Any distance three times larger than the diameter of A plus the diameter of B would certainly be sucient.) Similarly, we take a reected copy ~ B of B and add it to A on the right side, the same distance apart. The new sets are called B and A, respectively; their cardinality is m+ n. It is clear that the non-symmetric Hausdor distance of the new sets is the same as the Hausdor distance of the two original sets, and this equality remains true if we translate any of the sets. Figure 2 shows the Hausdor distance of the new sets and where it occurs. B A A B ~d(a; B) - Figure 2: Extending the original sets. ~ B ~ A So we nowwant to minimize the function F (t) := d(a+t; ~ B). This function can be built up in the following way: For a single point x, f(x) = d(x; ~ B) is a continuous piecewise linear function of the variable x (see gure 3), with edges of slope 1 and 1. Its minima are at the points of B. Wehave to consider m + n such functions f(a + t), which are basically the same, except that they are shifted in the horizontal direction by dierent amounts a. The function F (t) is just the upper envelope of these functions: F (t) = max f(a + t) (1) a2a Like f(x), the function F (t) is piecewise linear, with edges of slope 1. Each edge of F (t) originates from (at least) one of the functions f(a + t) in (1). It is straightforward to construct F in O((m + n) 2 log(m + n)) time by varying t from 1 to +1 and maintaining the current order of the m + n values f(a + t). (Since we are only interested in distances from A to B and from B ~ to A, ~ not from A to A ~ or from B ~ to B, our original problem can actually be solved in O(mn log(m + n)) time, see Huttenlocher and Kedem [5]). However, the following considerations show that we do not need so much eort to construct the function F.We assume that the initial position of A and B (with parameter 2

p 6 f(x) = d(x; ~ B) B - x Figure 3: The function f(x) = ~ d(x; B) value t = 0) corresponds to the position where A and B are aligned at their endpoints, as in gure 2. If we shift A by t, the left or right endpoint will contribute at least jtj to the Hausdor distance, and so we know that F (t) jtj.from this lower bound we can conclude: Lemma Each of the m + n functions f(a + t), for a 2A,inequation (1) contributes at most two edges to the function F (t). Proof. Consider some function f(a + t) that has a local maximum at some point t 0 with f(a + t 0 ) > jt 0 j, (see gure 4). From this maximum the function decreases to 0 towards both sides before it can rise again. Since the slope is always 1, the only two edges that appear above the lower bound F (t) jtjare the two edges emanating from t 0. In case f(a + t) does not have such a local maximum only one edge can appear above the lower bound F (t) jtj. (In the exceptional case that f(a) =0,two edges may form part of the lower bound, and the lemma is also true.) 6 0 t 0 F (t) jtj - t Figure 4: A lower bound for F (t) and one function f(a + t). The lemma implies that F (t) has at most 2(m+n) linear pieces. (A more exact analysis shows that the true (tight) upper bound on the number of edges is 2(m + n) 8, for all m 3 and n 3.) To nd the two pieces of f(a + t) which possibly contribute to F (t) we compute the function at t = 0, (i. e., we compute f(a)) and we follow the edge in the rising direction to the next peak, which is the local maximum of the lemma, from which the two relevant edges start. The other cases of the lemma are also handled easily. If the function f(x) is given as a sorted list of the points in B and the functions f(a + t) are processed in order of increasing values a 2A, the 2(m + n) linear pieces can be found in O(m + n) time. (The process is essentially a merging of A and B.) Now, F (t) is the (pointwise) maximum of these 2(m + n) linear pieces of slopes 1 (see gure 5). F (t) can easily be computed (and minimized) in O((m + n) log(m + n)) time: We could for example add the functions f(a + t) one at a time and maintain the 3

upper envelope of the functions added so far in a balanced tree. Alternatively, we could sort the \spikes" (where a spike consists of a rising edge, a local maximum, and a falling edge) according to their left endpoints and add them from left to right (cf. Huttenlocher and Kedem [5], algorithm 2). After the sorting, this can be carried out in linear time. 6 F (t) - x 0 Figure 5: The upper envelope F (t) of the relevant part of the functions f(a + t), for a 2A, for the example of gure 2. Theorem The minimal Hausdor distance between two point sets on a line under translation can be computed ino(nlog n) time and O(n) space, where n is the total number of given points. Proof. As was discussed in the paragraph preceding the theorem, the two relevant edges for each of the n functions f(a + t) can be found in linear time if B and A are sorted, and their upper envelope can be constructed in O(n log n) time. Scanning this upper envelope to nd its minimum takes again only linear time. It is clear that linear space is sucient for all steps. 3 Conclusion Note that apart from two sorting steps, all steps of our algorithm can be carried out in linear time. The two sorting steps that are involved are the sorting of the initial data a i and b j and one sorting step for constructing F (t), where certain numbers of the form b j a i have to be sorted. This is of interest because in practice the time complexity of sorting is usually a \fast" O(n log n) (with a low constant in the O-notation); therefore our algorithm should be very fast, too. The complexity of O(nlog n) of our algorithm is optimal in the algebraic decision tree model, even if the initial data a i and b j are given in sorted oder. This can be shown with the technique of Ben-Or [1] (see [7, p. 30]). For a sketch of the proof we refer to gure 5. If all spikes of the functions f(a + t) have the same height, minimizing their upper envelope F (t) corresponds to nding the maximum gap between adjacent spikes. For this so-called Max Gap problem an (n log n) lower bound has been proved by Ramanan [8] and Lee and 4

Wu [6, appendix]. The left endpoints of the spikes are numbers of the form b j a i. It is not too dicult to convince oneself that an arbitrary given instance of the Max Gap problem can be transformed in linear time into two sorted sets of numbers A = fa 1 ;a 2 ;:::;a n g and B = fb 1 ;b 2 ;:::;b n g for our problem so that the spikes of the function F are at the desired positions. The Max Gap problem can be solved in linear time if the oor function bc can be used (see [7, pp. 253{254]). However, since the spikes of the functions f(a + t) need not have the same height, our problem is actually more general than the Max Gap problem. For example, if we are given the spikes of F and want to decide whether there is a point t with F (t) d, for some threshold d, wehave to determine whether a set of intervals is disjoint. Thus we actually have a max gap problem for intervals. This makes it unlikely that the lower bound for our problem can be overcome even if the oor function is used. Although we have reduced our problem to the problem with the non-symmetric Hausdor distance, our method cannot be applied if the problem is originally posed for two arbitrary given sets with the non-symmetric Hausdor distance. The reason is that a crucial requirement for our method is that the diameter of A is at least as big as the diameter of B, which implies the lower bound F (t) jtj. Huttenlocher and Kedem [5] give an example where the function F for the non-symmetric Hausdor distance can have (mn) breakpoints, all at the same height. Our method does therefore not provide a way toavoid computing all of these breakpoints and to improve the O(mn log(m + n)) bound for this general problem. In one of the applications of Huttenlocher and Kedem [5], the sets A and B were actually not points on a line, but points on the unit circle, and the allowed \translation" was accordingly a rotation about the origin. In this case our algorithm also does not work, for the same reason as above. A related problem occurs in certain scheduling problems for urban transportation systems: When two periodic railway lines share the same track, the safety distance between successive trains should be as large as possible. Finding the appropriate amount by which the schedule of one line should be shifted is equivalent tomaximizing the Hausdor distance between two point sets on a circle under rotation. Brucker and Meyer [3] solve this problem in O(mn log(m + n)) time. The problem can of course be generalized to more than two train lines, and it has also some variations, for example, when several bus lines meet at a terminal and the maximum (or average) waiting time for the passengers should be minimized. These problems lead to various dierent objective functions, some of which are similar to the Hausdor distance, see Brucker, Burkard, and Hurink [2] or Burkard [4]. 5

References [1] M. Ben-Or, Lower bounds for algebraic computation trees, in: Proc. 15th Annual ACM Symp. on Theory of Computing, pp. 80{86, 1983. [2] P. Brucker, R. E. Burkard, and J. Hurink, Cyclic schedules for r irregularly occurring events, J. Computational and Applied Mathematics 30 (1990), 173{189. [3] P. Brucker and W. Meyer, Scheduling two irregular polygons, Discrete Applied Mathematics 20 (1988), 91{100. [4] R. E. Burkard, Optimal schedules for periodically recurring events. Discrete Applied Mathematics 15 (1986), 167{180. [5] D. P. Huttenlocher and K. Kedem, Computing the minimum Hausdor distance for point sets under translation, in: Proceedings of the Sixth Annual Symposium on Computational Geometry, Berkeley, California, June 6{8, 1990. Association for Computing Machinery, 1990; pp. 340{349. [6] D. T. Lee and Y. F. Wu, Geometric complexity of some location problems, Algorithmica 1 (1986), 193{212. [7] F. P. Preparata and M. I. Shamos, Computational Geometry: An Introduction, Springer-Verlag, 1985. [8] P. Ramanan, Obtaining lower bounds using articial components, Information Processing Letters 24 (1987), 243{246. 6