#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace pcl; using namespace std; namespace po = boost::program_options; //i=1;for x in ./*.bin; do ./build/bin2pcd --infile $x --outfile ./$i.pcd; let i=i+1; done int main(int argc, char **argv){ ///The file to read from. string infile; ///The file to output to. string outfile; // Declare the supported options. po::options_description desc("Program options"); desc.add_options() //Options ("infile", po::value(&infile)->required(), "the file to read a point cloud from") ("outfile", po::value(&outfile)->required(), "the file to write the DoN point cloud & normals to") ; // Parse the command line po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); // Print help if (vm.count("help")) { cout << desc << "\n"; return false; } // Process options. po::notify(vm); // load point cloud fstream input(infile.c_str(), ios::in | ios::binary); if(!input.good()){ cerr << "Could not read file: " << infile << endl; exit(EXIT_FAILURE); } input.seekg(0, ios::beg); pcl::PointCloud::Ptr points (new pcl::PointCloud); int i; for (i=0; input.good() && !input.eof(); i++) { PointXYZI point; input.read((char *) &point.x, 3*sizeof(float)); input.read((char *) &point.intensity, sizeof(float)); points->push_back(point); std::cout<<" x: "< (outfile, *points, false); }