gpt4 book ai didi

python - 如何将 open3d 几何点云输出为 .pcd 文件?

转载 作者:行者123 更新时间:2023-12-02 02:58:28 25 4
gpt4 key购买 nike

我正在使用以下代码将激光雷达数据(.bin 格式)转换为 .pcd 格式

with open ("lidar_velodyne64.bin", "rb") as f:
byte = f.read(size_float*4)
while byte:
x,y,z,intensity = struct.unpack("ffff", byte)
list_pcd.append([x, y, z])
byte = f.read(size_float*4)
np_pcd = np.asarray(list_pcd)
pcd = o3d.geometry.PointCloud()
v3d = o3d.utility.Vector3dVector
pcd.points = v3d(np_pcd)

并尝试将“pcd”输出为 .pcd 文件:

with open("pcd_output.pcd", "wb") as pcd2:
pickle.dump(pcd,pcd2)

但是,我得到了以下错误:

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-16-cde8b419d929> in <module>
1 with open("pcd_output.pcd", "wb") as pcd2:
----> 2 pickle.dump(pcd,pcd2)

TypeError: can't pickle open3d.open3d.geometry.PointCloud objects

如何将 open3d 几何点云输出为 .pcd 文件?

最佳答案

你试过默认的open3d.io.write_point_cloud()吗?功能?

根据例子here ,您可以按如下方式使用它:

import open3d as o3d
o3d.io.write_point_cloud("copy_of_fragment.pcd", pcd)

关于python - 如何将 open3d 几何点云输出为 .pcd 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60560878/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com