PCL: 如何从 IndicesClusterPtr 中删除特定的集群?

PCL: How to remove a specific cluster from IndicesClusterPtr?

我使用 ConditionalEuclideanClustering(根据教程)从点云中提取子云。 IndicesClusterPtr 属于 boost::shared_ptr<std::vector<pcl::PointIndices>> 类型。添加元素似乎有效。我无法从 clusters 中删除第 i 个簇。你能给我一个提示吗?

    pcl::IndicesClustersPtr clusters(new pcl::IndicesClusters);
    clusters->push_back( (*clusters2)[j])   //seems to be okay

    clusters->erase(i); // Nope
    (*clusters).erase(i); // Nope

    pcl::PointIndices empty_indices;   // compiles but results not as expected
    (*clusters)[i] = empty_indices;

std::vector::erase 将迭代器作为输入。所以像这样调用 erase 函数:

clusters->erase(clusters->begin()+i);