点云离群点的移除

文章介绍了使用PCL库进行离群点移除的三种方法:统计学移除法通过设置平均距离和标准差阈值来识别并删除离群点;半径移除法则依据点的邻近点数量来决定保留与否;条件移除法则基于点的特定字段(如Z坐标)设定范围条件来过滤点云数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

离群点的移除
统计学移除法
在这里插入图片描述
在这里插入图片描述

// 创建过滤器,每个点分析计算时考虑的最近邻居个数为50个;
// 设置标准差阈值为1,这意味着所有距离查询点的平均距离的标准偏差均大于1个标准偏差的所有点都将被标记为离群值并删除。
// 计算输出并将其存储在cloud_filtered中

// 创建滤波对象
pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor;
sor.setInputCloud (cloud);
// 设置平均距离估计的最近邻居的数量K
sor.setMeanK (50);
// 设置标准差阈值系数,值越小,滤波效果越强
sor.setStddevMulThresh (1.0);
// sor.setNegative(True); 滤波器取反
// 执行过滤
sor.filter (*cloud_filtered);

条件移除法
半径移除法:指定半径内续有n个邻点才保留,否则移除

pcl::RadiusOutlierRemoval<pcl::PointXYZ> outrem;
// build the filter
outrem.setInputCloud(cloud);
outrem.setRadiusSearch(0.4);
outrem.setMinNeighborsInRadius(2);
// apply filter
outrem.filter(*cloud_filtered);

条件移除法:

// build the condition 或的写法:pcl::ConditionOr<pcl::PointXYZ>::Ptr
pcl::ConditionAnd<pcl::PointXYZ>::Ptr range_cond(new pcl::ConditionAnd<pcl::PointXYZ>());
// GT大于0 小于0.8 的范围内的点 保留
range_cond->addComparison(pcl::FieldComparison<pcl::PointXYZ>::ConstPtr(
        new pcl::FieldComparison<pcl::PointXYZ>("z", pcl::ComparisonOps::GT, 0.0)));
range_cond->addComparison(pcl::FieldComparison<pcl::PointXYZ>::ConstPtr(
        new pcl::FieldComparison<pcl::PointXYZ>("z", pcl::ComparisonOps::LT, 0.8)));
// build the filter
pcl::ConditionalRemoval<pcl::PointXYZ> condrem;
condrem.setCondition(range_cond);
condrem.setInputCloud(cloud);
condrem.setKeepOrganized(true);
// apply filter
condrem.filter(*cloud_filtered);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值