【问题标题】:How to set the "pcl::PointIndices" with the PCD file (existing point cloud sets)如何使用 PCD 文件设置“pcl::PointIndices”(现有点云集)
【发布时间】:2018-09-22 00:36:00
【问题描述】:

我正在尝试实现点云背景减法。 (例如 background.pcd = input.pcd - object.pcd)

我找到了以下代码

  pcl::PointCloud<pcl::PointXYZ>::Ptr p_obstacles(new pcl::PointCloud<pcl::PointXYZ>);
  pcl::PointIndices::Ptr inliers(new pcl::PointIndices());
  pcl::ExtractIndices<pcl::PointXYZ> extract;

// Insert something. 

  extract.setInputCloud(p_obstacles);
  extract.setIndices(inliers);
  extract.setNegative(true);
  extract.filter(*p_obstacles);

Removing points from a pcl::PointCloud<pcl::PointXYZRGB>

在我的理解中,inliers 是从 input.pcd 中减去的 (内点 = object.pcd ??)

我不知道如何使用预先存在的 x、y、z 值(pcd)设置内点值

谢谢!

【问题讨论】:

    标签: point-cloud-library point-clouds


    【解决方案1】:

    PCLBase 类中有一个 getIndices() 方法:http://docs.pointclouds.org/1.8.1/classpcl_1_1_p_c_l_base.html#a058753dd4de73d3d0062fe2e452fba3c

    使用方法如下:

    pcl::PCLBase<pcl::PointXYZ> base; // Instantiate the PCLBase class
    base.setInputCloud(object_cloud); // Set input cloud before grabbing the indices
    auto object_indices = base.getIndices();
    extract.setIndices(object_indices);
    

    您可能需要包含头文件

    #include <pcl/pcl_base.h>
    

    如果您还没有从您的 pcd 文件创建点云,您可以按照本教程进行操作: http://pointclouds.org/documentation/tutorials/reading_pcd.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-07
      • 1970-01-01
      • 2018-04-14
      • 2020-06-19
      • 1970-01-01
      • 1970-01-01
      • 2017-10-30
      相关资源
      最近更新 更多