Esempio n. 1
0
void example_convolution ()
{
  Kernel<pcl::PointXYZRGB> kernel;
  Convolution<pcl::PointXYZRGB> convolution;

  /*dummy clouds*/
  pcl::PointCloud<pcl::PointXYZRGB>::Ptr input_cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
  pcl::PointCloud<pcl::PointXYZRGB>::Ptr kernel_cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
  pcl::PointCloud<pcl::PointXYZRGB>::Ptr output_cloud (new pcl::PointCloud<pcl::PointXYZRGB>);

  /*example 1 : Gaussian Smoothing*/
  kernel.sigma_ = 2.0;
  kernel.kernel_size_ = 3;
  kernel.gaussianKernel (*kernel_cloud);
  convolution.kernel_ = *kernel_cloud;
  convolution.convolve (*output_cloud, *input_cloud);

  /*example 2 : forward derivative in X direction*/
  kernel.kernel_type_ = Kernel<pcl::PointXYZRGB>::DERIVATIVE_FORWARD_X;
  kernel.fetchKernel (*kernel_cloud);
  convolution.kernel_ = *kernel_cloud;
  convolution.convolve (*output_cloud, *input_cloud);

  /*example 3*/
  kernel.kernel_type_ = Kernel<pcl::PointXYZRGB>::DERIVATIVE_FORWARD_X;
  kernel.fetchKernel (convolution.kernel_);
  convolution.convolve (*output_cloud, *input_cloud);
}