resampling.cpp
Go to the documentation of this file.
00001 #include <pcl/point_types.h>
00002 #include <pcl/io/pcd_io.h>
00003 #include <pcl/kdtree/kdtree_flann.h>
00004 #include <pcl/surface/mls.h>
00005 
00006 int
00007 main (int argc, char** argv)
00008 {
00009   // Load input file into a PointCloud<T> with an appropriate type
00010   pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ> ());
00011   // Load bun0.pcd -- should be available with the PCL archive in test 
00012   pcl::io::loadPCDFile ("bun0.pcd", *cloud);
00013 
00014   // Create a KD-Tree
00015   pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);
00016 
00017   // Output has the PointNormal type in order to store the normals calculated by MLS
00018   pcl::PointCloud<pcl::PointNormal> mls_points;
00019 
00020   // Init object (second point type is for the normals, even if unused)
00021   pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;
00022  
00023   mls.setComputeNormals (true);
00024 
00025   // Set parameters
00026   mls.setInputCloud (cloud);
00027   mls.setPolynomialFit (true);
00028   mls.setSearchMethod (tree);
00029   mls.setSearchRadius (0.03);
00030 
00031   // Reconstruct
00032   mls.process (mls_points);
00033 
00034   // Save output
00035   pcl::io::savePCDFile ("bun0-mls.pcd", mls_points);
00036 }


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:17:40