c++ - 如何在 c++ 中使用 `pcl` (点云库)从 std::vector<int> 创建 pcl::PointIndices?

标签 c++ point-cloud-library

我正在使用pcl在 C++ 中,为无法创建 pcl 表示歉意标签。

我正在使用 pcl 实现点云分割的管道。我想知道如何从 std::vector<int> 类型的提取索引创建 pcl::PointIndices ,这样我就可以将其输入到另一个过滤器中。

第一个过滤器可以生成 std​​::vector 类型的索引

// Create statistical filtering object
pcl::StatisticalOutlierRemoval<PointXYZ> sor;
CloudXYZPtr sor_filtered (new CloudXYZ);
std::vector<int> sor_inliers;

sor.setInputCloud (input);
sor.setMeanK (10);
sor.setStddevMulThresh (0.5);
sor.filter (sor_inliers);

然后,我想将这个过滤后的事件输入到另一个过滤器中,例如:

pcl::RadiusOutlierRemoval<PointXYZ> ror;
pcl::PointIndices::Ptr ror_indices (new pcl::PointIndices);
ror_indices->data = sor_inliers;  // #### How to do this line?
std::vector<int> ror_inliers;

//I can set it like
ror.setInputCloud(input);
ror.setIndices(ror_indices);

如何让它发挥作用?谢谢。

最佳答案

这个:

ror_indices->data = sor_inliers;  // #### How to do this line?

应该是:

ror_indices->indices = sor_inliers;

关于c++ - 如何在 c++ 中使用 `pcl` (点云库)从 std::vector<int> 创建 pcl::PointIndices?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65463235/

相关文章:

c++ - 嵌套模板类型的c++类成员变量

c++ - 运算符重载+添加多个对象

python - 如何将深度图转换为 3D 点云?

c++ - VSCode C++ IntelliSense 工作正常,除了 PCL(点云库)

c++ - 在 Structure from Motion 中进行三角剖分后

c++ - 为什么我需要 `std::type_identity_t` 来启用隐式类型转换?

c++ - 为什么文字操作符不能正常地模板化?

c++ - 好友方法错误

c++ - 最佳 PCL 模板对齐设置

c++ - 如何在 ROS2 的 create_subscription 方法中使用 std::bind 的 lambda intead