PCLlab—双边滤波(1

来源:互联网 发布:网络公司员工管理制度 编辑:程序博客网 时间:2024/04/30 01:08
PCLlab—双边滤波(1)
http://www.cnblogs.com/pcl-lab/articles/3975879.html
http://www.pclcn.org/bbs/forum.php?mod=viewthread&tid=299&extra=&page=2    修改源码 重新编译模块

序:本节介绍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

标签: bilateral filter, 双边滤波, normals 法线
1 0
原创粉丝点击