title: PCL downsample with pcl::VoxelGrid
body: <p>The function below produces no result. In other words, the number of points in point cloud is exactly the same as before down-sampling.  I tried various numbers for leaf size from 0.01 all the way to the ones you see below but all of them produce the same result. I had to ticker with the conversions (as you see below) going from <code>pcl::PointCloud&lt;T&gt;</code> to <code>pcl::PCLPointCloud2</code> so I am suspecting that they might the problem here. </p>
  
  <p>Please let me know if you had similar problem and solved it.
  Thank you.</p>
  
  <pre><code>typedef pcl::PointCloud&lt;pcl::PointXYZ&gt;::Ptr PointCloudPtr;
  
  void PlantVis::downsample(PointCloudPtr cloud) {
      pcl::PCLPointCloud2::Ptr cloud2(new pcl::PCLPointCloud2());
      pcl::toPCLPointCloud2(*cloud, *cloud2);
  
      pcl::PCLPointCloud2::Ptr cloud_filtered(new pcl::PCLPointCloud2());
  
      pcl::VoxelGrid&lt;pcl::PCLPointCloud2&gt; sor;
      sor.setInputCloud(cloud2);
      sor.setLeafSize(500000000.01f, 500000000.01f, 500000000.01f);
      sor.filter(*cloud_filtered);
  
      pcl::PointCloud&lt;pcl::PointXYZ&gt;::Ptr m_cloud(new pcl::PointCloud&lt;pcl::PointXYZ&gt;);
      pcl::fromPCLPointCloud2(*cloud_filtered, *m_cloud);
      cloud = m_cloud;
  }
  </code></pre>