Pairings.h
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  * ------------------------------------------------------------------------- */
12 #pragma once
13 
14 #include <mp2p_icp/plane_patch.h>
16 #include <mp2p_icp/render_params.h>
17 #include <mrpt/containers/yaml.h>
18 #include <mrpt/math/TLine3D.h>
19 #include <mrpt/serialization/CSerializable.h>
20 #include <mrpt/tfest/TMatchingPair.h>
21 #include <mrpt/typemeta/TTypeName.h>
22 
23 namespace mp2p_icp
24 {
30 {
32 
33  matched_plane_t() = default;
34  matched_plane_t(const plane_patch_t& pl_this, const plane_patch_t& pl_other)
35  : p_global(pl_this), p_local(pl_other)
36  {
37  }
38 
39  DECLARE_TTYPENAME_CLASSNAME(mp2p_icp::matched_plane_t)
40 };
41 using MatchedPlaneList = std::vector<matched_plane_t>;
42 
45 {
46  mrpt::math::TLine3D ln_global, ln_local;
47 
48  DECLARE_TTYPENAME_CLASSNAME(mp2p_icp::matched_line_t)
49 };
50 using MatchedLineList = std::vector<matched_line_t>;
51 
54 {
55  mrpt::math::TLine3D ln_global;
56  mrpt::math::TPoint3D pt_local;
57 
58  point_line_pair_t() = default;
60  const mrpt::math::TLine3D& l_global,
61  const mrpt::math::TPoint3D& p_local)
62  : ln_global(l_global), pt_local(p_local)
63  {
64  }
65 
66  DECLARE_TTYPENAME_CLASSNAME(mp2p_icp::point_line_pair_t)
67 };
68 
69 using MatchedPointLineList = std::vector<point_line_pair_t>;
70 
78 struct Pairings
79 {
80  Pairings() = default;
81  virtual ~Pairings();
82 
86  mrpt::tfest::TMatchingPairList paired_pt2pt;
93 
98  uint64_t potential_pairings = 0;
99 
104  std::vector<std::pair<std::size_t, double>> point_weights;
105 
111  virtual bool empty() const
112  {
113  return paired_pt2pt.empty() && paired_pl2pl.empty() &&
114  paired_ln2ln.empty() && paired_pt2ln.empty() &&
115  paired_pt2pl.empty();
116  }
117 
119  virtual size_t size() const;
120 
122  virtual std::string contents_summary() const;
123 
125  virtual void push_back(const Pairings& o);
126 
128  virtual void push_back(Pairings&& o);
129 
130  virtual void serializeTo(mrpt::serialization::CArchive& out) const;
131  virtual void serializeFrom(mrpt::serialization::CArchive& in);
132 
142  virtual auto get_visualization(
143  const mrpt::poses::CPose3D& localWrtGlobal,
145  -> std::shared_ptr<mrpt::opengl::CSetOfObjects>;
146 
148  virtual void get_visualization_pt2pt(
149  mrpt::opengl::CSetOfObjects& o,
150  const mrpt::poses::CPose3D& localWrtGlobal,
151  const render_params_pairings_pt2pt_t& p) const;
152 
154  virtual void get_visualization_pt2pl(
155  mrpt::opengl::CSetOfObjects& o,
156  const mrpt::poses::CPose3D& localWrtGlobal,
157  const render_params_pairings_pt2pl_t& p) const;
158 
160  virtual void get_visualization_pt2ln(
161  mrpt::opengl::CSetOfObjects& o,
162  const mrpt::poses::CPose3D& localWrtGlobal,
163  const render_params_pairings_pt2ln_t& p) const;
164 
166  DECLARE_TTYPENAME_CLASSNAME(mp2p_icp::Pairings)
167 };
168 
169 mrpt::serialization::CArchive& operator<<(
170  mrpt::serialization::CArchive& out, const Pairings& obj);
171 
172 mrpt::serialization::CArchive& operator>>(
173  mrpt::serialization::CArchive& in, Pairings& obj);
174 
181 {
182  std::vector<std::size_t> point2point;
183  std::vector<std::size_t> line2line;
184  std::vector<std::size_t> plane2plane;
185 
186  inline bool empty() const
187  {
188  return point2point.empty() && line2line.empty() && plane2plane.empty();
189  }
190  inline std::size_t size() const
191  {
192  return point2point.size() + line2line.size() + plane2plane.size();
193  }
194 };
195 
199 std::tuple<mrpt::math::TPoint3D, mrpt::math::TPoint3D> eval_centroids_robust(
200  const Pairings& in, const OutlierIndices& outliers);
201 
204 } // namespace mp2p_icp
205 
206 namespace mrpt::serialization
207 {
208 CArchive& operator<<(CArchive& out, const mp2p_icp::point_line_pair_t& obj);
209 CArchive& operator>>(CArchive& in, mp2p_icp::point_line_pair_t& obj);
210 
211 CArchive& operator<<(CArchive& out, const mp2p_icp::point_plane_pair_t& obj);
212 CArchive& operator>>(CArchive& in, mp2p_icp::point_plane_pair_t& obj);
213 
214 CArchive& operator<<(CArchive& out, const mp2p_icp::matched_line_t& obj);
215 CArchive& operator>>(CArchive& in, mp2p_icp::matched_line_t& obj);
216 
217 CArchive& operator<<(CArchive& out, const mp2p_icp::matched_plane_t& obj);
218 CArchive& operator>>(CArchive& in, mp2p_icp::matched_plane_t& obj);
219 
220 } // namespace mrpt::serialization
mp2p_icp::Pairings::paired_ln2ln
MatchedLineList paired_ln2ln
Definition: Pairings.h:91
mp2p_icp::Pairings::contents_summary
virtual std::string contents_summary() const
Definition: Pairings.cpp:158
mp2p_icp::Pairings::get_visualization_pt2ln
virtual void get_visualization_pt2ln(mrpt::opengl::CSetOfObjects &o, const mrpt::poses::CPose3D &localWrtGlobal, const render_params_pairings_pt2ln_t &p) const
Definition: Pairings.cpp:246
mp2p_icp
Definition: covariance.h:17
mp2p_icp::operator>>
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, Pairings &obj)
Definition: Pairings.cpp:55
mp2p_icp::matched_plane_t::p_global
plane_patch_t p_global
Definition: Pairings.h:31
mp2p_icp::point_plane_pair_t
Definition: point_plane_pair_t.h:26
mp2p_icp::MatchedPlaneList
std::vector< matched_plane_t > MatchedPlaneList
Definition: Pairings.h:41
point_plane_pair_t.h
Defines point_plane_pair_t.
mp2p_icp::MatchedLineList
std::vector< matched_line_t > MatchedLineList
Definition: Pairings.h:50
mp2p_icp::Pairings
Definition: Pairings.h:78
render_params.h
Render parameters for the different geometric entities.
mp2p_icp::Pairings::empty
virtual bool empty() const
Definition: Pairings.h:111
mp2p_icp::MatchedPointPlaneList
std::vector< point_plane_pair_t > MatchedPointPlaneList
Definition: point_plane_pair_t.h:40
mp2p_icp::matched_plane_t::p_local
plane_patch_t p_local
Definition: Pairings.h:31
mp2p_icp::Pairings::serializeFrom
virtual void serializeFrom(mrpt::serialization::CArchive &in)
Definition: Pairings.cpp:37
mp2p_icp::point_line_pair_t::ln_global
mrpt::math::TLine3D ln_global
Definition: Pairings.h:55
mp2p_icp::render_params_pairings_pt2pl_t
Definition: render_params.h:208
mp2p_icp::Pairings::get_visualization_pt2pt
virtual void get_visualization_pt2pt(mrpt::opengl::CSetOfObjects &o, const mrpt::poses::CPose3D &localWrtGlobal, const render_params_pairings_pt2pt_t &p) const
Definition: Pairings.cpp:191
mrpt
Definition: LogRecord.h:100
plane_patch.h
Defines plane_patch_t.
testing::internal::string
::std::string string
Definition: gtest.h:1979
mp2p_icp::Pairings::potential_pairings
uint64_t potential_pairings
Definition: Pairings.h:98
mp2p_icp::OutlierIndices::empty
bool empty() const
Definition: Pairings.h:186
mp2p_icp::OutlierIndices::point2point
std::vector< std::size_t > point2point
Definition: Pairings.h:182
mp2p_icp::OutlierIndices::line2line
std::vector< std::size_t > line2line
Definition: Pairings.h:183
mp2p_icp::Pairings::point_weights
std::vector< std::pair< std::size_t, double > > point_weights
Definition: Pairings.h:104
kitti-batch-convert.out
string out
Definition: kitti-batch-convert.py:7
mp2p_icp::matched_line_t::ln_global
mrpt::math::TLine3D ln_global
Definition: Pairings.h:46
mp2p_icp::matched_line_t
Definition: Pairings.h:44
mp2p_icp::OutlierIndices::size
std::size_t size() const
Definition: Pairings.h:190
mp2p_icp::Pairings::size
virtual size_t size() const
Definition: Pairings.cpp:141
mp2p_icp::point_line_pair_t::point_line_pair_t
point_line_pair_t(const mrpt::math::TLine3D &l_global, const mrpt::math::TPoint3D &p_local)
Definition: Pairings.h:59
mp2p_icp::Pairings::serializeTo
virtual void serializeTo(mrpt::serialization::CArchive &out) const
Definition: Pairings.cpp:28
mrpt::serialization
Definition: LogRecord.h:100
mp2p_icp::Pairings::push_back
virtual void push_back(const Pairings &o)
Definition: Pairings.cpp:121
mp2p_icp::point_line_pair_t
Definition: Pairings.h:53
mp2p_icp::eval_centroids_robust
std::tuple< mrpt::math::TPoint3D, mrpt::math::TPoint3D > eval_centroids_robust(const Pairings &in, const OutlierIndices &outliers)
Definition: Pairings.cpp:63
mp2p_icp::Pairings::paired_pl2pl
MatchedPlaneList paired_pl2pl
Definition: Pairings.h:92
mp2p_icp::Pairings::get_visualization
virtual auto get_visualization(const mrpt::poses::CPose3D &localWrtGlobal, const pairings_render_params_t &p=pairings_render_params_t()) const -> std::shared_ptr< mrpt::opengl::CSetOfObjects >
Definition: Pairings.cpp:175
mp2p_icp::render_params_pairings_pt2pt_t
Definition: render_params.h:199
mp2p_icp::point_line_pair_t::point_line_pair_t
point_line_pair_t()=default
mp2p_icp::Pairings::~Pairings
virtual ~Pairings()
mp2p_icp::plane_patch_t
Definition: plane_patch.h:22
std
mp2p_icp::Pairings::Pairings
Pairings()=default
mp2p_icp::operator<<
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &out, const Pairings &obj)
Definition: Pairings.cpp:48
mp2p_icp::point_line_pair_t::pt_local
mrpt::math::TPoint3D pt_local
Definition: Pairings.h:56
mp2p_icp::Pairings::get_visualization_pt2pl
virtual void get_visualization_pt2pl(mrpt::opengl::CSetOfObjects &o, const mrpt::poses::CPose3D &localWrtGlobal, const render_params_pairings_pt2pl_t &p) const
Definition: Pairings.cpp:210
mp2p_icp::Pairings::paired_pt2ln
MatchedPointLineList paired_pt2ln
Definition: Pairings.h:89
mp2p_icp::MatchedPointLineList
std::vector< point_line_pair_t > MatchedPointLineList
Definition: Pairings.h:69
mp2p_icp::matched_plane_t::matched_plane_t
matched_plane_t()=default
mp2p_icp::matched_plane_t
Definition: Pairings.h:29
mp2p_icp::matched_line_t::ln_local
mrpt::math::TLine3D ln_local
Definition: Pairings.h:46
mp2p_icp::render_params_pairings_pt2ln_t
Definition: render_params.h:219
mp2p_icp::OutlierIndices
Definition: Pairings.h:180
mp2p_icp::pairings_render_params_t
Definition: render_params.h:231
mp2p_icp::Pairings::paired_pt2pt
mrpt::tfest::TMatchingPairList paired_pt2pt
Definition: Pairings.h:88
mp2p_icp::OutlierIndices::plane2plane
std::vector< std::size_t > plane2plane
Definition: Pairings.h:184
mp2p_icp::Pairings::paired_pt2pl
MatchedPointPlaneList paired_pt2pl
Definition: Pairings.h:90
mp2p_icp::matched_plane_t::matched_plane_t
matched_plane_t(const plane_patch_t &pl_this, const plane_patch_t &pl_other)
Definition: Pairings.h:34


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