28 #include <pcl/point_cloud.h>
29 #include <pcl/point_types.h>
35 inline Eigen::Vector2f
pcl2eigen(
const pcl::PointXY& pt)
37 return Eigen::Vector2f{pt.x, pt.y};
39 inline Eigen::Vector3f
pcl2eigen(
const pcl::PointXYZ& pt)
41 return Eigen::Vector3f{pt.x, pt.y, pt.z};
46 auto pcl2eigen(
const pcl::PointCloud<PointT>& pointCloud)
47 -> std::vector<EigenVector>
49 std::vector<EigenVector>
v;
50 v.reserve(pointCloud.points.size());
53 pointCloud.points.end(),
54 std::back_inserter(
v),
62 inline pcl::PointXY
eigen2pcl(
const Eigen::Vector2f& pt)
64 return pcl::PointXY{pt.x(), pt.y()};
67 inline pcl::PointXYZ
eigen2pcl(
const Eigen::Vector3f& pt)
69 return pcl::PointXYZ{pt.x(), pt.y(), 0.F};
72 template <
typename EigenVector,
74 auto eigen2pcl(
const std::vector<EigenVector>& points)
75 -> pcl::PointCloud<PointT>
77 pcl::PointCloud<PointT> pointCloud;
78 pointCloud.points.reserve(points.size());
82 std::back_inserter(pointCloud.points),
85 pointCloud.width = pointCloud.points.size();
86 pointCloud.height = 1;
87 pointCloud.is_dense =
true;