对点云进行凸包提取

void getConcaveHull(PointCloud::Ptr& cloud,const pcl::PointCloud<PointXYZ>::Ptr &hull)
{
    
    
    if(cloud->points.size()<3)
    {
    
    
        return ;
    }
    PointCloud ::Ptr cloud_filtered(new PointCloud());
    downSample(cloud,cloud_filtered);
    // 创建凹包提取对象
    pcl::ConcaveHull<PointSany> chull;
    chull.setDimension(2);
    chull.setInputCloud(cloud_filtered);
    chull.setAlpha(1.0); // 设置凹包提取的参数
    // 提取凹包点
    chull.reconstruct(*hull);
}

其中PointCloud为点云模板
效果图如下图所示
白色点为凸包点,红色点为原始点云点。在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/CCCrunner/article/details/134784044
今日推荐