Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <fstream>
- #include <sstream>
- #include <pcl/io/pcd_io.h>
- #include <pcl/point_types.h>
- int main (int argc, char** argv)
- {
- if(argc!=3)
- {
- fprintf(stderr,"Usage: %s\n(1)Input_XYZRGB_filename\n(2)Output_filename\n",argv[0]);
- exit(1);
- }
- char input_fname[2048];
- char output_fname[2048];
- pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGB>);
- //XYZRGBファイルの読み込み (Input XYZRGB file)
- //std::ifstream ifs(input_fname);
- std::ifstream ifs(argv[1]);
- std::string buf;
- for(size_t i=0; ifs && getline(ifs, buf); i++)
- {
- std::cout << buf << std::endl;
- std::istringstream is(buf);
- pcl::PointXYZRGB pnt;
- is >> pnt.x
- >> pnt.y
- >> pnt.z
- >> pnt.r
- >> pnt.g
- >> pnt.b;
- cloud->push_back ( pnt );
- }
- //pcd(ASCII)ファイルに書き出し Output pcd(ASCII)
- //std::cout << "Output file name:";
- //std::cin >> output_fname;
- //pcl::io::savePCDFileASCII(output_fname, *cloud);
- pcl::io::savePCDFileASCII(argv[2], *cloud);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment