Open3D (C++ API)  0.12.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 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:
88  RegistrationResult(const core::Tensor &transformation)
89  : transformation_(transformation), inlier_rmse_(0.0), fitness_(0.0) {}
91  bool IsBetterRANSACThan(const RegistrationResult &other) const {
92  return fitness_ > other.fitness_ || (fitness_ == other.fitness_ &&
93  inlier_rmse_ < other.inlier_rmse_);
94  }
95 
96 public:
108  double inlier_rmse_;
111  double fitness_;
112 };
113 
123  const geometry::PointCloud &source,
124  const geometry::PointCloud &target,
125  double max_correspondence_distance,
126  const core::Tensor &transformation = core::Tensor::Eye(
127  4, core::Dtype::Float32, core::Device("CPU:0")));
128 
139  const geometry::PointCloud &source,
140  const geometry::PointCloud &target,
141  double max_correspondence_distance,
142  const core::Tensor &init,
143  const TransformationEstimation &estimation =
145  const ICPConvergenceCriteria &criteria = ICPConvergenceCriteria());
146 
147 } // namespace registration
148 } // namespace pipelines
149 } // namespace t
150 } // namespace open3d
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
core::Tensor correspondence_set_
Definition: Registration.h:106
core::Tensor transformation_
The estimated transformation matrix.
Definition: Registration.h:98
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:111
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:108
Definition: Device.h:39
A pointcloud contains a set of 3D points.
Definition: PointCloud.h:94
bool IsBetterRANSACThan(const RegistrationResult &other) const
Definition: Registration.h:91
static const Dtype Float32
Definition: Dtype.h:42
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Tensor.h:48
~RegistrationResult()
Definition: Registration.h:90
core::Tensor correspondence_select_bool_
Definition: Registration.h:102
double relative_rmse_
Definition: Registration.h:75
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create a identity matrix of size n x n.
Definition: Tensor.cpp:194
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
RegistrationResult(const core::Tensor &transformation)
Parameterized Constructor.
Definition: Registration.h:88
Definition: TransformationEstimation.h:69