I'm trying to open a pcd file in python using open3d, but the array of the point cloud is filled by nan.
import numpy as np
import open3d as o3d
from pypcd4 import PointCloud
if __name__ == "__main__":
print("Load a ply point cloud, print it, and render it")
pcd = o3d.io.read_point_cloud("TestData1/000_00_cloud.pcd")
print(pcd)
print(np.asarray(pcd.points))
o3d.visualization.draw_geometries([pcd])
Error:
Load a ply point cloud, print it, and render it
PointCloud with 518400 points.
[[nan nan nan]
[nan nan nan]
[nan nan nan]
...
[nan nan nan]
[nan nan nan]
[nan nan nan]]
How can i exclude the nan point? I need to do something with the numpy?
There are 2 ways to do this -
remove_nan_points=True and remove_infinite_points=True to o3d.io.read_point_cloud.pcd.remove_non_finite_points()See docs here and here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With