icp.h
1/*
2Copyright (c) 2004, Tim Bailey
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13 * Neither the name of the Player Project nor the names of its contributors
14 may be used to endorse or promote products derived from this software
15 without specific prior written permission.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29/* Iterated closest point (ICP) algorithm.
30 *
31 * This is a very simple implementation of ICP, with one simple extension where the
32 * association may be chosen as an interpolation between two nearest neighbours rather
33 * than just point-to-point with the nearest neighbour.
34 *
35 * A lot of extensions to this basic algorithm are possible. For example,
36 * 1. Record at each iteration the set of NN associations for each observation.
37 * If these do not change, then ICP has converged completely.
38 *
39 * 2. Various speed ups given in the following papers:
40 *
41 * (a) P.J. Besl and N.D. McKay. A method for registration of 3-D shapes. IEEE
42 * Transactions on Pattern Analysis and Machine Intelligence, 14(2):239256, 1992.
43 *
44 * (b) F. Lu and E. Milios. Robot pose estimation in unknown environments by matching
45 * 2D range scans. Journal of Intelligent and Robotic Systems, 18:249275, 1997.
46 *
47 * (c) S. Rusinkiewicz and M. Levoy. Efficient variants of the ICP algorithm. In Third
48 * International Conference on 3D Digital Imaging and Modeling, pages 145152, 2001.
49 *
50 * 3. Methods for estimating the error introduced by point-wise correspondence in
51 * the paper (b) above and also:
52 *
53 * S.T. P?ster, K.L. Kriechbaum, S.I. Roumeliotis, and J.W. Burdick. Weighted range
54 * sensor matching algorithms for mobile robot displacement estimation. In IEEE
55 * International Conference on Robotics and Automation, 2002.
56 *
57 * Tim Bailey 2004.
58 */
59#include <vector>
60#include "geometry2D.h"
61#include "nn.h"
62#include <memory>
63using namespace std;
64namespace Geom2D {
65
66class ICP {
67public:
68 ICP();
69 ~ICP();
70 Pose align(std::vector<Point> , std::vector<Point>,Pose , double , int , bool );
71 const std::vector<Point> get_ref_points() { return b; }
72 const std::vector<Point> get_obs_points() { return a; }
73 bool warning_misalign;
74private:
75 vector<Point> ref;
76 SweepSearch * nn;
77 vector<Point> a;
78 vector<Point> b;
79 vector<int> index;
80};
81
82} // namespace Geom2D
Definition icp.h:66
Definition nn.h:49
Definition geometry2D.h:58