如何将 .pcd 文件中的所有点导入到二维 python 数组中

Bri*_*erg 8 python-3.x point-cloud-library

如何从名为 edge_cloud.pcd 的文件中导入所有 3d 点并将它们放入数组中?我希望数组采用以下格式

array=[[xvalue1,yvalue1,zvalue1],[xvalue2,yvalue2,zvalue2]] 
Run Code Online (Sandbox Code Playgroud)

iok*_*ins 10

使用 Python 3.7.3、1.16.2numpyopen3d0.7.0.0 进行测试:

import numpy as np 
import open3d as o3d

pcd = o3d.io.read_point_cloud("C:\\Users\\Username\\Source\\pointcloud\\bunny.pcd")
out_arr = np.asarray(pcd.points)  
print("output array from input list : ", out_arr)  
Run Code Online (Sandbox Code Playgroud)

输出:

output array from input list :  
[[ 0.0054216  0.11349    0.040749 ]
 [-0.0017447  0.11425    0.041273 ]
 [-0.010661   0.11338    0.040916 ]
 ...
 [-0.064992   0.17802   -0.054645 ]
 [-0.069935   0.17983   -0.051988 ]
 [-0.07793    0.17516   -0.0444   ]]
Run Code Online (Sandbox Code Playgroud)

输入PCD文件:

https://github.com/PointCloudLibrary/pcl/blob/master/test/bunny.pcd