一. PCD文件中Data binary 转换为Data ascii
void pcdBinaryOrPcdASCII(std::string fileIn, std::string fileOut, int type, int precision)
{
pcl::PCLPointCloud2 cloud;
Eigen::Vector4f origin;
Eigen::Quaternionf orientation;
//将文件中的数据读到cloud, origin, orientation中
pcl::io::loadPCDFile(fileIn, cloud, origin, orientation);
std::cerr << "Loaded a point cloud with " << cloud.width * cloud.height <<
" points (total size is " << cloud.data.size() <<
") and the following channels: " << pcl::getFieldsList(cloud) << std::endl;
pcl::PCDWriter w;
if (type == 0)
{
std::cerr << "Saving file " << fileOut << " as ascii." << std::endl;
w.writeASCII(fileOut, cloud, origin, orientation, precision);
}
else if (type == 1)
{
std::cerr << "Saving file " <