哪种PCL滤波器用于对点云进行下采样?

5

我正在为自动驾驶机器人从激光雷达获取点云数据,但是数据量太大了,无法处理。

我已经实现了一个通行滤波器。

我得到了非常好的结果,并且我在想是否还有其他过滤器或方法可以探索。

当然,我不是在寻找特定的东西,而是希望得到一个方向或建议,因为我对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;

你找到解决方案了吗? - Sneaky Polar Bear
2个回答

3
实际上,我找到了一个解决方案,但没有通用的解决方案。在我的情况下,我认为这个问题非常特定,取决于你要获取哪个点云以及你想要做什么。
穿透滤波器是一种非常有效的降采样方式,不会冒太多丢失感兴趣数据的风险。

http://pointclouds.org/documentation/tutorials/passthrough.php

然后我测试了StatisticalOutlierRemoval,它很有效但在我的情况下不相关。

http://pointclouds.org/documentation/tutorials/statistical_outlier.php

现在,我使用叶子大小函数对点云进行下采样,然后创建一个kdtree来通过半径过滤点。 这大约需要与passthrough滤波器相同的计算量,但在我的项目中以这种方式做更有意义。
 // 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]]);
        }
    }

3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接