【问题标题】:How to import the 3D points coordinates in txt file to the pymeshlab in python如何将txt文件中的3D点坐标导入python中的pymeshlab
【发布时间】:2021-05-28 18:12:27
【问题描述】:
我是这个领域的新手。我有一个存储在 txt 文件中的 3D 点(xyz 坐标)列表。我想使用这些点查找/构建网格/曲面。我知道 meshlab 表面重建功能对此有帮助。我很想使用 pymeshlab。
从文档中,该示例只是将一个 obj 文件加载到 Meshset 类。我用谷歌搜索这些类型的文件通常是从一些 3D 模型软件生成的。我从谷歌 ARcore 获得的数据以 txt 格式手动保存。我想用pymeshlab在python中处理这些点,pymeshlab是否读取了txt文件?如果不是,它读取什么格式?我应该如何将我的 txt 文件转换为所需的文件?
希望有更详细的说明。
【问题讨论】:
标签:
python
meshlab
pymeshlab
【解决方案1】:
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' )