Open3D (C++ API)  0.18.0+252c867
Registration.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <tuple>
11 #include <vector>
12 
13 #include "open3d/core/Tensor.h"
16 
17 namespace open3d {
18 namespace t {
19 
20 namespace geometry {
21 class PointCloud;
22 }
23 
24 namespace pipelines {
25 namespace registration {
26 class Feature;
27 
32 public:
43  ICPConvergenceCriteria(double relative_fitness = 1e-6,
44  double relative_rmse = 1e-6,
45  int max_iteration = 30)
46  : relative_fitness_(relative_fitness),
47  relative_rmse_(relative_rmse),
48  max_iteration_(max_iteration) {}
50 
51 public:
60 };
61 
66 public:
72  4, core::Float64, core::Device("CPU:0")))
73  : transformation_(transformation), inlier_rmse_(0.0), fitness_(0.0) {}
74 
76 
77  bool IsBetterThan(const RegistrationResult &other) const {
78  return fitness_ > other.fitness_ || (fitness_ == other.fitness_ &&
79  inlier_rmse_ < other.inlier_rmse_);
80  }
81 
82 public:
90  double inlier_rmse_;
93  double fitness_;
95  bool converged_{false};
97  size_t num_iterations_{0};
98 };
99 
108 RegistrationResult EvaluateRegistration(
109  const geometry::PointCloud &source,
110  const geometry::PointCloud &target,
111  double max_correspondence_distance,
112  const core::Tensor &transformation =
114 
133 RegistrationResult
134 ICP(const geometry::PointCloud &source,
135  const geometry::PointCloud &target,
136  const double max_correspondence_distance,
137  const core::Tensor &init_source_to_target =
139  const TransformationEstimation &estimation =
140  TransformationEstimationPointToPoint(),
141  const ICPConvergenceCriteria &criteria = ICPConvergenceCriteria(),
142  const double voxel_size = -1.0,
143  const std::function<void(const std::unordered_map<std::string, core::Tensor>
144  &)> &callback_after_iteration = nullptr);
145 
171 RegistrationResult MultiScaleICP(
172  const geometry::PointCloud &source,
173  const geometry::PointCloud &target,
174  const std::vector<double> &voxel_sizes,
175  const std::vector<ICPConvergenceCriteria> &criteria_list,
176  const std::vector<double> &max_correspondence_distances,
177  const core::Tensor &init_source_to_target =
179  const TransformationEstimation &estimation =
180  TransformationEstimationPointToPoint(),
181  const std::function<
182  void(const std::unordered_map<std::string, core::Tensor> &)>
183  &callback_after_iteration = nullptr);
184 
196  const geometry::PointCloud &target,
197  const double max_correspondence_distance,
198  const core::Tensor &transformation);
199 
200 } // namespace registration
201 } // namespace pipelines
202 } // namespace t
203 } // namespace open3d
Definition: Device.h:18
Definition: Tensor.h:32
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:386
A point cloud contains a list of 3D points.
Definition: PointCloud.h:80
Class that defines the convergence criteria of ICP.
Definition: Registration.h:31
double relative_rmse_
Definition: Registration.h:57
double relative_fitness_
Definition: Registration.h:54
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:43
int max_iteration_
Maximum iteration before iteration stops.
Definition: Registration.h:59
core::Tensor correspondences_
Definition: Registration.h:88
bool converged_
Specifies whether the algorithm converged or not.
Definition: Registration.h:95
~RegistrationResult()
Definition: Registration.h:75
double fitness_
Definition: Registration.h:93
core::Tensor transformation_
The estimated transformation matrix of dtype Float64 on CPU device.
Definition: Registration.h:84
bool IsBetterThan(const RegistrationResult &other) const
Definition: Registration.h:77
RegistrationResult(const core::Tensor &transformation=core::Tensor::Eye(4, core::Float64, core::Device("CPU:0")))
Parameterized Constructor.
Definition: Registration.h:71
double inlier_rmse_
RMSE of all inlier correspondences. Lower is better.
Definition: Registration.h:90
size_t num_iterations_
Number of iterations the algorithm took to converge.
Definition: Registration.h:97
const Dtype Float64
Definition: Dtype.cpp:43
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,...
Definition: Registration.cpp:344
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 transfromation between source and target pointcloud....
Definition: Registration.cpp:426
RegistrationResult EvaluateRegistration(const geometry::PointCloud &source, const geometry::PointCloud &target, double max_correspondence_distance, const core::Tensor &transformation)
Function for evaluating registration between point clouds.
Definition: Registration.cpp:64
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:94
Definition: PinholeCameraIntrinsic.cpp:16