PCLlab—雙邊濾波(1)


序:本節介紹PCL里的雙邊濾波,雙邊濾波主要作用是具有保邊的功能,即在濾波的過程中不會連帶邊界一起都平滑掉,這樣有利於計算准確的法線。這里我們主要介紹其實現過程,算法會在后續補充上。

1. 代碼如下:

void Filters::bilateralFilter(pcl::PCLPointCloud2::ConstPtr input, pcl::PCLPointCloud2& output,
    float sigma_s, float sigma_r)
{
    // Convert data to PointCloud<T>
    pcl::PointCloud<pcl::PointXYZ>::Ptr xyz (new pcl::PointCloud<pcl::PointXYZ>);
    fromPCLPointCloud2 (*input, *xyz);

    // Apply the filter
    pcl::FastBilateralFilter<pcl::PointXYZ> fbf;
    fbf.setInputCloud (xyz);
    fbf.setSigmaS (sigma_s);
    fbf.setSigmaR (sigma_r);
    pcl::PointCloud<pcl::PointXYZ> xyz_filtered;
    fbf.filter (xyz_filtered);

    // Convert data back
    pcl::PCLPointCloud2 output_xyz;
    toPCLPointCloud2 (xyz_filtered, output_xyz);
    pcl::concatenateFields (*input, output_xyz, output);
}

2. 運行結果

直接觀察運行的結果是很難區分出有什么差別的,所以這里我們分別計算了運行前后點雲的法線,可以通過法線的分布清楚的分出效果來。

(1)采用默認參數濾波

(2)濾波前的法線分布

(3)濾波后的法線分布

 

轉載請注明:http://www.cnblogs.com/pcl-lab/articles/3975879.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM