AttributeError: module 'open3d' has no attribute 'PointCloud'

Viewed 2990

I'm trying to an example code in my vsc editor. However, I got the AttributeError: module 'open3d' has no attribute 'PointCloud'error. I looked how to fix this problem but none of those are worked. Looking for any help. I'm using Win10 and Python 3.8. Thanks in advance

import open3d as o3d
import numpy as np

pc_array = np.array([[1, 2, 3], [3, 4, 5]], dtype=np.float32)
print(pc_array)

pc = o3d.PointCloud()
pc.points = o3d.Vector3dVector(pc_array)
print(pc)
2 Answers

According to the documentation it's within the geometry module. Try:

pc = o3d.geometry.PointCloud()

See also this example where they import PointCloud from the geometry module.

Sometimes when you build open3d from source you might encounter that error. Try, o3d.geometry.PointCloud.estimate_normals(<cloud>,search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=<float>,max_nn=<int>))

Related