title: How to use a SACSegmentation after a Voxel Filter in PCL
body: <p>I want to use a SACsegmentation after a Voxel filter, but the output of the filter is a <code>pcl::PCLPointCloud2</code> while the <code>seg.setInputCloud</code> method of the algorithm requires a <code>pcl::PCLPointCloud2ConstPtr</code>.
  I found in other topic that the following line could be used <code>pcl::fromPCLPointCloud2(*cloud_filtered, *filt_cloudPtr);</code> to make the conversion, but it is not working.</p>
  
  <p>Here is the function I am trying to implement:</p>
  
  <pre><code>sensor_msgs::PointCloud2 process_cloud(const sensor_msgs::PointCloud2ConstPtr&amp; input)
  {
    pcl::PCLPointCloud2* cloud = new pcl::PCLPointCloud2;
    pcl::PCLPointCloud2ConstPtr cloudPtr(cloud);
    pcl::PCLPointCloud2 cloud_filtered;
  
    pcl_conversions::toPCL(*input, *cloud);
  
    pcl::VoxelGrid&lt;pcl::PCLPointCloud2&gt; sor;
    sor.setInputCloud (cloudPtr);
    sor.setLeafSize (0.1, 0.1, 0.1);
    sor.filter (cloud_filtered);
  
    pcl::PCLPointCloud2ConstPtr filt_cloudPtr(new pcl::PCLPointCloud2);
  
    pcl::fromPCLPointCloud2(*cloud_filtered, *filt_cloudPtr);
  
    pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
    pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
    // Create the segmentation object
    pcl::SACSegmentation&lt;pcl::PCLPointCloud2&gt; seg;
    // Optional
    seg.setOptimizeCoefficients (true);
    // Mandatory
    seg.setModelType (pcl::SACMODEL_PLANE);
    seg.setMethodType (pcl::SAC_RANSAC);
    seg.setDistanceThreshold (0.01);
  
    seg.setInputCloud (filt_cloudPtr);
    seg.segment (*inliers, *coefficients);
  }
  </code></pre>