问题
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