我有一组看起来和球体相似的三维数据点。我需要这些数据点连接为一个水密的网格,以便它可以用于模拟。
我曾与Meshlab合作,并获得了一个合理的网格,但不是水密。
在此之后,我尝试了使用Open3D python库使用球支点算法。由此,我无法获得预期的水密网格。我尝试使用hole_fixer外部库(固定器),但是在使用cmake安装时发现了错误。
我已经插入了用于open3D的代码和"xyz“数据点。
import numpy as np
import open3d as o3d
dataname = 'meshdata2.xyz'
point_cloud = np.loadtxt(dataname, skiprows=1)
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(point_cloud[:,:3])
pcd.estimate_normals()
distances = pcd.compute_nearest_neighbor_distance()
avg_dist = np.mean(distances)
radius = 5*avg_dist
bpa_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(pcd, o3d.utility.DoubleVector([radius, radius*2, radius*0.5]))
print(str(bpa_mesh.is_watertight()))
o3d.visualization.draw_geometries([bpa_mesh])"xyz文件“链接:链接
从Open3D:open3D获得的网格
我想知道如何获得这些数据点的水密网格。
任何线索都将不胜感激。
致以敬意,
苏纳格R.
发布于 2021-03-13 03:51:52
要实现水密网,可以使用o3d.geometry.TriangleMesh.create_from_point_cloud_poisson。
然而,泊松重建需要一致的法线方向。在你的例子中,你可以把所有的法线定位到你的点云的中心。要做到这一点:
import numpy as np
import open3d as o3d
pcd = o3d.io.read_point_cloud('./meshdata2.xyz')
pcd.estimate_normals()
# to obtain a consistent normal orientation
pcd.orient_normals_towards_camera_location(pcd.get_center())
# or you might want to flip the normals to make them point outward, not mandatory
pcd.normals = o3d.utility.Vector3dVector( - np.asarray(pcd.normals))
# surface reconstruction using Poisson reconstruction
mesh, _ = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=9)
# paint uniform color to better visualize, not mandatory
mesh.paint_uniform_color(np.array([0.7, 0.7, 0.7]))
o3d.io.write_triangle_mesh('a.ply', mesh)使用上述代码段获得的网格:

对于具有复杂拓扑的点云,要获得一致的正常方向可能不容易,请阅读我的另一个答案获取更多信息。
发布于 2022-07-07 13:21:00
如果Open3D不产生水密网格(例如,由于这只虫子),则可以使用MeshLab的Python绑定
import pymeshlab
ms = pymeshlab.MeshSet()
ms.load_new_mesh("meshdata2.xyz")
ms.compute_normal_for_point_clouds()
ms.generate_surface_reconstruction_ball_pivoting()
# or ms.generate_surface_reconstruction_screened_poisson()
ms.meshing_remove_unreferenced_vertices()
ms.save_current_mesh("meshdata2.ply")正如OP已经指出的那样,MeshLab的表面重建滤波器似乎不适合给定的测试数据集。
https://stackoverflow.com/questions/66595268
复制相似问题