Open3D (C++ API)  0.16.0
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
36namespace open3d {
37namespace t {
38
39namespace geometry {
40class PointCloud;
41}
42
43namespace pipelines {
44namespace registration {
45class Feature;
46
51public:
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
70public:
79};
80
85public:
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_ &&
99 }
100
101public:
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
149ICP(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
Definition: Device.h:37
Definition: Tensor.h:51
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:404
A point cloud contains a list of 3D points.
Definition: PointCloud.h:99
Class that defines the convergence criteria of ICP.
Definition: Registration.h:50
double relative_rmse_
Definition: Registration.h:76
double relative_fitness_
Definition: Registration.h:73
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
int max_iteration_
Maximum iteration before iteration stops.
Definition: Registration.h:78
core::Tensor correspondences_
Definition: Registration.h:107
~RegistrationResult()
Definition: Registration.h:94
double fitness_
Definition: Registration.h:112
core::Tensor transformation_
The estimated transformation matrix of dtype Float64 on CPU device.
Definition: Registration.h:103
bool IsBetterThan(const RegistrationResult &other) const
Definition: Registration.h:96
RegistrationResult(const core::Tensor &transformation=core::Tensor::Eye(4, core::Float64, core::Device("CPU:0")))
Parameterized Constructor.
Definition: Registration.h:90
double inlier_rmse_
RMSE of all inlier correspondences. Lower is better.
Definition: Registration.h:109
Definition: TransformationEstimation.h:61
const Dtype Float64
Definition: Dtype.cpp: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,...
Definition: Registration.cpp:335
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....
Definition: Registration.cpp:414
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:83
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
Definition: PinholeCameraIntrinsic.cpp:35