-
安装Anaconda
-
在Anaconda环境下安装安装 PCL 和 pclpy
安装pclpyconda install -c conda-forge -c davidcaron pclpy
-
报错
1、ImportError: libqhull_p.so.7: cannot open shared object file: No such file or directory
解决方法:conda install qhull==2019.1 conda install -c conda-forge -c davidcaron pclpy
2、
PackagesNotFoundError: The following packages are not available from current channels
解决方法:conda config --append channels conda-forge 重新执行报错1的命令
-
转换程序
1、ascii转binaryimport pclpy.pcl def ascii_binary(pcd_src_path, pcd_dst_path): pcl_file = pclpy.pcl.PointCloud.PointXYZI() pclpy.pcl.io.loadPCDFile(pcd_src_path, pcl_file) pclpy.pcl.io.savePCDFileBinary(pcd_dst_path, pcl_file) if __name__ == "__main__": import sys if len(sys.argv) < 3: print("Usage: python convert_pcd.py <source_pcd_path> <destination_pcd_path>") else: source_path = sys.argv[1] destination_path = sys.argv[2] ascii_binary(source_path, destination_path)
2、binary转ascii
import pclpy.pcl def pcl_binary_ascii(pcd_src_path, pcd_dst_path): pcl_file = pclpy.pcl.PointCloud.PointXYZI() pclpy.pcl.io.loadPCDFile(pcd_src_path, pcl_file) pclpy.pcl.io.savePCDFileASCII(pcd_dst_path, pcl_file) if __name__ == "__main__": import sys if len(sys.argv) < 3: print("Usage: python convert_pcd.py <source_pcd_path> <destination_pcd_path>") else: source_path = sys.argv[1] destination_path = sys.argv[2] pcl_binary_ascii(source_path, destination_path)
-
参考链接:https://blog.csdn.net/zhuxingKevin/article/details/129183767、https://blog.csdn.net/weixin_45552562/article/details/109668589
Ubuntu20.04环境下python实现PCD文件中点云数据存储类型ascii与binary的格式转换
最新推荐文章于 2024-04-09 09:56:46 发布