Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 6: Voxelization > Voxelizing Data

Voxelizing Data

Voxelizing in PCL is simply accomplished: the voxelizer is a filter, and it takes a point cloud as an input. It then outputs the voxelized point cloud, calculated for the centroid of the set of points voxelized. See Listing 6-1 for an example.

Listing 6-1. Voxelizing Data

#include <pcl/filters/voxel_grid.h>

//Voxelization
pcl::VoxelGrid<pcl::PointXYZRGB> vox;
vox.setInputCloud (point_cloud_ptr);
vox.setLeafSize (5.0f, 5.0f, 5.0f);
vox.filter (*cloud_filtered);
std::cerr << "PointCloud before filtering: " << point_cloud_ptr->width *
point_cloud_ptr->height << " data points (" << pcl::getFieldsList (*point_cloud_ptr) << ").";
std::cerr << "PointCloud after filtering: " << cloud_filtered->width *
cloud_filtered->height << " data points (" << pcl::getFieldsList (*cloud_filtered) << ").";

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial