/* ---[ */ 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); }
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); }
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; }
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 ()); } }
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"); }
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); }
void saveCloud (const std::string &filename, CloudLT::Ptr &output) { TicToc tt; tt.tic (); print_highlight ("Saving "); print_value ("%s ", filename.c_str ()); PCDWriter w; w.write (filename, *output); print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output->width * output->height); print_info (" points]\n"); }
// TODO Enum for is_test_phase PointCloud<Signature>::Ptr Detector::obtainFeatures(Scene &scene, PointCloud<PointNormal>::Ptr keypoints, bool is_test_phase, bool cache) { if (cache == false) { PointCloud<Signature>::Ptr features = computeFeatures(scene.cloud, keypoints); return features; } else { std::string name_str = std::string(feature_est_->name_) + scene.id; if (is_test_phase) { name_str += "_test"; } else { name_str += "_train"; } name_str += ".pcd"; const char *name = name_str.c_str(); if (ifstream(name)) { PointCloud<Signature>::Ptr features (new PointCloud<Signature>()); PCDReader r; r.readEigen(std::string(name), *features); //*features = *tmp; //io::loadPCDFile(name, *features); if (features->size() != keypoints->size()) assert(false); cout << "got " << features->size() << " features from " << keypoints->size() << " points" << endl; return features; } else { PointCloud<Signature>::Ptr features = computeFeatures(scene.cloud, keypoints); PCDWriter w; w.writeASCIIEigen(std::string(name), *features); return features; } } }