FourierFlux
FourierFlux

Reputation: 589

Save 4d numpy array as pcd(point cloud) file

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).

Upvotes: 3

Views: 5390

Answers (1)

Jacek Jaskólski
Jacek Jaskólski

Reputation: 151

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.

Upvotes: 5

Related Questions