PCL Gaussian Kernal example

限于喜欢 提交于 2019-12-24 02:04:19

问题


I need help in applying a Gaussian Kernel on my points cloud to smooth the cloud.

I could not figure out how I should write the code and I could not find any plain examples.

Update:

I am using Point Cloud Library (pcl):

pcl::io::loadPCDFile ("/home/..../2240.pcd", *raw_cloud);
Eigen::VectorXf horizontal;
//Set up the Gaussian Kernel
pcl::GaussianKernel<pcl::PointXYZRGB> gaussianKernel;
gaussianKernel.compute(5,horizontal,40);

pcl::filters::Convolution<pcl::PointXYZRGB> conv;
conv.setInputCloud(raw_cloud);
conv.setKernel(horizontal);

This is the code, it is not complete and I am not sure what if the approach is right?

anyone have an idea about this?


回答1:


I found the right way to make a Gaussian Smoothing via PCL:

pcl::PointCloud<pcl::PointXYZRGB>::Ptr inputCloud,cloud;
pcl::filters::Convolution<pcl::PointXYZRGB, pcl::PointXYZRGB>  convolution;
Eigen::ArrayXf gaussian_kernel(5);
gaussian_kernel << 1.f/16, 1.f/4, 3.f/8, 1.f/4, 1.f/16;
convolution.setBordersPolicy(
                pcl::filters::Convolution<pcl::PointXYZRGB, pcl::PointXYZRGB>::BORDERS_POLICY_IGNORE);
convolution.setDistanceThreshold (static_cast<float> (0.1));
convolution.setInputCloud (inputCloud);
convolution.setKernel (gaussian_kernel);
convolution.convolve(*cloud);

Hope it would help anyone in his work :)



来源:https://stackoverflow.com/questions/35024359/pcl-gaussian-kernal-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!