[英]How can I output the open3d geometry PointCloud as .pcd file?
I am converting a lidar data (in .bin format) into .pcd format with the following code我正在使用以下代码将激光雷达数据(.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)
And trying to output 'pcd' as a .pcd file:并尝试将“pcd”输出为 .pcd 文件:
with open("pcd_output.pcd", "wb") as pcd2:
pickle.dump(pcd,pcd2)
However, I got the following error:但是,我收到以下错误:
---------------------------------------------------------------------------
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
How can I output the open3d geometry PointCloud as .pcd file?如何将 open3d 几何 PointCloud 输出为 .pcd 文件?
Have you tried the default open3d.io.write_point_cloud()
function?您是否尝试过默认的open3d.io.write_point_cloud()
函数?
According to the example here , you can use it as below:根据此处的示例,您可以按如下方式使用它:
import open3d as o3d
o3d.io.write_point_cloud("copy_of_fragment.pcd", pcd)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.