QualityEvaluator_PairedRatio.cpp
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------
2  * A repertory of multi primitive-to-primitive (MP2P) ICP algorithms in C++
3  * Copyright (C) 2018-2021 Jose Luis Blanco, University of Almeria
4  * See LICENSE for license information.
5  * ------------------------------------------------------------------------- */
14 
16 
17 using namespace mp2p_icp;
18 
20  const mrpt::containers::yaml& params)
21 {
22  // By default, matchers only assign one pairing to each global point.
23  // However, in quality assesment, it DOES make sense to count several times
24  // the same global point:
25  mrpt::containers::yaml p = params;
26  if (!p.has("allowMatchAlreadyMatchedGlobalPoints"))
27  p["allowMatchAlreadyMatchedGlobalPoints"] = true;
28 
30 }
31 
33  const metric_map_t& pcGlobal, const metric_map_t& pcLocal,
34  const mrpt::poses::CPose3D& localPose,
35  [[maybe_unused]] const Pairings& pairingsFromICP) const
36 {
37  mp2p_icp::Pairings pairings;
38 
39  MatchState ms(pcGlobal, pcLocal);
40 
41  matcher_.match(pcGlobal, pcLocal, localPose, {}, ms, pairings);
42 
43  // The ratio must be accounted for using the number of points in
44  // the active layers:
45  size_t nEffectiveLocalPoints = 0;
46  if (matcher_.weight_pt2pt_layers.empty())
47  {
48  // all layers:
49  nEffectiveLocalPoints = pcLocal.size_points_only();
50  }
51  else
52  {
53  // only selected ones:
54  for (const auto& p : matcher_.weight_pt2pt_layers)
55  {
56  for (const auto& kv : p.second)
57  {
58  const auto& localLayerName = kv.first;
59  nEffectiveLocalPoints +=
60  pcLocal.point_layer(localLayerName)->size();
61  }
62  }
63  }
64 
65  ASSERT_(nEffectiveLocalPoints != 0);
66 
67  return pairings.size() / double(nEffectiveLocalPoints);
68 }
mp2p_icp::Matcher_Points_DistanceThreshold::initialize
void initialize(const mrpt::containers::yaml &params) override
Definition: Matcher_Points_DistanceThreshold.cpp:28
QualityEvaluator_PairedRatio.h
Matching quality evaluator: simple ratio [0,1] of paired entities.
mp2p_icp
Definition: covariance.h:17
mp2p_icp::Pairings
Definition: Pairings.h:94
mp2p_icp::Matcher_Points_Base::weight_pt2pt_layers
std::map< std::string, std::map< std::string, double > > weight_pt2pt_layers
Definition: Matcher_Points_Base.h:45
mp2p_icp::Matcher::match
virtual bool match(const metric_map_t &pcGlobal, const metric_map_t &pcLocal, const mrpt::poses::CPose3D &localPose, const MatchContext &mc, MatchState &ms, Pairings &out) const
Definition: mp2p_icp/src/Matcher.cpp:26
mp2p_icp::QualityEvaluator_PairedRatio::matcher_
Matcher_Points_DistanceThreshold matcher_
Definition: QualityEvaluator_PairedRatio.h:42
mp2p_icp::QualityEvaluator_PairedRatio
Definition: QualityEvaluator_PairedRatio.h:23
mp2p_icp::QualityEvaluator_PairedRatio::evaluate
double evaluate(const metric_map_t &pcGlobal, const metric_map_t &pcLocal, const mrpt::poses::CPose3D &localPose, const Pairings &pairingsFromICP) const override
Definition: QualityEvaluator_PairedRatio.cpp:32
mp2p_icp::QualityEvaluator_PairedRatio::initialize
void initialize(const mrpt::containers::yaml &params) override
Definition: QualityEvaluator_PairedRatio.cpp:19
mp2p_icp::MatchState
Definition: Matcher.h:34
mp2p_icp::metric_map_t::point_layer
mrpt::maps::CPointsMap::Ptr point_layer(const layer_name_t &name) const
Definition: metricmap.cpp:483
mp2p_icp::Pairings::size
virtual size_t size() const
Definition: Pairings.cpp:135
mp2p_icp::metric_map_t
Generic container of pointcloud(s), extracted features and other maps.
Definition: metricmap.h:47
mp2p_icp::metric_map_t::size_points_only
virtual size_t size_points_only() const
Definition: metricmap.cpp:362
IMPLEMENTS_MRPT_OBJECT
IMPLEMENTS_MRPT_OBJECT(metric_map_t, mrpt::serialization::CSerializable, mp2p_icp) using namespace mp2p_icp
mp2p_icp::QualityEvaluator
Definition: QualityEvaluator.h:26


mrpt_local_obstacles
Author(s): Jose-Luis Blanco-Claraco
autogenerated on Mon Aug 14 2023 02:09:04