surfel_smoothing_test.cpp
Go to the documentation of this file.
00001 #include <pcl/surface/surfel_smoothing.h>
00002 #include <pcl/io/pcd_io.h>
00003 #include <pcl/features/normal_3d.h>
00004 
00005 
00006 using namespace pcl;
00007 
00008 int
00009 main (int argc, char **argv)
00010 {
00011   if (argc != 5)
00012   {
00013     PCL_ERROR ("./surfel_smoothing_test normal_search_radius surfel_scale source_cloud destination_cloud\n");
00014     return (-1);
00015   }
00016   PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ> ());
00017   PointCloud<Normal>::Ptr normals (new PointCloud<Normal> ());
00018 
00019   PCDReader reader;
00020   reader.read (argv[3], *cloud);
00021   PCL_INFO ("Cloud read: %s\n", argv[3]);
00022 
00023   float normal_search_radius = static_cast<float> (atof (argv[1]));
00024   float surfel_scale = static_cast<float> (atof (argv[2]));
00025 
00026 
00027   NormalEstimation<PointXYZ, Normal> normal_estimation;
00028   normal_estimation.setInputCloud (cloud);
00029   search::KdTree<PointXYZ>::Ptr search_tree (new search::KdTree<PointXYZ>);
00030   normal_estimation.setSearchMethod (search_tree);
00031   normal_estimation.setRadiusSearch (normal_search_radius);
00032   normal_estimation.compute (*normals);
00033 
00034   SurfelSmoothing<PointXYZ, Normal> surfel_smoothing (surfel_scale);
00035   surfel_smoothing.setInputCloud (cloud);
00036   surfel_smoothing.setInputNormals (normals);
00037   surfel_smoothing.setSearchMethod (search_tree);
00038   PointCloud<PointXYZ>::Ptr output_positions;
00039   PointCloud<Normal>::Ptr output_normals;
00040   surfel_smoothing.computeSmoothedCloud (output_positions, output_normals);
00041 
00042   PointCloud<PointNormal>::Ptr output_with_normals (new PointCloud<PointNormal> ());
00043   pcl::concatenateFields (*output_positions, *normals, *output_with_normals);
00044 
00045   io::savePCDFileASCII (argv[4], *output_with_normals);
00046 
00047   return (0);
00048 }


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:34:13