Exemplo n.º 1
0
 void
 save (const std::string &object_file, const std::string &plane_file)
 {
   PCDWriter w;
   if (object_ && !object_->empty ())
   {
     w.writeBinaryCompressed (object_file, *object_);
     w.writeBinaryCompressed (plane_file, *plane_);
     print_highlight ("Object successfully segmented. Saving results in: %s, and %s.\n", object_file.c_str (), plane_file.c_str ());
   }
 }
Exemplo n.º 2
0
Arquivo: xyz2pcd.cpp Projeto: 2php/pcl
/* ---[ */
int
main (int argc, char** argv)
{
  print_info ("Convert a simple XYZ file to PCD format. For more information, use: %s -h\n", argv[0]);

  if (argc < 3)
  {
    printHelp (argc, argv);
    return (-1);
  }

  // Parse the command line arguments for .pcd and .ply files
  vector<int> pcd_file_indices = parse_file_extension_argument (argc, argv, ".pcd");
  vector<int> xyz_file_indices = parse_file_extension_argument (argc, argv, ".xyz");
  if (pcd_file_indices.size () != 1 || xyz_file_indices.size () != 1)
  {
    print_error ("Need one input XYZ file and one output PCD file.\n");
    return (-1);
  }

  // Load the first file
  PointCloud<PointXYZ> cloud;
  if (!loadCloud (argv[xyz_file_indices[0]], cloud)) 
    return (-1);

  // Convert to PCD and save
  PCDWriter w;
  w.writeBinaryCompressed (argv[pcd_file_indices[0]], cloud);
}
Exemplo n.º 3
0
void
saveCloud (const string &filename, const pcl::PCLPointCloud2 &output,
           const Eigen::Vector4f &translation, const Eigen::Quaternionf &orientation)
{
  PCDWriter w;
  w.writeBinaryCompressed (filename, output, translation, orientation);
}
Exemplo n.º 4
0
void
cloud_cb (const CloudConstPtr& cloud)
{
    PCDWriter w;
    sprintf (buf, "frame_%06d.pcd", i);
    w.writeBinaryCompressed (buf, *cloud);
    PCL_INFO ("Wrote a cloud with %zu (%ux%u) points in %s.\n",
              cloud->size (), cloud->width, cloud->height, buf);
    ++i;
}
Exemplo n.º 5
0
void
saveCloud (const string &filename, const pcl::PCLPointCloud2 &output)
{
  TicToc tt;
  tt.tic ();

  print_highlight ("Saving "); print_value ("%s ", filename.c_str ());

  PCDWriter w;
  w.writeBinaryCompressed (filename, output, translation, orientation);
  
  print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n");
}
Exemplo n.º 6
0
void
saveCloud (const std::string &filename, const pcl::PCLPointCloud2 &output)
{
  TicToc tt;
  tt.tic ();

  print_highlight ("Saving "); print_value ("%s ", filename.c_str ());

  PCDWriter w;
  w.writeBinaryCompressed (filename, output);
  
  printElapsedTimeAndNumberOfPoints (tt.toc (), output.width, output.height);
}