Solver_Horn.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  * ------------------------------------------------------------------------- */
13 #include <mp2p_icp/Solver_Horn.h>
16 #include <mrpt/core/exceptions.h>
17 #include <mrpt/math/geometry.h>
18 
19 #include <iostream>
20 
22 
23 using namespace mp2p_icp;
24 
25 void Solver_Horn::initialize(const mrpt::containers::yaml& p)
26 {
28 
29  if (p.has("pairingsWeightParameters"))
30  pairingsWeightParameters.load_from(p["pairingsWeightParameters"]);
31 }
32 
34  const Pairings& pairings, OptimalTF_Result& out,
35  [[maybe_unused]] const SolverContext& sc) const
36 {
37  MRPT_START
38 
39  out = OptimalTF_Result();
40 
41  const Pairings* effectivePairings = &pairings;
42  std::optional<Pairings> altPairings;
43 
44  if (!pairings.paired_pt2ln.empty() || !pairings.paired_pt2pl.empty())
45  {
46  altPairings = pt2ln_pl_to_pt2pt(pairings, sc);
47  effectivePairings = &altPairings.value();
48  }
49 
50  // Compute the optimal pose, and return its validity:
51  return optimal_tf_horn(*effectivePairings, pairingsWeightParameters, out);
52 
53  MRPT_END
54 }
Converter of pairings.
bool optimal_tf_horn(const mp2p_icp::Pairings &in, const WeightParameters &wp, OptimalTF_Result &result)
virtual void initialize(const mrpt::containers::yaml &params)
Definition: Solver.cpp:20
IMPLEMENTS_MRPT_OBJECT(metric_map_t, mrpt::serialization::CSerializable, mp2p_icp) using namespace mp2p_icp
void load_from(const mrpt::containers::yaml &p)
MatchedPointLineList paired_pt2ln
Definition: Pairings.h:102
Pairings pt2ln_pl_to_pt2pt(const Pairings &in, const SolverContext &sc)
bool impl_optimal_pose(const Pairings &pairings, OptimalTF_Result &out, const SolverContext &sc) const override
Definition: Solver_Horn.cpp:33
Classic Horn&#39;s solution for optimal SE(3) transformation.
ICP solver for pointclouds split in different "layers".
WeightParameters pairingsWeightParameters
Definition: Solver_Horn.h:28
MatchedPointPlaneList paired_pt2pl
Definition: Pairings.h:103
void initialize(const mrpt::containers::yaml &params) override
Definition: Solver_Horn.cpp:25


mrpt_local_obstacles
Author(s): Jose-Luis Blanco-Claraco
autogenerated on Thu Jun 1 2023 03:06:43