【pcl点云教程系列】之大曲率斜平面过滤

本文介绍了在点云预处理中,如何针对大曲率斜坡进行有效过滤。通过结合地图的先验信息,提出一种方法能够在保证实时性的前提下,过滤掉大曲率斜坡的点云,提高后续目标检测的准确性。文章包括流程图、代码示例和过滤结果展示。
摘要由CSDN通过智能技术生成

简介

  点云过滤作为传统激光点云目标检测预处理阶段重要一环节,过滤效果的好坏会直接影响后续点云聚类检测的效果。现实无人车行驶的道路上,地形起伏坡度不一致,这就导致一般的点云过滤算法无法有效的处理像进入地下车库这种曲率特别大的路段。有些时候就需要一些先验信息辅助进行大曲率斜坡的过滤。本篇博客介绍一种结合地图给予的先验信息进行过滤的一种方法,能够有效的进行点云大斜坡过滤,同时还能够保证一定的实时性。

大曲率点云斜坡过滤

我们看下大曲率流程图:

代码分析

下面我们看下如下的demo示例:功能相对单一,代码比较简单。

#include <iostream>
#include <pcl/common/centroid.h>
#include <pcl/filters/crop_hull.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/sample_consensus/ransac.h>
#include <pcl/sample_consensus/sac_model_plane.h>
#include <pcl/filters/impl/plane_clipper3D.hpp>


class SlopeFilter
{
   
public:
	using PointXYZ         = pcl::PointXYZ;
	using PCLPointCloud    = pcl::PointCloud<pcl::PointXYZ>;
    using PCLPointCloudPtr = pcl::PointCloud<pcl::PointXYZ>::Ptr;
	// 构造函数初始化点集.
    explicit SlopeFilter(std::vector<std::vector<PointXYZ>> slope_peak_points) 
    : region_cloud_(new PCLPointCloud) 
    {
   
    	slope_peak_points_ = slope_peak_points;
    }
	// 应用此函数进行斜坡滤波.
    void ApplyFilter(const PCLPointCloudPtr inputCloud, PCLPointCloudPtr outputCloud)
    {
   
    	PCLPointCloudPtr remain_pointcloud(new PCLPointCloud);
    	pcl::copyPointCloud(*inputCloud, *remain_pointcloud);

    	for (size_t i = 0U; i < slope_peak_points_.size(); ++i)
	    {
   
	        PCLPointCloudPtr temp_croped_cloud(new PCLPointCloud);
	        PCLPointCloudPtr temp_croped_outside_cloud(new PCLPointCloud);
	        PCLPointCloudPtr temp_clipped_cloud(new PCLPointCloud); 

	        initSlopePlane(slope_peak_points_[i]);

	        cropSlopePlane(remain_pointcloud, temp_croped_cloud, temp_croped_outside_cloud);
	        if (0U == temp_croped_cloud->size())
	        {
   
	            continue;
	        }

	        pcl::copyPointCloud(*temp_croped_outside_cloud, *remain_pointcloud);
	        clipEachPlane(temp_croped_cloud
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值