|
用mls做点云修补有一定的效果,尝试了inline void setUpsamplingMethod(UpsamplingMethodmethod)中的VOXEL_GRID_DILATION方法,但是效果不明显,请问参数要怎么调?- #include <pcl/point_types.h>
- #include <pcl/io/pcd_io.h>
- #include <pcl/kdtree/kdtree_flann.h>
- #include <pcl/surface/mls.h>
- int
- main (int argc, char** argv)
- {
- // Load input file into a PointCloud<T> with an appropriate type
- pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB> ());
- // Load bun0.pcd -- should be available with the PCL archive in test
- pcl::io::loadPCDFile ("scene13.pcd", *cloud);
- // Create a KD-Tree
- pcl::search::KdTree<pcl::PointXYZRGB>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZRGB>);
- // Output has the PointNormal type in order to store the normals calculated by MLS
- pcl::PointCloud<pcl::PointNormal> mls_points;
- // Init object (second point type is for the normals, even if unused)
- pcl::MovingLeastSquares<pcl::PointXYZRGB, pcl::PointNormal> mls;
- mls.setComputeNormals (true);
- // Set parameters
- mls.setInputCloud (cloud);
- mls.setPolynomialFit (true);
- mls.setSearchMethod (tree);
- mls.setSearchRadius (0.01);
- mls.setUpsamplingMethod(mls.VOXEL_GRID_DILATION);
- mls.setDilationVoxelSize(0.01);
- mls.setDilationIterations(0.02);
- mls.process (mls_points);
-
-
- // Save output
- pcl::io::savePCDFileASCII ("scene13-mls.pcd", mls_points);
- }
复制代码 |
|