Advertisement

PCL点云欧氏聚类

阅读量:

PCL库中包含一个名为pcl::EuclideanClusterExtraction的函数,该函数能够实现点云数据的欧式聚类提取,并将各个点簇对应的索引信息存储至向量容器中。

复制代码
    threshold 欧式聚类的最小距离阈值
    MinClusterSize 点簇的最小数目
    MaxClusterSize 点簇的最大数目
    
    
      
      
      
    

在以下代码中,cluster_indices变量存储了欧式聚类的处理结果,若希望获取点云中数量最多的部分,可依据点簇的数量进行筛选。

复制代码
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr get_max_cluster(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud, float threshold)
    {
    pcl::search::KdTree<pcl::PointXYZRGB>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZRGB>);
    tree->setInputCloud(cloud);
    
    std::vector<pcl::PointIndices> cluster_indices;

全部评论 (0)

还没有任何评论哟~