Comparison of Nearest-Neighbor-Search Strategies and Implementations for Efficient Shape Registration
Total Page:16
File Type:pdf, Size:1020Kb
Journal of Software Engineering for Robotics 3(1), March 2012, 2-12 ISSN: 2035-3928 Comparison of nearest-neighbor-search strategies and implementations for efficient shape registration Jan Elseberg1,∗ Stephane´ Magnenat2 Roland Siegwart2 Andreas Nuchter¨ 1 1 Automation Group, Jacobs University Bremen gGmbH, 28759 Bremen, Germany 2 Autonomous Systems Lab, ETH Zurich,¨ Switzerland ∗[email protected] Abstract—The iterative closest point (ICP) algorithm is one of the most popular approaches to shape registration currently in use. At the core of ICP is the computationally-intensive determination of nearest neighbors (NN). As of now there has been no comprehensive analysis of competing search strategies for NN. This paper compares several libraries for nearest-neighbor search (NNS) on both simulated and real data with a focus on shape registration. In addition, we present a novel efficient implementation of NNS via k-d trees as well as a novel algorithm for NNS in octrees. Index Terms—shape registration, nearest neighbor search, k-d tree, octree, data structures 1 INTRODUCTION point can be avoided by employing spatial data structures. The average runtime of NNS is then usually in the order Shape registration is the problem of finding the rigid trans- of O(n log m) but is still by far the most computationally formation that, given two shapes, transforms one onto the expensive part of shape registration. This paper gives a other. The given shapes do not need to be wholly identical. comprehensive empirical analysis of NNS algorithms in the As long as a partial overlap is possible, shape registration domain of 3-dimensional shape matching. For this purpose, seeks the transformation that accomplishes just that overlap. section 2 gives an overview of spatial data structures and the For the extent of this paper we consider a shape to be a set of state of the art on comparison of search algorithms. Section 3 points in three-dimensional Cartesian space, i.e. a point cloud. presents the novel search algorithm on octrees and the novel The registration problem is most commonly solved using the efficient implementation of NNS in k-d trees. We explain our iterative closest point (ICP) algorithm [1]. In addition to the experimental setup in section 4, provide results in section 5 two shapes, it assumes an estimate of the transformation to be and conclude the paper in section 6. computed. Such an estimate is usually available in contexts where shape matching is of importance. ICP is an iterative 2 RELATED WORK algorithm that alternates between determining, based on the Spatial data structures partition space to allow efficient access current transformation estimate, the nearest neighbors (NN) of to the stored elements via positional queries. Most spatial data every point of one shape, and updating the estimate based on the structures are hierarchical in nature, such as k-d trees [9] and NN. Updating the estimate is a relatively simple mathematical octrees [10]. The grid file [11] is a rare flat non-hierarchical operation that is linear in the number of neighboring points. data structure. We explicitly exclude it from consideration here Naively implemented, the nearest-neighbor search (NNS) is because of its prohibitive memory requirements. A special type in O(nm) where n and m are the number of points in the of NNS employs the Morton order for arranging the point cloud. respective point clouds. Exploring every possible pairing of A Morton order is a space-filling curve (SFC), i.e. a curve that Regular paper – Manuscript received October 21, 2011; revised February allows ordering the set of points along one dimension while 15, 2012. preserving the locality thereof [12]. • This work was partially supported by the AUTOSCAN project (BMWi In addition to the well known k-d tree and octree we also KF2470003DF0). consider the following hierarchical R-trees [13]. There are other • Authors retain copyright to their papers and grant JOSER unlimited data structures such as the range-tree [14] and vp-tree [15]. rights to publish the paper electronically and in hard copy. Use of the Unfortunately, to the authors’ knowledge, there is no publicly article is permitted as long as the author(s) and the journal are properly available NNS library that employs either the vp- or the range- acknowledged. tree. www.joser.org - © 2012 by Jan Elseberg, Stephane´ Magnenat, Roland Siegwart, Andreas Nuchter¨ J. Elseberg et al./ Comparison of nearest-neighbor-search strategies and implementations for efficient shape registration 3 TABLE 1 Properties for all tested NNS libraries. Data k-NN fixed ranged Library revision optimized for structure search radius search 3DTK [2] rev. 470 k-d tree × × X shape registration 3DTK rev. 470 octree × × X shape registration & efficient storage ANN [3] Ver. 1.1.1 k-d tree X X × CGAL [4] Ver. 3.5.1-1 k-d tree × X × FLANN [5] bcf3a56e5fed2d4dc3a340725fa341fa36ef79a4 k-d tree X X × high dimensions libnabo [6] Ver. 1.0.0 k-d tree X × X SpatialIndex [7] Ver. 1.4.0-1.1 R-tree X × × STANN [8] Ver. 0.71 beta SFC X × × multithreading An octree [10] is the generalization of quadtrees, which store by a minimum overlap criteria. It also extends the splitting two dimensional data [16]. Each node in an octree represents algorithm by the principle of forced reinsertion, i.e. elements the volume formed by a rectangular cuboid, often simplified that are already stored may be deleted and reinserted into to an axis-aligned cube. Consequently an octree node has another node [17]. up to eight children, each corresponding to one octant of the Apart from the data structure, the NNS queries are of interest. overlying cube/node. A node having no children usually implies There are different types of NNS query that deserve discussion: that the corresponding volume can be uniformly represented, The first type of query that springs to mind in the context i.e., no further subdivision is necessary to disambiguate. This of NNS is the k-NN search. The result of this type of query convention is not completely applicable when storing points, are the k NN around a specified query point. Another is the which are dimensionless, i.e., there is no volume associated fixed radius search, which computes all points withing a given with them. When storing a point cloud, a stopping rule must radius of the query point. The combination of the two types be defined for occupied volumes, like a maximal depth or a yields the ranged search, i.e. the retrieval of the k NN with minimal number of points. Empty volumes will however not a given maximal distance. The latter query with k = 1 is be further split up. the type of query needed for shape registration. In the large The k-d tree [9] is similar to the octree in that each node majority of realistic applications the presence of obstruction represents an axis-aligned rectangular cuboid and its children leads to only partially-overlapping point clouds. Thus, allowing split up the volume to form smaller cuboids. Empty volumes point correspondences with a too large distance can only infuse are not subdivided further, and there must be a stopping rule the registration process with errors. The range search variant for occupied volumes. However, a k-d tree is a binary tree and also allows for a large potential for efficient implementation. the subdivision of the node’s volume must not be regular, i.e. The maximal radius restricts the search region to only a small each node also defines an axis-aligned hyperplane that splits subspace of the entire data. This can be efficiently combined the volume in two. Unlike the octree, there is not a unique with the restriction on the number of points. Even the small way of constructing a k-d tree since the splitting plane can be subspace does not need to be explored in its entirety if it can be placed at any position in any node. There are several strategies ensured that the k NN points have been located. It is surprising for placing the splitting plane. The standard rule is splitting then, that many NNS libraries fail to provide this search variant before the median point along the longest dimension of the (cf. Table 1). node’s volume. Another splitting rule is the so called midpoint To the authors’ knowledge there is little previous work rule, which merely splits the current volume in half along its exploring and comparing current NNS libraries in the context of longest dimension. shape registration. Blumenthal et al. [18] give a first evaluation The R-tree [13] is non-binary and is primarily used for spatial of some available NNS libraries. We compare a wider range of data other than point clouds, i.e. for geographic information algorithms on a wider range of data, both artificial and real. systems. Each node represents an axis-aligned bounding box Pomerleau at al. [19] explore several parameters influencing of arbitrary dimension. The represented volumes are allowed registration performance, but only one parameter (an early-out to overlap, except for the requirement that a child’s volume approximation factor) is related to the NNS. There have been must be entirely within the parent’s. There are several variants comparisons of different data structures for NNS, although of the R-tree that differ only in their insertion algorithms. not specifically for shape registration. Dandamudi et al. [20] The linear, quadratic and exponential R-tree all insert a new compare the binary decision (bd) tree to variants of the k-d element into the node that requires the least extension, but tree. Nakamura et al.