您的位置:首页 > 其它

《PCL点云库学习&VS2010(X64)》Part 7 PCL双边滤波BilateralFilter

2016-05-29 15:00 1686 查看
Part 7 PCL双边滤波BilateralFilter

PCL里的双边滤波,双边滤波主要作用是具有保边的功能,即在滤波的过程中不会连带边界一起都平滑掉,这样有利于计算准确的法线。一般情况下双边滤波的效果不是很明显,最好是分别计算了运行前后点云的法线,可以通过法线的分布清楚的分出效果来。

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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: