Loading [MathJax]/extensions/TeX/AMSsymbols.js
Open3D (C++ API)  0.16.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Registration.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <tuple>
30 #include <vector>
31 
32 #include "open3d/core/Tensor.h"
35 
36 namespace open3d {
37 namespace t {
38 
39 namespace geometry {
40 class PointCloud;
41 }
42 
43 namespace pipelines {
44 namespace registration {
45 class Feature;
46 
51 public:
62  ICPConvergenceCriteria(double relative_fitness = 1e-6,
63  double relative_rmse = 1e-6,
64  int max_iteration = 30)
65  : relative_fitness_(relative_fitness),
66  relative_rmse_(relative_rmse),
67  max_iteration_(max_iteration) {}
69 
70 public:
79 };
80 
85 public:
91  4, core::Float64, core::Device("CPU:0")))
92  : transformation_(transformation), inlier_rmse_(0.0), fitness_(0.0) {}
93 
95 
96  bool IsBetterThan(const RegistrationResult &other) const {
97  return fitness_ > other.fitness_ || (fitness_ == other.fitness_ &&
98  inlier_rmse_ < other.inlier_rmse_);
99  }
100 
101 public:
109  double inlier_rmse_;
112  double fitness_;
113 };
114 
124  const geometry::PointCloud &source,
125  const geometry::PointCloud &target,
126  double max_correspondence_distance,
127  const core::Tensor &transformation =
129 
149 ICP(const geometry::PointCloud &source,
150  const geometry::PointCloud &target,
151  const double max_correspondence_distance,
152  const core::Tensor &init_source_to_target =
154  const TransformationEstimation &estimation =
157  const double voxel_size = -1.0,
158  const std::function<void(const std::unordered_map<std::string, core::Tensor>
159  &)> &callback_after_iteration = nullptr);
160 
187  const geometry::PointCloud &source,
188  const geometry::PointCloud &target,
189  const std::vector<double> &voxel_sizes,
190  const std::vector<ICPConvergenceCriteria> &criteria_list,
191  const std::vector<double> &max_correspondence_distances,
192  const core::Tensor &init_source_to_target =
194  const TransformationEstimation &estimation =
196  const std::function<
197  void(const std::unordered_map<std::string, core::Tensor> &)>
198  &callback_after_iteration = nullptr);
199 
211  const geometry::PointCloud &target,
212  const double max_correspondence_distance,
213  const core::Tensor &transformation);
214 
215 } // namespace registration
216 } // namespace pipelines
217 } // namespace t
218 } // namespace open3d
core::Tensor GetInformationMatrix(const geometry::PointCloud &source, const geometry::PointCloud &target, const double max_correspondence_distance, const core::Tensor &transformation)
Computes Information Matrix, from the transformation between source and target pointcloud. It returns the Information Matrix of shape {6, 6}, of dtype Float64 on device CPU:0.
Definition: Registration.cpp:414
int max_iteration_
Maximum iteration before iteration stops.
Definition: Registration.h:78
double relative_fitness_
Definition: Registration.h:73
Class that defines the convergence criteria of ICP.
Definition: Registration.h:50
core::Tensor transformation_
The estimated transformation matrix of dtype Float64 on CPU device.
Definition: Registration.h:103
RegistrationResult EvaluateRegistration(const geometry::PointCloud &source, const geometry::PointCloud &target, double max_correspondence_distance, const Eigen::Matrix4d &transformation)
Function for evaluating registration between point clouds.
Definition: Registration.cpp:111
double fitness_
Definition: Registration.h:112
ICPConvergenceCriteria(double relative_fitness=1e-6, double relative_rmse=1e-6, int max_iteration=30)
Parameterized Constructor. ICP algorithm stops if the relative change of fitness and rmse hit relativ...
Definition: Registration.h:62
RegistrationResult MultiScaleICP(const geometry::PointCloud &source, const geometry::PointCloud &target, const std::vector< double > &voxel_sizes, const std::vector< ICPConvergenceCriteria > &criterias, const std::vector< double > &max_correspondence_distances, const core::Tensor &init_source_to_target, const TransformationEstimation &estimation, const std::function< void(const std::unordered_map< std::string, core::Tensor > &)> &callback_after_iteration)
Functions for Multi-Scale ICP registration. It will run ICP on different voxel level, from coarse to dense. The vector of ICPConvergenceCriteria(relative fitness, relative rmse, max_iterations) contains the stopping condition for each voxel level. The length of voxel_sizes vector, criteria vector, max_correspondence_distances vector must be same, and voxel_sizes must contain positive values in strictly decreasing order [Lower the voxel size, higher is the resolution]. Only the last value of the voxel_sizes vector can be {-1}, as it allows to run on the original scale without downsampling.
Definition: Registration.cpp:335
double inlier_rmse_
RMSE of all inlier correspondences. Lower is better.
Definition: Registration.h:109
Definition: Device.h:37
A point cloud contains a list of 3D points.
Definition: PointCloud.h:99
bool IsBetterThan(const RegistrationResult &other) const
Definition: Registration.h:96
Definition: PinholeCameraIntrinsic.cpp:35
core::Tensor correspondences_
Definition: Registration.h:107
RegistrationResult(const core::Tensor &transformation=core::Tensor::Eye(4, core::Float64, core::Device("CPU:0")))
Parameterized Constructor.
Definition: Registration.h:90
~RegistrationResult()
Definition: Registration.h:94
double relative_rmse_
Definition: Registration.h:76
const Dtype Float64
Definition: Dtype.cpp:62
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:404
Definition: TransformationEstimation.h:61
RegistrationResult ICP(const geometry::PointCloud &source, const geometry::PointCloud &target, const double max_correspondence_distance, const core::Tensor &init_source_to_target, const TransformationEstimation &estimation, const ICPConvergenceCriteria &criteria, const double voxel_size, const std::function< void(const std::unordered_map< std::string, core::Tensor > &)> &callback_after_iteration)
Functions for ICP registration.
Definition: Registration.cpp:113