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-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 __SUBGRAPHMATCHER_H
17 #define __SUBGRAPHMATCHER_H
18 
19 #include <mrpt/config.h>
20 #if MRPT_HAS_PCL
21 
23 #include <mrpt/pbmap/PbMap.h>
24 #include <mrpt/pbmap/Subgraph.h>
25 
26 namespace mrpt::pbmap
27 {
28 /*!This class finds the best correspondence between the planes of two subgraphs
29  * (i.e. sets of neighbor planes).
30  * It relies on an interpretation tree employing geometric restrictions that are
31  * represented as a set of unary and binary constraints.
32  *
33  * \ingroup mrpt_pbmap_grp
34  */
36 {
37  public:
39 
40  /*!Check if the two input planes fulfill a set of geometric constraints, and
41  * so, if they are candidates to be the same plane.*/
43  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
44  bool useStructure = false);
46  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
47  bool useStructure = false);
49  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
50  bool useStructure = false);
52  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
53  bool useStructure = false);
54 
55  /*!Check if the two pair of planes plane1-plane2 ans planeA-planeB fulfill
56  the same geometric relationship, and so,
57  if they are candidates to be the same planes.*/
59  Plane& plane1, Plane& plane2, Plane& planeA, Plane& planeB);
61  Plane& plane1, Plane& plane2, Plane& planeA, Plane& planeB);
62 
63  /*!List of combinations that have been explored in the interpretation tree.*/ // Cambiar nombre
64  std::vector<std::map<unsigned, unsigned>> alreadyExplored;
65 
66  /*!Find the best combination of planes correspondences given two subgraphs represeting local neighborhoods of planes.*/ // Cambiar nombre o Quitar!
68  std::set<unsigned>& evalRef, std::set<unsigned>& evalCheck,
69  std::map<unsigned, unsigned>& matched);
71  std::set<unsigned>& evalRef, std::set<unsigned>& evalCheck,
72  std::map<unsigned, unsigned>& matched);
73 
74  /*!Set source (current) subgraph.*/
75  void inline setSourceSubgraph(Subgraph& subgSrc) { subgraphSrc = &subgSrc; }
76  /*!Set target subgraph.*/
77  void inline setTargetSubgraph(Subgraph& subgTrg) { subgraphTrg = &subgTrg; }
78  /*!Returns a list with plane matches from subgraphSrc to subgraphTrg.*/
79  // std::map<unsigned,unsigned> compareSubgraphs(Subgraph &subgraphSource,
80  // Subgraph &subgraphTarget);
81  std::map<unsigned, unsigned> compareSubgraphs(
82  Subgraph& subgraphSource, Subgraph& subgraphTarget,
83  const int option = 0); // Options are
84 
85  /*!One subgraph to be matched.*/
87 
88  /*!The other subgraph to be matched.*/
90 
92 
96 
97  /*!Return the total area of the matched planes in the frame source.*/
98  float calcAreaMatched(std::map<unsigned, unsigned>& matched_planes);
99 
100  /*!Set of thresholds for PbMap matching.*/
102 
103  private:
104  /*!List of planes correspondences.*/
105  std::map<unsigned, unsigned> winnerMatch;
107 
108  /*!Hash table for unary constraints.*/
109  std::vector<std::vector<int8_t>> hashUnaryConstraints;
110 
111  float calcAreaUnmatched(std::set<unsigned>& unmatched_planes);
112 };
113 }
114 #endif
115 #endif
116 
117 
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:44
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
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:45



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