MRPT  1.9.9
SubgraphMatcher.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://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 #pragma once
17 
18 #include <mrpt/config.h>
19 #if MRPT_HAS_PCL
20 
21 #include <mrpt/pbmap/PbMap.h>
22 #include <mrpt/pbmap/Subgraph.h>
24 
25 namespace mrpt::pbmap
26 {
27 /*!This class finds the best correspondence between the planes of two subgraphs
28  * (i.e. sets of neighbor planes).
29  * It relies on an interpretation tree employing geometric restrictions that are
30  * represented as a set of unary and binary constraints.
31  *
32  * \ingroup mrpt_pbmap_grp
33  */
35 {
36  public:
38 
39  /*!Check if the two input planes fulfill a set of geometric constraints, and
40  * so, if they are candidates to be the same plane.*/
42  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
43  bool useStructure = false);
45  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
46  bool useStructure = false);
48  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
49  bool useStructure = false);
51  Plane& plane1, Plane& plane2, PbMap& trgPbMap,
52  bool useStructure = false);
53 
54  /*!Check if the two pair of planes plane1-plane2 ans planeA-planeB fulfill
55  the same geometric relationship, and so,
56  if they are candidates to be the same planes.*/
58  Plane& plane1, Plane& plane2, Plane& planeA, Plane& planeB);
60  Plane& plane1, Plane& plane2, Plane& planeA, Plane& planeB);
61 
62  /*!List of combinations that have been explored in the interpretation
63  * tree.*/ // Cambiar
64  // nombre
65  std::vector<std::map<unsigned, unsigned>> alreadyExplored;
66 
67  /*!Find the best combination of planes correspondences given two subgraphs
68  * represeting local neighborhoods of planes.*/ // Cambiar nombre o Quitar!
70  std::set<unsigned>& evalRef, std::set<unsigned>& evalCheck,
71  std::map<unsigned, unsigned>& matched);
73  std::set<unsigned>& evalRef, std::set<unsigned>& evalCheck,
74  std::map<unsigned, unsigned>& matched);
75 
76  /*!Set source (current) subgraph.*/
77  void inline setSourceSubgraph(Subgraph& subgSrc) { subgraphSrc = &subgSrc; }
78  /*!Set target subgraph.*/
79  void inline setTargetSubgraph(Subgraph& subgTrg) { subgraphTrg = &subgTrg; }
80  /*!Returns a list with plane matches from subgraphSrc to subgraphTrg.*/
81  // std::map<unsigned,unsigned> compareSubgraphs(Subgraph &subgraphSource,
82  // Subgraph &subgraphTarget);
83  std::map<unsigned, unsigned> compareSubgraphs(
84  Subgraph& subgraphSource, Subgraph& subgraphTarget,
85  const int option = 0); // Options are
86 
87  /*!One subgraph to be matched.*/
89 
90  /*!The other subgraph to be matched.*/
92 
94 
98 
99  /*!Return the total area of the matched planes in the frame source.*/
100  float calcAreaMatched(std::map<unsigned, unsigned>& matched_planes);
101 
102  /*!Set of thresholds for PbMap matching.*/
104 
105  private:
106  /*!List of planes correspondences.*/
107  std::map<unsigned, unsigned> winnerMatch;
109 
110  /*!Hash table for unary constraints.*/
111  std::vector<std::vector<int8_t>> hashUnaryConstraints;
112 
113  float calcAreaUnmatched(std::set<unsigned>& unmatched_planes);
114 };
115 } // namespace mrpt::pbmap
116 #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:43
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:44



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019