pcd 转换成 bin文件

pcd 转换成 bin文件

使用开源工具pypcd
使用一下命令安装
pip install git+https://github.com/DanielPollithy/pypcd.git
可以使用以下脚本读取 .pcd 文件,并将其转换成 .bin 格式来保存
import numpy as np
from pypcd import pypcd

pcd_data = pypcd.PointCloud.from_path(‘point_cloud_data.pcd’)
points = np.zeros([pcd_data.width, 4], dtype=np.float32)
points[:, 0] = pcd_data.pc_data[‘x’].copy()
points[:, 1] = pcd_data.pc_data[‘y’].copy()
points[:, 2] = pcd_data.pc_data[‘z’].copy()
points[:, 3] = pcd_data.pc_data[‘intensity’].copy().astype(np.float32)
with open(‘point_cloud_data.bin’, ‘wb’) as f:
f.write(points.tobytes())

.las 转换成 .bin:常见的转换流程为 .las -> .pcd -> .bin,.las -> .pcd 的转换可以用该工具实现。

猜你喜欢

转载自blog.csdn.net/weixin_43915090/article/details/133700768
今日推荐