我正在处理ply文件的数据集。最后,我需要在一个单独的目录中导出ply文件。
现在,如果我使用函数trimesh.exchange.ply.export_ply,我似乎无法理解如何设置导出网格的目录。我已经阅读了文档,但没有提到如何设置输出路径
mesh = trimesh.load("file.ply")
#print(mesh.volume)
trimesh.exchange.ply.export_ply(mesh, encoding='ascii') #How to set output directory?或者,我使用mesh.export(path),它可以成功导出文件,但对于某些文件,它会给出错误when opened in meshlab or any other editor
关于如何导出为ply文件有什么建议吗?
发布于 2021-10-09 21:18:08
trimesh.exchange.ply.export_ply()生成字节数组。您可以将其写入您想要的文件,如下所示:
result = trimesh.exchange.ply.export_ply(mesh, encoding='ascii')
output_file = open(your_path, "wb+")
output_file.write(result)
output_file.close()演示
运行良好=)我使用可用的免费scan作为输入文件:

https://stackoverflow.com/questions/69510607
复制相似问题