Main MRPT website > C++ reference for MRPT 1.5.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 href="group__mrpt__pbmap__grp.html" >mrpt-pbmap</a>
13  */
14 
15 #ifndef __HEURISTICPARAMS_H
16 #define __HEURISTICPARAMS_H
17 
18 #include <mrpt/utils/CConfigFile.h>
19 #include <mrpt/system/filesystem.h>
21 
22 namespace mrpt {
23 namespace pbmap {
24 
25  /** A class used to define the heuristic parameters and thresholds used to match 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 recognition*/
35 
36  /*! Global parameter indicating the minimum required plane matches for place recognition*/
37  unsigned min_planes_recognition; // Minimum number of planes to accept a match between two neighborhoods of planes
38  bool use_structure; // Use inferred knowledge
39  bool use_completeness; // Use inferred knowledge
40 
41  // [unary]
42  /*! Unary constraint threshold to limit the difference of distances between two pairs camera-plane (to be used in odometry, i.e. when the two cameras are nearby */
43  float dist_d;
44  float angle;
45 
49 // float colorDev_threshold;
50  float area_threshold, area_threshold_inv;
51  float area_full_threshold, area_full_threshold_inv;
52  float area_half_threshold, area_half_threshold_inv; // Constraint with "half confidence": one plana is fully observed
53  float elongation_threshold, elongation_threshold_inv; // Unary constraint:
54  int graph_mode; // This var selects the condition to create edges in the graph, either proximity of planar patches or co-visibility in a single frame
55 
56  // [binary]
57  /*! Binary constraint threshold to limit the difference of distances between the centers of two pair of planes. This threashold should be loose if the plane boundaries are not known, which is the most common situation */
58  float dist_threshold, dist_threshold_inv;
59  float angle_threshold; // Binary constraint: the angle between the normals of two pair of planes
60  float height_threshold; // Binary constraint: Height from one plane wrt a neighbor (in meters)
61  float height_threshold_parallel; // Binary constraint: Height from one plane wrt a neighbor (in meters) for complete marked planes
63 
64 
65  /*! Load the PbMap registration thresholds from an .ini file */
66  void load_params(const std::string &config_file_name)
67  {
68  ASSERT_FILE_EXISTS_(config_file_name)
69  mrpt::utils::CConfigFile config_file(config_file_name);
70 
71  // global
72  path_prev_pbmaps = config_file.read_string("global","path_prev_pbmaps","",false);
73  // std::cout << path_prev_pbmaps << std::endl;
74  use_structure = config_file.read_bool("global","use_structure",true);
75  use_completeness = config_file.read_bool("global","use_completeness",true);
76  min_planes_recognition = config_file.read_int("global","min_planes_recognition",4);
77  graph_mode = config_file.read_int("global","graph_mode",1);
78 
79  // Unary constraints
80  dist_d = config_file.read_float("unary","dist_d",0.5);
81  angle = config_file.read_float("unary","angle",50);
82  angle = cos(angle*3.14159/180);
83 
84  color_threshold = config_file.read_float("unary","color_threshold",0.09);
85  intensity_threshold = config_file.read_float("unary","intensity_threshold",175.0);
86  hue_threshold = config_file.read_float("unary","hue_threshold",0.3);
87 // colorDev_threshold = config_file.read_float("unary","colorDev_threshold",0.005);
88  area_threshold = config_file.read_float("unary","area_threshold",3.0);
89  area_threshold_inv = 1/area_threshold;
90  area_full_threshold = config_file.read_float("unary","area_full_threshold",1.6);
91  area_full_threshold_inv = 1/area_full_threshold;
92  area_half_threshold = config_file.read_float("unary","area_half_threshold",2.0);
93  area_half_threshold_inv = 1/area_half_threshold;
94  elongation_threshold = config_file.read_float("unary","elongation_threshold",2.9);
95  elongation_threshold_inv = 1/elongation_threshold;
96 
97  // Binary constraints
98  dist_threshold = config_file.read_float("binary","dist_threshold",2.0);
99  dist_threshold_inv = 1/dist_threshold;
100  angle_threshold = config_file.read_float("binary","angle_threshold",7.0);
101  height_threshold = config_file.read_float("binary","height_threshold",0.2);
102  height_threshold_parallel = config_file.read_float("binary","height_threshold_parallel",0.2);
103  cos_angle_parallel = config_file.read_float("binary","cos_angle_parallel",0.985);
104 
105  };
106 
107  /*! Print the threshold for registration */
109  {
110  using std::cout; using std::endl;
111 
112  cout << "Unary thresholds:\n";
113  cout << "dist_d " << dist_d << endl;
114  cout << "angle " << angle << endl;
115  cout << "color_threshold " << color_threshold << endl;
116  cout << "intensity_threshold " << intensity_threshold << endl;
117  cout << "hue_threshold " << hue_threshold << endl;
118  cout << "area_threshold " << area_threshold << endl;
119  cout << "elongation_threshold " << elongation_threshold << endl;
120 
121  cout << "Binary thresholds:\n";
122  cout << "angle_threshold " << angle_threshold << endl;
123  cout << "angle " << angle << endl;
124  cout << "height_threshold " << height_threshold << endl;
125  };
126  };
127 
128 } } // End of namespaces
129 
130 #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:30
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:3919
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.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020