Open3D (C++ API)  0.15.1
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:
94 4, core::Float64, core::Device("CPU:0")),
95 bool save_loss_log = false)
96 : transformation_(transformation),
97 inlier_rmse_(0.0),
98 fitness_(0.0),
99 save_loss_log_(save_loss_log),
100 loss_log_("index") {}
101
103
104 bool IsBetterRANSACThan(const RegistrationResult &other) const {
105 return fitness_ > other.fitness_ || (fitness_ == other.fitness_ &&
106 inlier_rmse_ < other.inlier_rmse_);
107 }
108
109public:
120 double fitness_;
127};
128
138 const geometry::PointCloud &source,
139 const geometry::PointCloud &target,
140 double max_correspondence_distance,
141 const core::Tensor &transformation =
143
162 const geometry::PointCloud &source,
163 const geometry::PointCloud &target,
164 const double max_correspondence_distance,
165 const core::Tensor &init_source_to_target =
167 const TransformationEstimation &estimation =
170 const double voxel_size = -1.0,
171 const bool save_loss_log = false);
172
198 const geometry::PointCloud &source,
199 const geometry::PointCloud &target,
200 const std::vector<double> &voxel_sizes,
201 const std::vector<ICPConvergenceCriteria> &criteria_list,
202 const std::vector<double> &max_correspondence_distances,
203 const core::Tensor &init_source_to_target =
205 const TransformationEstimation &estimation =
207 const bool save_loss_log = false);
208
220 const geometry::PointCloud &target,
221 const double max_correspondence_distance,
222 const core::Tensor &transformation);
223
224} // namespace registration
225} // namespace pipelines
226} // namespace t
227} // namespace open3d
Definition: Device.h:39
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:392
A point cloud contains a list of 3D points.
Definition: PointCloud.h:95
Definition: TensorMap.h:49
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:115
RegistrationResult(const core::Tensor &transformation=core::Tensor::Eye(4, core::Float64, core::Device("CPU:0")), bool save_loss_log=false)
Parameterized Constructor.
Definition: Registration.h:93
~RegistrationResult()
Definition: Registration.h:102
bool IsBetterRANSACThan(const RegistrationResult &other) const
Definition: Registration.h:104
double fitness_
Definition: Registration.h:120
core::Tensor transformation_
The estimated transformation matrix of dtype Float64 on CPU device.
Definition: Registration.h:111
t::geometry::TensorMap loss_log_
Definition: Registration.h:126
double inlier_rmse_
RMSE of all inlier correspondences. Lower is better.
Definition: Registration.h:117
bool save_loss_log_
To store iteration-wise information in loss_log_, mark this as True.
Definition: Registration.h:122
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 bool save_loss_log)
Functions for Multi-Scale ICP registration. It will run ICP on different voxel level,...
Definition: Registration.cpp:362
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:440
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:82
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 bool save_loss_log)
Functions for ICP registration.
Definition: Registration.cpp:114
Definition: PinholeCameraIntrinsic.cpp:35