在使用CloudCompare导入pcd文件时,弹窗报错:
An error occurred while loading 'original_point_cloud': the third-party library in charge of saving/loading the file has failed to perform the operation
然而我直接用Python脚本是可以预览的:
未能理解确切原因,但有解决方法:
写一个Python脚本,将pcd格式的点云文件转为ply格式:
import open3d as o3d
def convert_pcd_to_ply(input_file_path, output_file_path):
# 读取PCD文件
point_cloud = o3d.io.read_point_cloud(input_file_path)
# 检查点云是否成功加载
if point_cloud.is_empty():
print(f"Error loading point cloud from {input_file_path}. Please check the file path or format.")
return
# 将点云保存为PLY格式
o3d.io.write_point_cloud(output_file_path, point_cloud)
print(f"Point cloud saved as {output_file_path}")
# 使用示例
input_file_path = "original_point_cloud.pcd" # 输入文件路径
output_file_path = "converted_point_cloud.ply" # 输出文件路径
convert_pcd_to_ply(input_file_path, output_file_path)
再次导入ply文件,没有报错了: