Open3D (C++ API)  0.13.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 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"
34 
35 namespace open3d {
36 namespace t {
37 
38 namespace geometry {
39 class PointCloud;
40 }
41 
42 namespace pipelines {
43 namespace registration {
44 class Feature;
45 
50 public:
61  ICPConvergenceCriteria(double relative_fitness = 1e-6,
62  double relative_rmse = 1e-6,
63  int max_iteration = 30)
64  : relative_fitness_(relative_fitness),
65  relative_rmse_(relative_rmse),
66  max_iteration_(max_iteration) {}
68 
69 public:
78 };
79 
84 public:
90  4, core::Dtype::Float64, core::Device("CPU:0")))
91  : transformation_(transformation), inlier_rmse_(0.0), fitness_(0.0) {}
92 
94 
95  bool IsBetterRANSACThan(const RegistrationResult &other) const {
96  return fitness_ > other.fitness_ || (fitness_ == other.fitness_ &&
97  inlier_rmse_ < other.inlier_rmse_);
98  }
99 
100 public:
107  double inlier_rmse_;
110  double fitness_;
111 };
112 
122  const geometry::PointCloud &source,
123  const geometry::PointCloud &target,
124  double max_correspondence_distance,
125  const core::Tensor &transformation = core::Tensor::Eye(
126  4, core::Dtype::Float64, core::Device("CPU:0")));
127 
139  const geometry::PointCloud &source,
140  const geometry::PointCloud &target,
141  double max_correspondence_distance,
142  const core::Tensor &init_source_to_target = core::Tensor::Eye(
143  4, core::Dtype::Float64, core::Device("CPU:0")),
144  const TransformationEstimation &estimation =
146  const ICPConvergenceCriteria &criteria = ICPConvergenceCriteria());
147 
170  const geometry::PointCloud &source,
171  const geometry::PointCloud &target,
172  const std::vector<double> &voxel_sizes,
173  const std::vector<ICPConvergenceCriteria> &criteria_list,
174  const std::vector<double> &max_correspondence_distances,
175  const core::Tensor &init_source_to_target = core::Tensor::Eye(
176  4, core::Dtype::Float64, core::Device("CPU:0")),
177  const TransformationEstimation &estimation =
179 
180 } // namespace registration
181 } // namespace pipelines
182 } // namespace t
183 } // namespace open3d
RegistrationResult RegistrationMultiScaleICP(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)
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 stoping 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:140
int max_iteration_
Maximum iteration before iteration stops.
Definition: Registration.h:77
double relative_fitness_
Definition: Registration.h:72
Class that defines the convergence criteria of ICP.
Definition: Registration.h:49
RegistrationResult(const core::Tensor &transformation=core::Tensor::Eye(4, core::Dtype::Float64, core::Device("CPU:0")))
Parameterized Constructor.
Definition: Registration.h:89
std::pair< core::Tensor, core::Tensor > CorrespondenceSet
CorrespondenceSet: pair of 2x Int64 tensors of shape {C,}, where C is the number of good corresponden...
Definition: TransformationEstimation.h:55
core::Tensor transformation_
The estimated transformation matrix of dtype Float64 on CPU device.
Definition: Registration.h:102
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:118
double fitness_
Definition: Registration.h:110
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:61
double inlier_rmse_
RMSE of all inlier correspondences. Lower is better.
Definition: Registration.h:107
Definition: Device.h:39
A pointcloud contains a set of 3D points.
Definition: PointCloud.h:95
bool IsBetterRANSACThan(const RegistrationResult &other) const
Definition: Registration.h:95
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Tensor.h:50
CorrespondenceSet correspondence_set_
Definition: Registration.h:105
~RegistrationResult()
Definition: Registration.h:93
double relative_rmse_
Definition: Registration.h:75
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:252
RegistrationResult RegistrationICP(const geometry::PointCloud &source, const geometry::PointCloud &target, double max_correspondence_distance, const Eigen::Matrix4d &init, const TransformationEstimation &estimation, const ICPConvergenceCriteria &criteria)
Functions for ICP registration.
Definition: Registration.cpp:134
Definition: TransformationEstimation.h:69
static const Dtype Float64
Definition: Dtype.h:43