我有一个代表三维点云的顶点数组,我想将它导入PyMeshLab中为对象生成人脸(有点像生成凸包,但是如果三维对象是人类手的顶点,它将正确地环绕每个手指)。PyMeshLab (或其他库)提供此功能吗?下面的代码通常是使用具有顶点和面的.obj来实现的,但是当给出一些只有顶点的东西时,情况就不是这样了。
ms = pymeshlab.MeshSet()
ms.load_new_mesh('vertices.npy')
ms.generate_surface_reconstruction_ball_pivoting()
ms.save_current_mesh('vertices.obj')
# get a reference to the current mesh
m = ms.current_mesh()
# get numpy arrays of vertices and faces of the current mesh
v_matrix = m.vertex_matrix()
f_matrix = m.face_matrix() # <- I would like to generate this, but I'm not allowed so with just a faces input发布于 2022-08-09 14:38:36
PyVista库可以肯定地做到这一点。老实说,我不知道MeshLab是否也能做到这一点,我必须检查一下。
举个例子,让我们考虑一下斯坦福德兔子。我输入了它的网格并得到了它的顶点。reconstruct_surface方法做到了这一点。您必须调整该方法的参数以获得所需的结果。有关更多细节,请参见这里。
import pyvista as pv
bunny = pv.read("Stanford_Bunny.ply")
points = pv.wrap(bunny.points)
surf = points.reconstruct_surface(nbr_sz=10)
pl = pv.Plotter(shape=(1, 2))
pl.add_mesh(points)
pl.add_title("Point Cloud of 3D Surface")
pl.subplot(0, 1)
pl.add_mesh(surf, color=True, show_edges=True)
pl.add_title("Reconstructed Surface")
pl.show()

如果你只想要凸包,检查这个枕法。
https://stackoverflow.com/questions/73293266
复制相似问题