Open3D (C++ API)  0.18.0
SLACOptimizer.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 <string>
11 #include <vector>
12 
16 
17 namespace open3d {
18 namespace t {
19 namespace pipelines {
20 namespace slac {
21 
23 
27 
30  float voxel_size_;
31 
34 
37 
40 
43 
45  std::string slac_folder_ = "";
46  std::string GetSubfolderName() const {
47  if (voxel_size_ < 0) {
48  return fmt::format("{}/original", slac_folder_);
49  }
50  return fmt::format("{}/{:.3f}", slac_folder_, voxel_size_);
51  }
52 
66  SLACOptimizerParams(const int max_iterations = 5,
67  const float voxel_size = 0.05,
68  const float distance_threshold = 0.07,
69  const float fitness_threshold = 0.3,
70  const float regularizer_weight = 1,
71  const core::Device device = core::Device("CPU:0"),
72  const std::string slac_folder = "") {
73  if (fitness_threshold < 0) {
74  utility::LogError("fitness threshold must be positive.");
75  }
76  if (distance_threshold < 0) {
77  utility::LogError("distance threshold must be positive.");
78  }
79 
80  max_iterations_ = max_iterations;
81  voxel_size_ = voxel_size;
82  distance_threshold_ = distance_threshold;
83  fitness_threshold_ = fitness_threshold;
84  regularizer_weight_ = regularizer_weight;
85  device_ = device;
86  slac_folder_ = slac_folder;
87  }
88 };
89 
92  bool debug_ = false;
93 
97 
103  SLACDebugOption(const bool debug = false,
104  const int debug_start_node_idx = 0) {
105  if (debug_start_node_idx < 0) {
106  utility::LogError("debug_start_node_idx must be positive integer.");
107  }
108 
109  debug_ = debug;
110  debug_start_node_idx_ = debug_start_node_idx;
111  }
112 
117  SLACDebugOption(const int debug_start_node_idx) {
118  if (debug_start_node_idx < 0) {
119  utility::LogError("debug_start_node_idx must be positive integer.");
120  }
121 
122  debug_ = true;
123  debug_start_node_idx_ = debug_start_node_idx;
124  }
125 };
126 
137  const std::vector<std::string>& fnames_processed,
138  const PoseGraph& fragment_pose_graph,
139  const SLACOptimizerParams& params = SLACOptimizerParams(),
140  const SLACDebugOption& debug_option = SLACDebugOption());
141 
152 std::pair<PoseGraph, ControlGrid> RunSLACOptimizerForFragments(
153  const std::vector<std::string>& fragment_filenames,
154  const PoseGraph& fragment_pose_graph,
155  const SLACOptimizerParams& params = SLACOptimizerParams(),
156  const SLACDebugOption& debug_option = SLACDebugOption());
157 
167  const std::vector<std::string>& fragment_filenames,
168  const PoseGraph& fragment_pose_graph,
169  const SLACOptimizerParams& params = SLACOptimizerParams(),
170  const SLACDebugOption& debug_option = SLACDebugOption());
171 
172 } // namespace slac
173 } // namespace pipelines
174 } // namespace t
175 } // namespace open3d
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:195
#define LogError(...)
Definition: Logging.h:48
Definition: Device.h:18
Data structure defining the pose graph.
Definition: PoseGraph.h:96
PoseGraph RunRigidOptimizerForFragments(const std::vector< std::string > &fnames, const PoseGraph &pose_graph, const SLACOptimizerParams &params, const SLACDebugOption &debug_option)
Extended ICP to simultaneously align multiple point clouds with dense pairwise point-to-plane distanc...
Definition: SLACOptimizer.cpp:369
open3d::pipelines::registration::PoseGraph PoseGraph
Definition: SLACOptimizer.h:22
void SaveCorrespondencesForPointClouds(const std::vector< std::string > &fnames_processed, const PoseGraph &pose_graph, const SLACOptimizerParams &params, const SLACDebugOption &debug_option)
Read pose graph containing loop closures and odometry to compute putative correspondences between pai...
Definition: SLACOptimizer.cpp:208
std::pair< PoseGraph, ControlGrid > RunSLACOptimizerForFragments(const std::vector< std::string > &fnames, const PoseGraph &pose_graph, const SLACOptimizerParams &params, const SLACDebugOption &debug_option)
Simultaneous Localization and Calibration: Self-Calibration of Consumer Depth Cameras,...
Definition: SLACOptimizer.cpp:297
Definition: PinholeCameraIntrinsic.cpp:16
Definition: SLACOptimizer.h:90
bool debug_
Enable debug.
Definition: SLACOptimizer.h:92
SLACDebugOption(const bool debug=false, const int debug_start_node_idx=0)
Definition: SLACOptimizer.h:103
int debug_start_node_idx_
Definition: SLACOptimizer.h:96
SLACDebugOption(const int debug_start_node_idx)
Definition: SLACOptimizer.h:117
float distance_threshold_
Distance threshold to filter inconsistent correspondences.
Definition: SLACOptimizer.h:33
std::string slac_folder_
Relative directory to store SLAC results in the dataset folder.
Definition: SLACOptimizer.h:45
SLACOptimizerParams(const int max_iterations=5, const float voxel_size=0.05, const float distance_threshold=0.07, const float fitness_threshold=0.3, const float regularizer_weight=1, const core::Device device=core::Device("CPU:0"), const std::string slac_folder="")
Definition: SLACOptimizer.h:66
float voxel_size_
Definition: SLACOptimizer.h:30
float regularizer_weight_
Weight of the regularizer.
Definition: SLACOptimizer.h:39
std::string GetSubfolderName() const
Definition: SLACOptimizer.h:46
float fitness_threshold_
Fitness threshold to filter inconsistent pairs.
Definition: SLACOptimizer.h:36
core::Device device_
Device to use.
Definition: SLACOptimizer.h:42
int max_iterations_
Number of iterations.
Definition: SLACOptimizer.h:26