Main MRPT website > C++ reference for 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-2017, 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 
19 #include <mrpt/utils/CConfigFile.h>
20 #include <mrpt/system/filesystem.h>
21 
22 namespace mrpt
23 {
24 namespace pbmap
25 {
26 /** A class used to define the heuristic parameters and thresholds used to match
27  * sets of planes.
28  * These parameters are loaded from a configuration file.
29  *
30  * \ingroup mrpt_pbmap_grp
31  */
33 {
34  // [global]
35  /*! Global parameter to indicate the path to previous PbMaps used for place
36  * recognition*/
38 
39  /*! Global parameter indicating the minimum required plane matches for place
40  * recognition*/
41  unsigned min_planes_recognition; // Minimum number of planes to accept a
42  // match between two neighborhoods of
43  // planes
44  bool use_structure; // Use inferred knowledge
45  bool use_completeness; // Use inferred knowledge
46 
47  // [unary]
48  /*! Unary constraint threshold to limit the difference of distances between
49  * two pairs camera-plane (to be used in odometry, i.e. when the two cameras
50  * are nearby */
51  float dist_d;
52  float angle;
53 
57  // float colorDev_threshold;
61  area_half_threshold_inv; // Constraint with "half confidence": one
62  // plana is fully observed
63  float elongation_threshold, elongation_threshold_inv; // Unary constraint:
64  int graph_mode; // This var selects the condition to create edges in the
65  // graph, either proximity of planar patches or
66  // co-visibility in a single frame
67 
68  // [binary]
69  /*! Binary constraint threshold to limit the difference of distances between
70  * the centers of two pair of planes. This threashold should be loose if the
71  * plane boundaries are not known, which is the most common situation */
73  float angle_threshold; // Binary constraint: the angle between the normals
74  // of two pair of planes
75  float height_threshold; // Binary constraint: Height from one plane wrt a
76  // neighbor (in meters)
77  float height_threshold_parallel; // Binary constraint: Height from one
78  // plane wrt a neighbor (in meters) for
79  // complete marked planes
81 
82  /*! Load the PbMap registration thresholds from an .ini file */
83  void load_params(const std::string& config_file_name)
84  {
85  ASSERT_FILE_EXISTS_(config_file_name)
86  mrpt::utils::CConfigFile config_file(config_file_name);
87 
88  // global
90  config_file.read_string("global", "path_prev_pbmaps", "", false);
91  // std::cout << path_prev_pbmaps << std::endl;
92  use_structure = config_file.read_bool("global", "use_structure", true);
94  config_file.read_bool("global", "use_completeness", true);
96  config_file.read_int("global", "min_planes_recognition", 4);
97  graph_mode = config_file.read_int("global", "graph_mode", 1);
98 
99  // Unary constraints
100  dist_d = config_file.read_float("unary", "dist_d", 0.5);
101  angle = config_file.read_float("unary", "angle", 50);
102  angle = cos(angle * 3.14159 / 180);
103 
105  config_file.read_float("unary", "color_threshold", 0.09);
107  config_file.read_float("unary", "intensity_threshold", 175.0);
108  hue_threshold = config_file.read_float("unary", "hue_threshold", 0.3);
109  // colorDev_threshold =
110  // config_file.read_float("unary","colorDev_threshold",0.005);
111  area_threshold = config_file.read_float("unary", "area_threshold", 3.0);
114  config_file.read_float("unary", "area_full_threshold", 1.6);
117  config_file.read_float("unary", "area_half_threshold", 2.0);
120  config_file.read_float("unary", "elongation_threshold", 2.9);
122 
123  // Binary constraints
125  config_file.read_float("binary", "dist_threshold", 2.0);
128  config_file.read_float("binary", "angle_threshold", 7.0);
130  config_file.read_float("binary", "height_threshold", 0.2);
132  config_file.read_float("binary", "height_threshold_parallel", 0.2);
134  config_file.read_float("binary", "cos_angle_parallel", 0.985);
135  };
136 
137  /*! Print the threshold for registration */
139  {
140  using std::cout;
141  using std::endl;
142 
143  cout << "Unary thresholds:\n";
144  cout << "dist_d " << dist_d << endl;
145  cout << "angle " << angle << endl;
146  cout << "color_threshold " << color_threshold << endl;
147  cout << "intensity_threshold " << intensity_threshold << endl;
148  cout << "hue_threshold " << hue_threshold << endl;
149  cout << "area_threshold " << area_threshold << endl;
150  cout << "elongation_threshold " << elongation_threshold << endl;
151 
152  cout << "Binary thresholds:\n";
153  cout << "angle_threshold " << angle_threshold << endl;
154  cout << "angle " << angle << endl;
155  cout << "height_threshold " << height_threshold << endl;
156  };
157 };
158 }
159 } // End of namespaces
160 
161 #endif
void load_params(const std::string &config_file_name)
bool read_bool(const std::string &section, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
float read_float(const std::string &section, const std::string &name, float defaultValue, bool failIfNotFound=false) const
This class allows loading and storing values and vectors of different types from ".ini" files easily.
Definition: CConfigFile.h:35
std::string read_string(const std::string &section, const std::string &name, const std::string &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
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to define the heuristic parameters and thresholds used to match sets of planes...
#define ASSERT_FILE_EXISTS_(FIL)



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019