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-2024 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  MCP_LOAD_OPT(params, reuse_icp_pairings);
23  MCP_LOAD_OPT(params, absolute_minimum_pairing_ratio);
24 
25  if (!reuse_icp_pairings)
26  {
27  // By default, matchers only assign one pairing to each global point.
28  // However, in quality assesment, it DOES make sense to count several
29  // times the same global point:
30  mrpt::containers::yaml p = params;
31  if (!p.has("allowMatchAlreadyMatchedGlobalPoints"))
32  p["allowMatchAlreadyMatchedGlobalPoints"] = true;
33 
35  }
36 }
37 
39  const metric_map_t& pcGlobal, const metric_map_t& pcLocal,
40  const mrpt::poses::CPose3D& localPose,
41  const Pairings& pairingsFromICP) const
42 {
43  const mp2p_icp::Pairings* pairings = nullptr;
44  mp2p_icp::Pairings newPairings;
45 
47  {
48  // Use last pairings:
49  pairings = &pairingsFromICP;
50  }
51  else
52  {
53  MatchState ms(pcGlobal, pcLocal);
54  matcher_.match(pcGlobal, pcLocal, localPose, {}, ms, newPairings);
55 
56  pairings = &newPairings;
57  }
58 
59  const auto nEffectiveLocalPoints = pairings->potential_pairings;
60 
61  Result r;
62  r.quality = nEffectiveLocalPoints
63  ? pairings->size() / double(nEffectiveLocalPoints)
64  : .0;
65 
67 
68  return r;
69 }
mp2p_icp::Matcher_Points_DistanceThreshold::initialize
void initialize(const mrpt::containers::yaml &params) override
Definition: Matcher_Points_DistanceThreshold.cpp:33
QualityEvaluator_PairedRatio.h
Matching quality evaluator: simple ratio [0,1] of paired entities.
mp2p_icp
Definition: covariance.h:17
mp2p_icp::QualityEvaluator::Result
Definition: QualityEvaluator.h:39
mp2p_icp::Pairings
Definition: Pairings.h:78
mp2p_icp::QualityEvaluator_PairedRatio::absolute_minimum_pairing_ratio
double absolute_minimum_pairing_ratio
Definition: QualityEvaluator_PairedRatio.h:56
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:27
mp2p_icp::QualityEvaluator_PairedRatio::matcher_
Matcher_Points_DistanceThreshold matcher_
Definition: QualityEvaluator_PairedRatio.h:53
mp2p_icp::QualityEvaluator_PairedRatio
Definition: QualityEvaluator_PairedRatio.h:26
mp2p_icp::Pairings::potential_pairings
uint64_t potential_pairings
Definition: Pairings.h:98
mp2p_icp::QualityEvaluator_PairedRatio::initialize
void initialize(const mrpt::containers::yaml &params) override
Definition: QualityEvaluator_PairedRatio.cpp:19
mp2p_icp::QualityEvaluator_PairedRatio::reuse_icp_pairings
bool reuse_icp_pairings
Definition: QualityEvaluator_PairedRatio.h:54
mp2p_icp::MatchState
Definition: Matcher.h:37
mp2p_icp::QualityEvaluator::Result::quality
double quality
The resulting quality measure, in the range [0,1].
Definition: QualityEvaluator.h:42
mp2p_icp::Pairings::size
virtual size_t size() const
Definition: Pairings.cpp:141
IMPLEMENTS_MRPT_OBJECT
IMPLEMENTS_MRPT_OBJECT(QualityEvaluator_RangeImageSimilarity, QualityEvaluator, mp2p_icp) using namespace mp2p_icp
mp2p_icp::QualityEvaluator::Result::hard_discard
bool hard_discard
Definition: QualityEvaluator.h:46
mp2p_icp::metric_map_t
Generic container of pointcloud(s), extracted features and other maps.
Definition: metricmap.h:49
mp2p_icp::QualityEvaluator_PairedRatio::evaluate
Result 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:38
mp2p_icp::QualityEvaluator
Definition: QualityEvaluator.h:28


mp2p_icp
Author(s):
autogenerated on Thu Dec 26 2024 03:48:12