Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

pcl c++ read .pcd

1#include <iostream>
 2#include <pcl/io/pcd_io.h>
 3#include <pcl/point_types.h>
 4
 5int
 6main ()
 7{
 8  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
 9
10  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1) //* load the file
11  {
12    PCL_ERROR ("Couldn't read file test_pcd.pcd 
");
13    return (-1);
14  }
15  std::cout << "Loaded "
16            << cloud->width * cloud->height
17            << " data points from test_pcd.pcd with the following fields: "
18            << std::endl;
19  for (const auto& point: *cloud)
20    std::cout << "    " << point.x
21              << " "    << point.y
22              << " "    << point.z << std::endl;
23
24  return (0);
25}
Source by pcl.readthedocs.io #
 
PREVIOUS NEXT
Tagged: #pcl #read
ADD COMMENT
Topic
Name
6+4 =