10 #include <pcl/filters/voxel_grid.h> 
   11 #include <pcl/filters/fast_bilateral.h> 
   12 #include <pcl/kdtree/kdtree_flann.h> 
   13 #include <pcl/surface/mls.h> 
   14 #include <pcl/features/integral_image_normal.h> 
   15 #include <pcl/features/normal_3d.h> 
   16 #include <pcl/features/fpfh.h> 
   17 #include <pcl/filters/covariance_sampling.h> 
   19 #include <pcl/registration/ia_ransac.h> 
   20 #include <pcl/registration/icp_nl.h> 
   21 #include <pcl/registration/icp.h> 
   25             , 
const pointCloud::Ptr target
 
   26             , 
double* fitness_score
 
   31   Eigen::Matrix4d transformationBetweenScans;
 
   33   pcl::IterativeClosestPoint<pcl::PointNormal, pcl::PointNormal> 
icp;
 
   37   icp.setMaximumIterations(iterations);
 
   41   icp.setInputCloud(source);
 
   42   icp.setInputTarget(target);
 
   45   transformationBetweenScans = icp.getFinalTransformation().cast<
double>();
 
   46   *fitness_score = icp.getFitnessScore();
 
   48   std::cout << 
"Score: " << icp.getFitnessScore() << std::endl;
 
   52   return transformationBetweenScans;
 
   57               , 
const pointCloud::Ptr target
 
   58               , 
double* fitness_score
 
   63   Eigen::Matrix4d transformationBetweenScans;
 
   65   pcl::IterativeClosestPointNonLinear<pcl::PointNormal, pcl::PointNormal> 
icp;
 
   69   icp.setMaximumIterations(iterations);
 
   73   icp.setInputCloud(source);
 
   74   icp.setInputTarget(target);
 
   77   transformationBetweenScans = icp.getFinalTransformation().cast<
double>();
 
   78   *fitness_score = icp.getFitnessScore();
 
   80   std::cout << 
