How can I convert a 4d numpy array to a pcd file? Open3d appears to let you save 3 dimensions but not a fourth(intensity).
-
which program do you expect to read the 4d data back in ? and where do you get those values from ?berak– berak2022-03-06 13:44:56 +00:00Commented Mar 6, 2022 at 13:44
-
it is a simple txt format, similar to pcl you can write your own exporter in a few lines of codeberak– berak2022-03-06 13:49:16 +00:00Commented Mar 6, 2022 at 13:49
Add a comment
|
1 Answer
It should be possible using the open3d.t namespace:
import open3d as o3d
import numpy as np
xyzi = np.random.rand(100, 4)
xyz = xyzi[:,0:3]
i = [[i] for i in xyzi[:,3]]
pcd = o3d.t.geometry.PointCloud()
pcd.point["positions"] = o3d.core.Tensor(xyz)
pcd.point["intensities"] = o3d.core.Tensor(i)
o3d.t.io.write_point_cloud("pointcloud.pcd", pcd)
For more info see this thread.