Advertisement
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){
- char input_fname[2048];
- char output_fname[2048];
- //ファイル名の読み込み
- std::cout << "Input file name:";
- std::cin >> input_fname;
- pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBNormal>);
- //XYZファイルの読み込み
- std::ifstream ifs(input_fname);
- std::string buf;
- for(size_t i=0; ifs && getline(ifs, buf); i++){
- std::cout << buf << std::endl;
- std::istringstream is(buf);
- pcl::PointXYZRGBNormal pnt;
- is >> pnt.x
- >> pnt.y
- >> pnt.z
- >> pnt.r
- >> pnt.g
- >> pnt.b
- >> pnt.normal_x
- >> pnt.normal_y
- >> pnt.normal_z
- >> pnt.curvature;
- cloud->push_back ( pnt );
- }
- //pcdファイルに書き出し
- std::cout << "Output file name:";
- std::cin >> output_fname;
- pcl::io::savePCDFileASCII(output_fname, *cloud);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement