MRPT  1.9.9
heuristicParams.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 /* Plane-based Map (PbMap) library
11  * Construction of plane-based maps and localization in it from RGBD Images.
12  * Writen by Eduardo Fernandez-Moral. See docs for <a
13  * href="group__mrpt__pbmap__grp.html" >mrpt-pbmap</a>
14  */
15 
16 #pragma once
17 
19 #include <mrpt/system/filesystem.h>
20 
21 namespace mrpt::pbmap
22 {
23 /** A class used to define the heuristic parameters and thresholds used to match
24  * sets of planes.
25  * These parameters are loaded from a configuration file.
26  *
27  * \ingroup mrpt_pbmap_grp
28  */
30 {
31  // [global]
32  /*! Global parameter to indicate the path to previous PbMaps used for place
33  * recognition*/
35 
36  /*! Global parameter indicating the minimum required plane matches for place
37  * recognition*/
38  unsigned min_planes_recognition; // Minimum number of planes to accept a
39  // match between two neighborhoods of
40  // planes
41  bool use_structure; // Use inferred knowledge
42  bool use_completeness; // Use inferred knowledge
43 
44  // [unary]
45  /*! Unary constraint threshold to limit the difference of distances between
46  * two pairs camera-plane (to be used in odometry, i.e. when the two cameras
47  * are nearby */
48  float dist_d;
49  float angle;
50 
54  // float colorDev_threshold;
58  area_half_threshold_inv; // Constraint with "half confidence": one
59  // plana is fully observed
60  float elongation_threshold, elongation_threshold_inv; // Unary constraint:
61  int graph_mode; // This var selects the condition to create edges in the
62  // graph, either proximity of planar patches or
63  // co-visibility in a single frame
64 
65  // [binary]
66  /*! Binary constraint threshold to limit the difference of distances between
67  * the centers of two pair of planes. This threashold should be loose if the
68  * plane boundaries are not known, which is the most common situation */
70  float angle_threshold; // Binary constraint: the angle between the normals
71  // of two pair of planes
72  float height_threshold; // Binary constraint: Height from one plane wrt a
73  // neighbor (in meters)
74  float height_threshold_parallel; // Binary constraint: Height from one
75  // plane wrt a neighbor (in meters) for
76  // complete marked planes
78 
79  /*! Load the PbMap registration thresholds from an .ini file */
80  void load_params(const std::string& config_file_name)
81  {
82  ASSERT_FILE_EXISTS_(config_file_name);
83  mrpt::config::CConfigFile config_file(config_file_name);
84 
85  // global
87  config_file.read_string("global", "path_prev_pbmaps", "", false);
88  // std::cout << path_prev_pbmaps << std::endl;
89  use_structure = config_file.read_bool("global", "use_structure", true);
91  config_file.read_bool("global", "use_completeness", true);
93  config_file.read_int("global", "min_planes_recognition", 4);
94  graph_mode = config_file.read_int("global", "graph_mode", 1);
95 
96  // Unary constraints
97  dist_d = config_file.read_float("unary", "dist_d", 0.5);
98  angle = config_file.read_float("unary", "angle", 50);
99  angle = cos(angle * 3.14159 / 180);
100 
102  config_file.read_float("unary", "color_threshold", 0.09);
104  config_file.read_float("unary", "intensity_threshold", 175.0);
105  hue_threshold = config_file.read_float("unary", "hue_threshold", 0.3);
106  // colorDev_threshold =
107  // config_file.read_float("unary","colorDev_threshold",0.005);
108  area_threshold = config_file.read_float("unary", "area_threshold", 3.0);
111  config_file.read_float("unary", "area_full_threshold", 1.6);
114  config_file.read_float("unary", "area_half_threshold", 2.0);
117  config_file.read_float("unary", "elongation_threshold", 2.9);
119 
120  // Binary constraints
122  config_file.read_float("binary", "dist_threshold", 2.0);
125  config_file.read_float("binary", "angle_threshold", 7.0);
127  config_file.read_float("binary", "height_threshold", 0.2);
129  config_file.read_float("binary", "height_threshold_parallel", 0.2);
131  config_file.read_float("binary", "cos_angle_parallel", 0.985);
132  };
133 
134  /*! Print the threshold for registration */
136  {
137  using std::cout;
138  using std::endl;
139 
140  cout << "Unary thresholds:\n";
141  cout << "dist_d " << dist_d << endl;
142  cout << "angle " << angle << endl;
143  cout << "color_threshold " << color_threshold << endl;
144  cout << "intensity_threshold " << intensity_threshold << endl;
145  cout << "hue_threshold " << hue_threshold << endl;
146  cout << "area_threshold " << area_threshold << endl;
147  cout << "elongation_threshold " << elongation_threshold << endl;
148 
149  cout << "Binary thresholds:\n";
150  cout << "angle_threshold " << angle_threshold << endl;
151  cout << "angle " << angle << endl;
152  cout << "height_threshold " << height_threshold << endl;
153  };
154 };
155 } // namespace mrpt::pbmap
void load_params(const std::string &config_file_name)
std::string read_string(const std::string &section, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
This class allows loading and storing values and vectors of different types from ".ini" files easily.
float read_float(const std::string &section, const std::string &name, float defaultValue, bool failIfNotFound=false) const
int read_int(const std::string &section, const std::string &name, int defaultValue, bool failIfNotFound=false) const
GLsizei const GLchar ** string
Definition: glext.h:4116
bool read_bool(const std::string &section, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
A class used to define the heuristic parameters and thresholds used to match sets of planes...
#define ASSERT_FILE_EXISTS_(FIL)
Definition: filesystem.h:21



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019