如何将txt文件中的3D点坐标导入python中的pymeshlab

How to import the 3D points coordinates in txt file to the pymeshlab in python

我是这个领域的新手。我有一个存储在 txt 文件中的 3D 点(xyz 坐标)列表。我想 find/build meshes/surface 使用这些点。我知道 meshlab 表面重建功能可以帮助解决这个问题。我很想使用 pymeshlab。

根据文档,该示例只是将一个 obj 文件加载到 Meshset class。我 googled 这些类型的文件通常是从某些 3D 模型软件生成的。我从 google ARcore 获取数据,并以 txt 格式手动保存。我想用pymeshlab处理python中的这些点,pymeshlab读取txt文件了吗?如果不是,它读取什么格式?我应该如何将我的 txt 文件转换为所需的文件?

希望有更详细的说明。

Meshlab 和 pymeshlab 将读取您的文件。只需将它们重命名为具有 xyz 扩展名即可。

import pymeshlab as ml
ms = ml.MeshSet()
#Load a cloud of points 
ms.load_new_mesh('input.xyz')
m = ms.current_mesh()

print("Input mesh has", m.vertex_number(), 'vertex and', m.face_number(), 'faces' )