"Score: " << icp.getFitnessScore() << std::endl;
 
   84   return transformationBetweenScans;
 
   91   pcl::copyPointCloud(*cloud, *temp);
 
   93   pcl::VoxelGrid<pcl::PointNormal> grid;
 
   94   grid.setLeafSize (0.1, 0.1, 0.1);
 
   95   grid.setInputCloud(temp);
 
  104   pcl::PointCloud<pcl::PointXYZ>::Ptr input (
new pcl::PointCloud<pcl::PointXYZ>);
 
  105   pcl::PointCloud<pcl::PointXYZ>::Ptr output (
new pcl::PointCloud<pcl::PointXYZ>);
 
  106   pcl::copyPointCloud(*cloud, *input);
 
  108   pcl::FastBilateralFilter<pcl::PointXYZ> bilateral_filter;
 
  109   bilateral_filter.setInputCloud (input);
 
  110   bilateral_filter.setSigmaS (5);
 
  111   bilateral_filter.setSigmaR (0.005f);
 
  112   bilateral_filter.filter (*output);
 
  114   pcl::copyPointCloud(*output, *cloud);
 
  122   pointCloud::Ptr cloud)
 
  124   pcl::PointCloud<pcl::PointXYZ>::Ptr input (
new pcl::PointCloud<pcl::PointXYZ>);
 
  125   pcl::PointCloud<pcl::PointNormal> output;
 
  126   pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (
new pcl::search::KdTree<pcl::PointXYZ>);
 
  128   pcl::copyPointCloud(*cloud, *input);
 
  130   pcl::MovingLeastSquares<pcl::PointXYZ, pcl::PointNormal> mls;
 
  131   mls.setComputeNormals (
true);
 
  132   mls.setInputCloud (input);
 
  133   mls.setPolynomialFit (
true);
 
  134   mls.setPolynomialOrder (3);
 
  135   mls.setSearchMethod (tree);
 
  136   mls.setSearchRadius (0.03);
 
  139   pcl::copyPointCloud(output, *cloud);
 
  147   pointCloud::Ptr cloud)
 
  150   pcl::copyPointCloud(*cloud, *temp);
 
  160   pcl::NormalEstimation<pcl::PointNormal, pcl::PointNormal> norm_est;
 
  161   pcl::search::KdTree<pcl::PointNormal>::Ptr tree (
new pcl::search::KdTree<pcl::PointNormal> ());
 
  162   tree->setInputCloud (temp);
 
  163   norm_est.setSearchMethod (tree);
 
  164   norm_est.setKSearch (10);
 
  165   norm_est.setInputCloud (temp);
 
  166   norm_est.compute (*cloud);
 
  173   pointCloud::Ptr cloud)
 
  175   pcl::PointCloud<pcl::PointXYZ>::Ptr temp;
 
  176   pcl::PointCloud<pcl::PointXYZ>::Ptr temp2;
 
  177   pcl::copyPointCloud(*cloud, *temp);
 
  178   pcl::PointCloud<pcl::PointNormal>::Ptr temp3 (
new pcl::PointCloud<pcl::PointNormal>);
 
  180   pcl::CovarianceSampling<pcl::PointXYZ, pcl::PointNormal> covariance_sampling;
 
  181   covariance_sampling.setNumberOfSamples (temp->size () / 10);
 
  182   covariance_sampling.setInputCloud (temp);
 
  183   covariance_sampling.setNormals (temp3);
 
  184   covariance_sampling.filter (*temp2);
 
  186   pcl::copyPointCloud(*temp2, *cloud);
 
  191 pcl::PointCloud<pcl::FPFHSignature33>::Ptr
 
  194   pcl::PointCloud<pcl::FPFHSignature33>::Ptr fpfhs (
new pcl::PointCloud<pcl::FPFHSignature33>);
 
  196   pcl::FPFHEstimation<pcl::PointNormal, pcl::PointNormal, pcl::FPFHSignature33> fpfh;
 
  197   fpfh.setInputCloud (input);
 
  198   fpfh.setInputNormals (input);
 
  200   pcl::search::KdTree<pcl::PointNormal>::Ptr tree (
new pcl::search::KdTree<pcl::PointNormal>);
 
  201   fpfh.setSearchMethod (tree);
 
  205   fpfh.setRadiusSearch (0.05);
 
  208   fpfh.compute (*fpfhs);
 
  215   pointCloud::Ptr source
 
  216   , pcl::PointCloud<pcl::FPFHSignature33>::Ptr source_descriptors
 
  217   , pointCloud::Ptr target
 
  218   , pcl::PointCloud<pcl::FPFHSignature33>::Ptr target_descriptors)
 
  220   Eigen::Matrix4d initialAligning;
 
  223   pcl::copyPointCloud(*source, *temp);
 
  225   pcl::SampleConsensusInitialAlignment<pcl::PointNormal, pcl::PointNormal, pcl::FPFHSignature33> sac;
 
  226   sac.setMinSampleDistance (1);
 
  227   sac.setMaxCorrespondenceDistance (5);
 
  228   sac.setMaximumIterations (20);
 
  230   sac.setInputCloud (source);
 
  231   sac.setSourceFeatures (source_descriptors);
 
  233   sac.setInputTarget (target);
 
  234   sac.setTargetFeatures (target_descriptors);
 
  237   initialAligning = sac.getFinalTransformation().cast<
double>();
 
  241   return initialAligning;
 
void bilateralFiltering(pointCloud::Ptr organized_cloud)
Use bilateral filtering. 
 
This file implements all the filter and registration methods for point-cloud data using wrappers for ...
 
Eigen::Matrix4d icpLM(const pointCloud::Ptr source, const pointCloud::Ptr target, double *fitness_score, const double iterations)
Calls the pcl iterativeClosestPoint-algorithm levenberg-marquardt alternative (internally) ...
 
pcl::PointCloud< pcl::PointNormal > pointCloud
Typedef for shorter call of point-cloud-pointer-type. 
 
pcl::PointCloud< pcl::FPFHSignature33 >::Ptr fastPointFeatureHistogram(const pointCloud::Ptr input)
Extracts all (F)PFHs. 
 
void movingLeastSquares(pointCloud::Ptr cloud)
Use moving least squares. 
 
void covarianceDownsampling(pointCloud::Ptr cloud)
Use covariances for downsampling. 
 
void computeSurfaceNormals(pointCloud::Ptr cloud)
Compute the surface normals. 
 
void downsample(pointCloud::Ptr cloud)
Simple Voxel-Grid downsampling. 
 
Eigen::Matrix4d initialAlignment(pointCloud::Ptr source, pcl::PointCloud< pcl::FPFHSignature33 >::Ptr source_descriptors, pointCloud::Ptr target, pcl::PointCloud< pcl::FPFHSignature33 >::Ptr target_descriptors)
Aligns the point-clouds initially using Sample Consensus. 
 
Eigen::Matrix4d icp(const pointCloud::Ptr source, const pointCloud::Ptr target, double *fitness_score, const double iterations)
Calls the pcl iterativeClosestPoint-algorithm.