5 #include <Eigen/Geometry>
7 #include <pcl/point_cloud.h>
8 #include <pcl/point_types.h>
9 #include <pcl/PointIndices.h>
11 #include <pcl/point_types_conversion.h>
12 #include <pcl/common/io.h>
24 Eigen::Vector3f
pointCloudMedian(
const pcl::PointCloud<pcl::PointXYZRGBA>& cloud,
25 const pcl::PointIndices&
indices = {});
29 const pcl::PointIndices&
indices,
30 Eigen::Vector3f center = Eigen::Vector3f::Zero());
32 Eigen::Vector3f center = Eigen::Vector3f::Zero());
38 pcl::PointIndicesPtr
getPlaneInliers(
const pcl::PointCloud<pcl::PointXYZRGBA>& cloud,
42 float hsvDistance(
const pcl::PointXYZHSV& lhs,
const pcl::PointXYZHSV& rhs,
43 const Eigen::Vector3f& hsvWeights = Eigen::Vector3f::Ones());
44 float hsvDistance(
const Eigen::Vector3f& lhs,
const Eigen::Vector3f& rhs,
45 const Eigen::Vector3f& hsvWeights = Eigen::Vector3f::Ones());
48 Eigen::Vector3f
hsvMean(
const pcl::PointCloud<pcl::PointXYZHSV>& hsvCloud,
const std::vector<int>&
indices);
50 template <
class Po
intRGB>
51 Eigen::Vector3f
hsvMean(
const pcl::PointCloud<PointRGB>& rgbCloud,
const std::vector<int>&
indices)
53 pcl::PointCloud<pcl::PointXYZHSV> hsvCloud;
54 pcl::PointCloudXYZRGBAtoXYZHSV(rgbCloud, hsvCloud);
59 template <
class Po
intT>
61 pcl::PointCloud<PointT>& output)
65 output.reserve(
input.size() - indexSet.size());
66 for (
size_t i = 0; i <
input.size(); ++i)
68 if (indexSet.count(
int(i)) == 0)
70 output.push_back(
input[i]);
76 template <
class Po
intT>
78 const pcl::PointCloud<PointT>&
input,
const std::vector<int>&
indices)
80 typename pcl::PointCloud<PointT>::Ptr output(
new pcl::PointCloud<PointT>);
86 template <
class Po
intT>
88 const pcl::PointCloud<PointT>&
input,
const std::vector<int>&
indices)
90 typename pcl::PointCloud<PointT>::Ptr output(
new pcl::PointCloud<PointT>);
95 template <
class Po
intT>
97 const pcl::PointCloud<PointT>&
input,
const pcl::PointIndices&
indices)
99 typename pcl::PointCloud<PointT>::Ptr output(
new pcl::PointCloud<PointT>);
107 return lhs.indices.size() > rhs.indices.size();
115 template <
class Po
intT>
118 const auto isNan = [](
const PointT& p)->
bool{
119 return std::isnan(p.z);
122 pc.points.erase(std::remove_if(
pc.points.begin(),
pc.points.end(), isNan),
pc.points.end());
125 pc.width =
pc.points.size();