使用哪个 pcl 滤波器对点云进行下采样
Which pcl filter to use to downsample a point cloud
我从自动驾驶机器人的激光雷达中获得了点云,但要处理的数据太多了。
我已经实现了一个直通过滤器。
我确实得到了一个非常好的结果,我问自己是否有其他过滤器或方法可以深入研究。
当然,我不是在寻找任何具体的东西,而是在寻找方向或建议,因为我对 pcl 库很陌生,而且它看起来很大。
这是我现在的过滤器:
pcl::PointCloud<PointXYZIR>::Ptr cloudInput;
cloudInput.reset(new pcl::PointCloud<PointXYZIR> (cloud_in));
pcl::PointCloud<PointXYZIR>::Ptr cloudFiltered;
cloudFiltered.reset(new pcl::PointCloud<PointXYZIR>);
// Create the filtering object: downsample the dataset using a leaf size
pcl::VoxelGrid<PointXYZIR> avg;
avg.setInputCloud(cloudInput);
avg.setLeafSize(0.25f, 0.25f, 0.25f);
avg.filter(*cloudFiltered);
//Filter object
pcl::PassThrough<PointXYZIR> filter;
filter.setInputCloud(cloudFiltered);
filter.setFilterFieldName("x");
filter.setFilterLimits(-100, 100);
filter.filter(*cloudFiltered);
filter.setFilterFieldName("y");
filter.setFilterLimits(-100, 100);
filter.filter(*cloudFiltered);
cloud_out = *cloudFiltered;
体
素网格到下采样应该保持相当好的云分布,同时减少点数。 您可以设置每个轴中体素的最小程度,以便根据需要保持尽可能多或尽可能少的分辨率。 每个体素将删除其中的所有点,并将它们替换为从已删除的点取平均值的单个点。http://pointclouds.org/documentation/tutorials/voxel_grid.php#voxelgrid
实际上我确实找到了解决方案,但没有通用的解决方案。就我而言,我认为这个问题非常具体地取决于你将得到哪个点云以及你想用它做什么。
passtrought滤波器是一种非常有效的降样方法,而不会冒太多丢失有趣数据的风险。
http://pointclouds.org/documentation/tutorials/passthrough.php
然后我测试了StatalOutlierRemoval,它很有效,但与我的情况无关。
http://pointclouds.org/documentation/tutorials/statistical_outlier.php
现在,我使用叶大小函数对点云进行下采样,然后创建一个 kdtree 来按半径过滤点。这与passtrought过滤器的计算量大致相同,但在我的项目中,这样做更有意义。
// Create the filtering object: downsample the dataset using a leaf size
pcl::VoxelGrid<PointXYZIR> avg;
avg.setInputCloud(cloudInput);
avg.setLeafSize(0.25f, 0.25f, 0.25f);
avg.filter(*cloudFiltered);
//searchPoint
PointXYZIR searchPoint = cloudFiltered->at(0) ;
//result from radiusSearch()
std::vector<int> pointIdxRadiusSearch;
std::vector<float> pointRadiusSquaredDistance;
//kdTree
pcl::KdTreeFLANN<PointXYZIR> kdtree;
kdtree.setInputCloud (cloudFiltered);
kdtree.setSortedResults(true);
if ( kdtree.radiusSearch (searchPoint, 100, pointIdxRadiusSearch, pointRadiusSquaredDistance) > 0 )
{
//delete every point in target
for (size_t j = 0; j < pointIdxRadiusSearch.size (); ++j)
{
//is this the way to erase correctly???
cloud_out.push_back(cloudFiltered->points[pointIdxRadiusSearch[j]]);
}
}
相关文章:
- 如何用RISC-V GD32VF103CBT6开发板卸载精确的ADC过采样
- 如何获取pcl迭代最近点(ICP)的迭代点数?
- 将 PCL 链接到 Cython C++ 模块
- 如何使用采样器立方体作为数组
- PCL:当我在setConditionFunction中使用std::bind 时,没有合适的转换函数
- PCL octree std::bad_alloc c++
- 在点云库 (PCL) 中使用自定义点类型的问题
- PCL 出错:体系结构x86_64 @pcl的未定义符号
- PCL:将两个点云缩放到相同的大小
- 多重采样背景不显示
- 如何从wav文件中获取采样率?
- 在同一项目中使用 CGAL 和 PCL
- PCL 中的 GICP 用法
- 退出 PCL 查看器:即使窗口已关闭,wasStop() 也不会更改值
- 如何对0,1,..中的k个随机数进行采样..,n-1,而不缓存到数组
- 使用pcl transformcloud将三维点平移并旋转到原点
- 使用pcl库设置错误
- 如何在ROS中使用PCL可视化动力学数据的表面法线
- 点云下采样和使用 PCL 进行正态估计
- 使用哪个 pcl 滤波器对点云进行下采样