Open3D (C++ API)  0.16.1
RGBDOdometry.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
30
31#pragma once
32
33#include "open3d/core/Tensor.h"
36
37namespace open3d {
38namespace t {
39namespace pipelines {
40namespace odometry {
41
42enum class Method {
43 PointToPlane, // Implemented and commented in
44 // ComputeOdometryResultPointToPlane
45 Intensity, // Implemented and commented in ComputeOdometryResultIntensity
46 Hybrid, // Implemented and commented in ComputeOdometryResultHybrid
47};
48
50public:
60 OdometryConvergenceCriteria(int max_iteration,
61 double relative_rmse = 1e-6,
62 double relative_fitness = 1e-6)
63 : max_iteration_(max_iteration),
64 relative_rmse_(relative_rmse),
65 relative_fitness_(relative_fitness) {}
66
67public:
76};
77
79public:
87 4, core::Float64, core::Device("CPU:0")),
88 double inlier_rmse = 0.0,
89 double fitness = 0.0)
90 : transformation_(transformation),
91 inlier_rmse_(inlier_rmse),
92 fitness_(fitness) {}
93
95
96public:
103 double fitness_;
104};
105
107public:
116 OdometryLossParams(float depth_outlier_trunc = 0.07,
117 float depth_huber_delta = 0.05,
118 float intensity_huber_delta = 0.1)
119 : depth_outlier_trunc_(depth_outlier_trunc),
120 depth_huber_delta_(depth_huber_delta),
121 intensity_huber_delta_(intensity_huber_delta) {
122 if (depth_outlier_trunc_ < 0) {
124 "Depth outlier truncation < 0, outliers will be counted!");
125 }
128 "Huber delta is greater than truncation, huber norm will "
129 "degenerate to L2 norm!");
130 }
131 }
132
133public:
138};
139
165 const t::geometry::RGBDImage& source,
166 const t::geometry::RGBDImage& target,
167 const core::Tensor& intrinsics,
168 const core::Tensor& init_source_to_target =
170 const float depth_scale = 1000.0f,
171 const float depth_max = 3.0f,
172 const std::vector<OdometryConvergenceCriteria>& criteria_list = {10, 5,
173 3},
174 const Method method = Method::Hybrid,
175 const OdometryLossParams& params = OdometryLossParams());
176
203 const core::Tensor& source_vertex_map,
204 const core::Tensor& target_vertex_map,
205 const core::Tensor& target_normal_map,
206 const core::Tensor& intrinsics,
207 const core::Tensor& init_source_to_target,
208 const float depth_outlier_trunc,
209 const float depth_huber_delta);
210
245OdometryResult ComputeOdometryResultIntensity(
246 const core::Tensor& source_depth,
247 const core::Tensor& target_depth,
248 const core::Tensor& source_intensity,
249 const core::Tensor& target_intensity,
250 const core::Tensor& target_intensity_dx,
251 const core::Tensor& target_intensity_dy,
252 const core::Tensor& source_vertex_map,
253 const core::Tensor& intrinsics,
254 const core::Tensor& init_source_to_target,
255 const float depth_outlier_trunc,
256 const float intensity_huber_delta);
257
302OdometryResult ComputeOdometryResultHybrid(
303 const core::Tensor& source_depth,
304 const core::Tensor& target_depth,
305 const core::Tensor& source_intensity,
306 const core::Tensor& target_intensity,
307 const core::Tensor& target_depth_dx,
308 const core::Tensor& target_depth_dy,
309 const core::Tensor& target_intensity_dx,
310 const core::Tensor& target_intensity_dy,
311 const core::Tensor& source_vertex_map,
312 const core::Tensor& intrinsics,
313 const core::Tensor& init_source_to_target,
314 const float depth_outlier_trunc,
315 const float depth_huber_delta,
316 const float intensity_huber_delta);
317
318} // namespace odometry
319} // namespace pipelines
320} // namespace t
321} // namespace open3d
#define LogWarning(...)
Definition: Logging.h:79
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
RGBDImage A pair of color and depth images.
Definition: RGBDImage.h:40
int max_iteration_
Maximum iteration before iteration stops.
Definition: RGBDOdometry.h:69
OdometryConvergenceCriteria(int max_iteration, double relative_rmse=1e-6, double relative_fitness=1e-6)
Constructor for the convergence criteria, where we stop iterations once the criteria are met.
Definition: RGBDOdometry.h:60
double relative_fitness_
Definition: RGBDOdometry.h:75
double relative_rmse_
Definition: RGBDOdometry.h:72
float intensity_huber_delta_
Definition: RGBDOdometry.h:137
float depth_huber_delta_
Definition: RGBDOdometry.h:136
float depth_outlier_trunc_
Depth difference threshold used to filter projective associations.
Definition: RGBDOdometry.h:135
OdometryLossParams(float depth_outlier_trunc=0.07, float depth_huber_delta=0.05, float intensity_huber_delta=0.1)
Constructor for the odometry loss function.
Definition: RGBDOdometry.h:116
OdometryResult(const core::Tensor &transformation=core::Tensor::Eye(4, core::Float64, core::Device("CPU:0")), double inlier_rmse=0.0, double fitness=0.0)
Constructor for the odometry result.
Definition: RGBDOdometry.h:86
double inlier_rmse_
RMSE of all inlier. Lower is better.
Definition: RGBDOdometry.h:100
core::Tensor transformation_
The estimated transformation matrix of dtype Float64 on CPU device.
Definition: RGBDOdometry.h:98
~OdometryResult()
Definition: RGBDOdometry.h:94
double fitness_
Definition: RGBDOdometry.h:103
const Dtype Float64
Definition: Dtype.cpp:62
Method
Definition: RGBDOdometry.h:42
OdometryResult RGBDOdometryMultiScale(const RGBDImage &source, const RGBDImage &target, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_scale, const float depth_max, const std::vector< OdometryConvergenceCriteria > &criteria, const Method method, const OdometryLossParams &params)
Create an RGBD image pyramid given the original source and target RGBD images, and perform hierarchic...
Definition: RGBDOdometry.cpp:75
OdometryResult ComputeOdometryResultHybrid(const Tensor &source_depth, const Tensor &target_depth, const Tensor &source_intensity, const Tensor &target_intensity, const Tensor &target_depth_dx, const Tensor &target_depth_dy, const Tensor &target_intensity_dx, const Tensor &target_intensity_dy, const Tensor &source_vertex_map, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_outlier_trunc, const float depth_huber_delta, const float intensity_huber_delta)
Estimates the 4x4 rigid transformation T from source to target, with inlier rmse and fitness....
Definition: RGBDOdometry.cpp:472
OdometryResult ComputeOdometryResultPointToPlane(const Tensor &source_vertex_map, const Tensor &target_vertex_map, const Tensor &target_normal_map, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_outlier_trunc, const float depth_huber_delta)
Estimates the 4x4 rigid transformation T from source to target, with inlier rmse and fitness....
Definition: RGBDOdometry.cpp:411
OdometryResult ComputeOdometryResultIntensity(const Tensor &source_depth, const Tensor &target_depth, const Tensor &source_intensity, const Tensor &target_intensity, const Tensor &target_intensity_dx, const Tensor &target_intensity_dy, const Tensor &source_vertex_map, const Tensor &intrinsics, const Tensor &init_source_to_target, const float depth_outlier_trunc, const float intensity_huber_delta)
Estimates the 4x4 rigid transformation T from source to target, with inlier rmse and fitness....
Definition: RGBDOdometry.cpp:439
Definition: PinholeCameraIntrinsic.cpp:35