Spaces:
Runtime error
Runtime error
import numpy as np | |
import open3d as o3d | |
def mesh_network(point_cloud): | |
pcd = point_cloud | |
cl, ind = pcd.remove_statistical_outlier(nb_neighbors=20, std_ratio=20.0) | |
pcd = pcd.select_by_index(ind) | |
pcd.estimate_normals() | |
pcd.orient_normals_to_align_with_direction() | |
mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=12, n_threads=1)[0] | |
rotation = mesh.get_rotation_matrix_from_xyz((np.pi, 0, 0)) | |
mesh.rotate(rotation, center=(0, 0, 0)) | |
o3d.io.write_triangle_mesh(f'./mesh_depth12.obj', mesh) | |
return mesh |