Search code examples
pythonnumpymeshtrimeshopen3d

Open3d Python Issue: No attribute 'estimate_normals'


I am working with open3d for python3 on windows. It was installed through pip via 'pip install open3d-python'. I've checked documentation and everything seems right with my script, which attempts to convert a point cloud file (.ply) to a mesh (.stl). However, on execution I get an attribute error: 'open3d.open3d.geometry.PointCloud' has no attribute 'estimate_normals'. Any help would be appreciated. Thank you

Here is my script

import open3d as o3d
import trimesh
import numpy as np

pcd = o3d.io.read_point_cloud("pointcloud.ply")
pcd.estimate_normals()
#pcd = pcd2.normals
# estimate radius for rolling ball
distances = pcd.compute_nearest_neighbor_distance()
avg_dist = np.mean(distances)
radius = 1.5 * avg_dist

mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(pcd,o3d.utility.DoubleVector([radius, radius * 2]))

trimesh = trimesh.Trimesh(np.asarray(mesh.vertices), np.asarray(mesh.triangles),vertex_normals=np.asarray(mesh.vertex_normals))

trimesh.export('stuff.stl')

EDIT

I read somewhere that compiling the original package from source would do the trick, but I'm a mac user, and am trying to do this on Windows, so I can't figure out how to do that. here is the github link for the package https://github.com/intel-isl/Open3D


Solution

  • I got the same problem and found that the issue happened because of the wrong version of open3d which was installed via pip install open3d-python. For me it was v0.6.0. The documentation is based on the new releases. Starting with version v0.8.0 open3d should be installed as pip install open3d or conda install -c open3d-admin open3d for conda. Found that information in releases. It solved the problem on my mac.