将点云(含有强度信息)保存成bin文件
在这里插入代码片
**void SaveToBin(const pcl::PointCloud<PointType>& cloud, const std::string& path) {
std::cout << "bin_path: " << path << std::endl;
std::ofstream out(path.c_str(), ios::out|ios::binary|ios::app);
if(!out.good()) {
cout<<"Couldn't open "<<path<<endl;
return;
}
for (size_t i = 0; i < cloud.points.size (); ++i) {
out.write((char*)&cloud.points[i].x, 3*sizeof(float));
out.write((char*)&cloud.points[i].intensity, sizeof(float));
}
out.close();
}**