pcd_write.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <pcl/io/pcd_io.h>
00003 #include <pcl/point_types.h>
00004 
00005 int
00006   main (int argc, char** argv)
00007 {
00008   pcl::PointCloud<pcl::PointXYZ> cloud;
00009 
00010   // Fill in the cloud data
00011   cloud.width    = 5;
00012   cloud.height   = 1;
00013   cloud.is_dense = false;
00014   cloud.points.resize (cloud.width * cloud.height);
00015 
00016   for (size_t i = 0; i < cloud.points.size (); ++i)
00017   {
00018     cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
00019     cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
00020     cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
00021   }
00022 
00023   pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud);
00024   std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;
00025 
00026   for (size_t i = 0; i < cloud.points.size (); ++i)
00027     std::cerr << "    " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;
00028 
00029   return (0);
00030 }


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:16:25