Matcher_Planes_Normals.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  * ------------------------------------------------------------------------- */
13 // TODO
14 
15 // Parameter:
18 // TODO: Move to a new plane-to-plane matcher
19 // double thresholdPlane2PlaneNormalAng{mrpt::DEG2RAD(5.0)};
20 
21 #if 0
22 
23 #include <mp2p_icp/Matcher_Planes_Normals.h>
24 
25 IMPLEMENTS_MRPT_OBJECT(Matcher_Points_DistanceThreshold, Matcher, mp2p_icp);
26 
27 using namespace mp2p_icp;
28 
29 void f()
30 {
31  // Plane-to-plane correspondence:
32 
33  // We have pairs of planes whose centroids are quite close.
34  // Check their normals too:
35  for (const auto& pair : mpl)
36  {
37  // 1) Check fo pairing sanity:
38  ASSERTDEB_(pair.this_idx < pcs1.planes.size());
39  ASSERTDEB_(pair.other_idx < pcs2.planes.size());
40 
41  const auto& p1 = s.pc1.planes[pair.this_idx];
42  const auto& p2 = s.pc2.planes[pair.other_idx];
43 
44  const mrpt::math::TVector3D n1 = p1.plane.getNormalVector();
45  const mrpt::math::TVector3D n2 = p2.plane.getNormalVector();
46 
47  // dot product to find the angle between normals:
48  const double dp = n1.x * n2.x + n1.y * n2.y + n1.z * n2.z;
49  const double n2n_ang = std::acos(dp);
50 
51  // 2) append to list of plane pairs:
52  if (n2n_ang < p.thresholdPlane2PlaneNormalAng)
53  {
54  // Accept pairing:
55  pairings.paired_pl2pl.emplace_back(p1, p2);
56  }
57  }
58 }
59 
60 void f2()
61 {
62  // point-to-planes
63  if (!p.pt2pl_layer.empty())
64  {
65  const auto &m1 = s.pc1.point_layers.at("plane_centroids"),
66  &m2 = s.pc2.point_layers.at(p.pt2pl_layer);
67  ASSERT_(m1);
68  ASSERT_(m2);
69 
70  auto& mp = s.mps.at(p.pt2pl_layer);
71  // Measure angle distances from the current estimate:
72  mp.angularDistPivotPoint =
73  mrpt::math::TPoint3D(s.currentSolutionasTPose());
74 
75  // Find closest pairings
76  mrpt::tfest::TMatchingPairList mpl;
77  m1->determineMatching3D(
78  m2.get(), s.currentSolution mpl, mp, s.mres[p.pt2pl_layer]);
79  // Plane-to-plane correspondence:
80 
81  // We have pairs of planes whose centroids are quite close.
82  // Check their normals too:
83  for (const auto& pair : mpl)
84  {
85  // 1) Check fo pairing sanity:
86  ASSERTDEB_(pair.this_idx < pcs1.planes.size());
87  ASSERTDEB_(pair.other_idx < m2->size());
88 
89  const auto& pl_this = s.pc1.planes[pair.this_idx];
90  mrpt::math::TPoint3Df pt_other;
91  m2->getPoint(pair.other_idx, pt_other.x, pt_other.y, pt_other.z);
92 
93  // 2) append to list of plane pairs:
94  // Accept pairing:
95  pairings.paired_pt2pl.emplace_back(pl_this, pt_other);
96  }
97  }
98  out.potential_pairings += pcLocal.size() * maxPt2PtCorrespondences;
99 }
100 
101 #endif
std::tr1::f2
const T1 const T2 & f2
Definition: gtest.h:1321
mp2p_icp
Definition: covariance.h:17
s
XmlRpcServer s
kitti-run-seq.f
string f
Definition: kitti-run-seq.py:12
kitti-batch-convert.out
string out
Definition: kitti-batch-convert.py:7
IMPLEMENTS_MRPT_OBJECT
IMPLEMENTS_MRPT_OBJECT(QualityEvaluator_RangeImageSimilarity, QualityEvaluator, mp2p_icp) using namespace mp2p_icp


mp2p_icp
Author(s):
autogenerated on Wed Oct 23 2024 02:45:40