点云技术相关产学研社区

 找回密码
 立即注册加入PCL中国点云技术相关产学研社区

扫一扫,访问微社区

查看: 2864|回复: 0

如何使用移动最小二乘法mls对点云进行修补

[复制链接]
发表于 2016-4-29 10:58:22 | 显示全部楼层 |阅读模式
用mls做点云修补有一定的效果,尝试了inline void setUpsamplingMethod(UpsamplingMethodmethod)中的VOXEL_GRID_DILATION方法,但是效果不明显,请问参数要怎么调?
  1. #include <pcl/point_types.h>
  2. #include <pcl/io/pcd_io.h>
  3. #include <pcl/kdtree/kdtree_flann.h>
  4. #include <pcl/surface/mls.h>

  5. int
  6.         main (int argc, char** argv)
  7. {
  8.         // Load input file into a PointCloud<T> with an appropriate type
  9.         pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB> ());
  10.         // Load bun0.pcd -- should be available with the PCL archive in test
  11.         pcl::io::loadPCDFile ("scene13.pcd", *cloud);

  12.         // Create a KD-Tree
  13.         pcl::search::KdTree<pcl::PointXYZRGB>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZRGB>);

  14.         // Output has the PointNormal type in order to store the normals calculated by MLS
  15.         pcl::PointCloud<pcl::PointNormal> mls_points;

  16.         // Init object (second point type is for the normals, even if unused)
  17.         pcl::MovingLeastSquares<pcl::PointXYZRGB, pcl::PointNormal> mls;

  18.         mls.setComputeNormals (true);

  19.         // Set parameters
  20.         mls.setInputCloud (cloud);
  21.         mls.setPolynomialFit (true);
  22.         mls.setSearchMethod (tree);
  23.         mls.setSearchRadius (0.01);

  24.         mls.setUpsamplingMethod(mls.VOXEL_GRID_DILATION);
  25.         mls.setDilationVoxelSize(0.01);
  26.         mls.setDilationIterations(0.02);
  27.         mls.process (mls_points);
  28.        
  29.        
  30.         // Save output
  31.         pcl::io::savePCDFileASCII ("scene13-mls.pcd", mls_points);
  32. }
复制代码
回复

使用道具 举报

本版积分规则

QQ|小黑屋|点云技术相关产学研社区 ( 陕ICP备13001629号 )

GMT+8, 2024-5-14 06:48 , Processed in 1.118886 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表