MRPT  1.9.9
heuristicParams.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://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 #ifndef __HEURISTICPARAMS_H
17 #define __HEURISTICPARAMS_H
18 
20 #include <mrpt/system/filesystem.h>
21 
22 namespace mrpt::pbmap
23 {
24 /** A class used to define the heuristic parameters and thresholds used to match
25  * sets of planes.
26  * These parameters are loaded from a configuration file.
27  *
28  * \ingroup mrpt_pbmap_grp
29  */
31 {
32  // [global]
33  /*! Global parameter to indicate the path to previous PbMaps used for place
34  * recognition*/
36 
37  /*! Global parameter indicating the minimum required plane matches for place
38  * recognition*/
39  unsigned min_planes_recognition; // Minimum number of planes to accept a
40  // match between two neighborhoods of
41  // planes
42  bool use_structure; // Use inferred knowledge
43  bool use_completeness; // Use inferred knowledge
44 
45  // [unary]
46  /*! Unary constraint threshold to limit the difference of distances between
47  * two pairs camera-plane (to be used in odometry, i.e. when the two cameras
48  * are nearby */
49  float dist_d;
50  float angle;
51 
55  // float colorDev_threshold;
59  area_half_threshold_inv; // Constraint with "half confidence": one
60  // plana is fully observed
61  float elongation_threshold, elongation_threshold_inv; // Unary constraint:
62  int graph_mode; // This var selects the condition to create edges in the
63  // graph, either proximity of planar patches or
64  // co-visibility in a single frame
65 
66  // [binary]
67  /*! Binary constraint threshold to limit the difference of distances between
68  * the centers of two pair of planes. This threashold should be loose if the
69  * plane boundaries are not known, which is the most common situation */
71  float angle_threshold; // Binary constraint: the angle between the normals
72  // of two pair of planes
73  float height_threshold; // Binary constraint: Height from one plane wrt a
74  // neighbor (in meters)
75  float height_threshold_parallel; // Binary constraint: Height from one
76  // plane wrt a neighbor (in meters) for
77  // complete marked planes
79 
80  /*! Load the PbMap registration thresholds from an .ini file */
81  void load_params(const std::string& config_file_name)
82  {
83  ASSERT_FILE_EXISTS_(config_file_name);
84  mrpt::config::CConfigFile config_file(config_file_name);
85 
86  // global
88  config_file.read_string("global", "path_prev_pbmaps", "", false);
89  // std::cout << path_prev_pbmaps << std::endl;
90  use_structure = config_file.read_bool("global", "use_structure", true);
92  config_file.read_bool("global", "use_completeness", true);
94  config_file.read_int("global", "min_planes_recognition", 4);
95  graph_mode = config_file.read_int("global", "graph_mode", 1);
96 
97  // Unary constraints
98  dist_d = config_file.read_float("unary", "dist_d", 0.5);
99  angle = config_file.read_float("unary", "angle", 50);
100  angle = cos(angle * 3.14159 / 180);
101 
103  config_file.read_float("unary", "color_threshold", 0.09);
105  config_file.read_float("unary", "intensity_threshold", 175.0);
106  hue_threshold = config_file.read_float("unary", "hue_threshold", 0.3);
107  // colorDev_threshold =
108  // config_file.read_float("unary","colorDev_threshold",0.005);
109  area_threshold = config_file.read_float("unary", "area_threshold", 3.0);
112  config_file.read_float("unary", "area_full_threshold", 1.6);
115  config_file.read_float("unary", "area_half_threshold", 2.0);
118  config_file.read_float("unary", "elongation_threshold", 2.9);
120 
121  // Binary constraints
123  config_file.read_float("binary", "dist_threshold", 2.0);
126  config_file.read_float("binary", "angle_threshold", 7.0);
128  config_file.read_float("binary", "height_threshold", 0.2);
130  config_file.read_float("binary", "height_threshold_parallel", 0.2);
132  config_file.read_float("binary", "cos_angle_parallel", 0.985);
133  };
134 
135  /*! Print the threshold for registration */
137  {
138  using std::cout;
139  using std::endl;
140 
141  cout << "Unary thresholds:\n";
142  cout << "dist_d " << dist_d << endl;
143  cout << "angle " << angle << endl;
144  cout << "color_threshold " << color_threshold << endl;
145  cout << "intensity_threshold " << intensity_threshold << endl;
146  cout << "hue_threshold " << hue_threshold << endl;
147  cout << "area_threshold " << area_threshold << endl;
148  cout << "elongation_threshold " << elongation_threshold << endl;
149 
150  cout << "Binary thresholds:\n";
151  cout << "angle_threshold " << angle_threshold << endl;
152  cout << "angle " << angle << endl;
153  cout << "height_threshold " << height_threshold << endl;
154  };
155 };
156 }
157 #endif
158 
159 
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:4101
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020