【问题标题】:How to extract a specific cluster after filtering a point cloud?过滤点云后如何提取特定的簇?
【发布时间】:2016-02-29 19:46:18
【问题描述】:

我正在使用点云库,在过滤点云并使用欧几里得聚类提取进行分割后,我正在提取第一个聚类的点。以下代码是我认为可能用于提取集群点的代码:

std::vector<pcl::PointIndices> cluster_indices;
typename pcl::search::KdTree<PointT>::Ptr tree (new pcl::search::KdTree<PointT>);
tree->setInputCloud(out_cloud);
pcl::EuclideanClusterExtraction<PointT> ec;
ec.setClusterTolerance(2 * 0.06);
ec.setMinClusterSize(50);
ec.setMaxClusterSize(1200);
ec.setSearchMethod(tree);
ec.setInputCloud(filtered_cloud);
ec.extract(cluster_indices);
int j = cluster_indices.size();
tam_cluster = cluster_indices[0].indices.size();
int ind_tmp;

for (int n=0; n<tam_cluster; n++){
    ind_tmp=cluster_indices[0].indices[n];
    first_clust->points.push_back (filtered_cloud->points[ind_tmp]); 
}
std::cout << " ** Number of points of first cluster : " <<  first_clust->size() <<std::endl;

所以,我不知道为什么,但有时我会得到一个超过 1200 点的集群。我认为这可能是由于 pcl 在提取集群中的实现。

这段代码正确吗?

【问题讨论】:

  • typename 是干什么用的?
  • 抱歉,我忘了更改那行代码,所以它只是:pcl::search::KdTree::Ptr tree (new pcl::search::KdTree );树->setInputCloud(filtered_cloud);

标签: c++ point-cloud-library point-clouds


【解决方案1】:

我也遇到过同样的问题,一旦你浏览了这个示例代码,这可能会有用 GitHub Link for Cluster Extraction

尝试改变这些参数的值 SetRadiusSearch、tolerance、eps_angle、min_cluster_size 和 u 将获得集群总数,所有集群数据将保存到单独的 pcd 文件中。

希望这对你有帮助。

【讨论】:

  • 始终欢迎提供指向潜在解决方案的链接,但请add context around the link,以便您的其他用户知道它是什么以及为什么存在。始终引用重要链接中最相关的部分,以防目标站点无法访问或永久离线。考虑到仅仅是指向外部站点的链接Why and how are some answers deleted?的一个可能原因
猜你喜欢
  • 2013-11-26
  • 2021-02-15
  • 2015-10-14
  • 2016-10-23
  • 1970-01-01
  • 1970-01-01
  • 2021-10-29
  • 2019-07-23
相关资源
最近更新 更多