How do you import all the 3d points from a file named edge_cloud.pcd and put them into an array? I want the array to be in the format
array=[[xvalue1,yvalue1,zvalue1],[xvalue2,yvalue2,zvalue2]]
Tested with Python 3.7.3, numpy
1.16.2, and open3d
0.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)
Output:
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 ]]
Input PCD file:
https://github.com/PointCloudLibrary/pcl/blob/master/test/bunny.pcd