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
  • PrintPrint
Share this Page URL
Help

CHAPTER 7: Point Clouds, Part 1 > Creating a Point Cloud with PCL

Creating a Point Cloud with PCL

The basic type of the PCL is the pcl::PointCloud<PointT>. In itself, it is little more than a vector of points but PCL is built around it to provide other services like file I/O, visualization, and normal estimation. Therefore, it is good to start using the PointCloud class from the beginning.

The PointCloud class is templated to be flexible with the type of points we want to store. The simplest point type is pcl::PointXYZ, which consists of only a 3-D position. The type pcl::PointXYZRGB adds RGB color information to each point. The library provides many point types to suit the most common needs, but you are also free to create a custom point class to store other attributes.

If the number of points is known, the point cloud can be preallocated; otherwise, each point can be added with the PointCloud::push_back(PointT) method. The push_back method simply adds each point individually to the cloud while memory is dynamically allocated. Because it is common for many 3-D measurement devices (e.g., time-of-flight cameras, laser scanners, and the Kinect) to return 3-D points in a 2-D grid, the cloud can be indexed linearly as well as two dimensionally. Listing 7-1 shows the creation of a simple random point cloud to illustrate these concepts.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint