Main MRPT website > C++ reference for MRPT 1.9.9
SubgraphMatcher.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 __SUBGRAPHMATCHER_H
17 #define __SUBGRAPHMATCHER_H
18 
19 #include <mrpt/config.h>
20 #if MRPT_HAS_PCL
21 
22 #include <mrpt/utils/utils_defs.h>
23 
25 #include <mrpt/pbmap/PbMap.h>
26 #include <mrpt/pbmap/Subgraph.h>
27 
28 namespace mrpt
29 {
30 namespace pbmap
31 {
32 /*!This class finds the best correspondence between the planes of two subgraphs
33  * (i.e. sets of neighbor planes).
34  * It relies on an interpretation tree employing geometric restrictions that are
35  * represented as a set of unary and binary constraints.
36  *
37  * \ingroup mrpt_pbmap_grp
38  */
40 {
41  public:
43 
44  /*!Check if the two input planes fulfill a set of geometric constraints, and
45  * so, if they are candidates to be the same plane.*/
47  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
48  bool useStructure = false);
50  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
51  bool useStructure = false);
53  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
54  bool useStructure = false);
56  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
57  bool useStructure = false);
58 
59  /*!Check if the two pair of planes plane1-plane2 ans planeA-planeB fulfill
60  the same geometric relationship, and so,
61  if they are candidates to be the same planes.*/
63  Plane& plane1, Plane& plane2, Plane& planeA, Plane& planeB);
65  Plane& plane1, Plane& plane2, Plane& planeA, Plane& planeB);
66 
67  /*!List of combinations that have been explored in the interpretation tree.*/ // Cambiar nombre
68  std::vector<std::map<unsigned, unsigned>> alreadyExplored;
69 
70  /*!Find the best combination of planes correspondences given two subgraphs represeting local neighborhoods of planes.*/ // Cambiar nombre o Quitar!
72  std::set<unsigned>& evalRef, std::set<unsigned>& evalCheck,
73  std::map<unsigned, unsigned>& matched);
75  std::set<unsigned>& evalRef, std::set<unsigned>& evalCheck,
76  std::map<unsigned, unsigned>& matched);
77 
78  /*!Set source (current) subgraph.*/
79  void inline setSourceSubgraph(Subgraph& subgSrc) { subgraphSrc = &subgSrc; }
80  /*!Set target subgraph.*/
81  void inline setTargetSubgraph(Subgraph& subgTrg) { subgraphTrg = &subgTrg; }
82  /*!Returns a list with plane matches from subgraphSrc to subgraphTrg.*/
83  // std::map<unsigned,unsigned> compareSubgraphs(Subgraph &subgraphSource,
84  // Subgraph &subgraphTarget);
85  std::map<unsigned, unsigned> compareSubgraphs(
86  Subgraph& subgraphSource, Subgraph& subgraphTarget,
87  const int option = 0); // Options are
88 
89  /*!One subgraph to be matched.*/
91 
92  /*!The other subgraph to be matched.*/
94 
96 
100 
101  /*!Return the total area of the matched planes in the frame source.*/
102  float calcAreaMatched(std::map<unsigned, unsigned>& matched_planes);
103 
104  /*!Set of thresholds for PbMap matching.*/
106 
107  private:
108  /*!List of planes correspondences.*/
109  std::map<unsigned, unsigned> winnerMatch;
111 
112  /*!Hash table for unary constraints.*/
113  std::vector<std::vector<int8_t>> hashUnaryConstraints;
114 
115  float calcAreaUnmatched(std::set<unsigned>& unmatched_planes);
116 };
117 }
118 } // End of namespaces
119 
120 #endif
121 #endif
std::vector< std::vector< int8_t > > hashUnaryConstraints
bool evalUnaryConstraints2D(Plane &plane1, Plane &plane2, PbMap &trgPbMap, bool useStructure=false)
void exploreSubgraphTreeR_Area(std::set< unsigned > &evalRef, std::set< unsigned > &evalCheck, std::map< unsigned, unsigned > &matched)
A class used to store a planar feature (Plane for short).
Definition: Plane.h:48
bool evalBinaryConstraintsOdometry(Plane &plane1, Plane &plane2, Plane &planeA, Plane &planeB)
bool evalUnaryConstraintsOdometry(Plane &plane1, Plane &plane2, PbMap &trgPbMap, bool useStructure=false)
void setTargetSubgraph(Subgraph &subgTrg)
std::map< unsigned, unsigned > winnerMatch
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool evalUnaryConstraintsOdometry2D(Plane &plane1, Plane &plane2, PbMap &trgPbMap, bool useStructure=false)
void exploreSubgraphTreeR(std::set< unsigned > &evalRef, std::set< unsigned > &evalCheck, std::map< unsigned, unsigned > &matched)
! Recursive function that checks all the relations (direct and crossed) in the neighborhood of a plan...
config_heuristics configLocaliser
std::map< unsigned, unsigned > compareSubgraphs(Subgraph &subgraphSource, Subgraph &subgraphTarget, const int option=0)
std::vector< std::map< unsigned, unsigned > > alreadyExplored
float calcAreaMatched(std::map< unsigned, unsigned > &matched_planes)
A class used to define the heuristic parameters and thresholds used to match sets of planes...
bool evalUnaryConstraints(Plane &plane1, Plane &plane2, PbMap &trgPbMap, bool useStructure=false)
! Check if the two input planes could be the same
bool evalBinaryConstraints(Plane &plane1, Plane &plane2, Plane &planeA, Plane &planeB)
! Compares the relation between Ref-neigRef with the relation between Check-neigCheck.
float calcAreaUnmatched(std::set< unsigned > &unmatched_planes)
void setSourceSubgraph(Subgraph &subgSrc)
A class used to store a Plane-based Map (PbMap).
Definition: pbmap/PbMap.h:49



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