我写了一个小脚本,它的任务是加载一个网格( ply ),然后应用一些过滤器,最后将整个东西导出为ply。
到目前为止一切顺利。但是生成的ply文件是不可读的。如果我尝试在MeshLab中打开它,它会显示:"Face with more 3 vertices“
以下是与pymeshlab相关的代码部分(已清理):
import pymeshlab as ml
ms = ml.MeshSet()
ms.load_new_mesh(path + mesh_name)
ms.apply_filter('convert_pervertex_uv_into_perwedge_uv')
ms.apply_filter('transfer_color_texture_to_vertex')
ms.save_current_mesh(path + 'AutomatedGeneration3.ply')我错过了什么吗?在执行此脚本时,实际上没有错误消息。我还尝试为保存过滤器使用一些参数,但这并没有改变任何东西。
我怎么才能让它变得正确呢?
发布于 2021-01-25 19:51:53
这似乎是该方法内部使用的.ply导出器中的错误ms.save_current_mesh()..。
该方法试图保存存储在网格中的所有信息,在这一点上是纹理_每
_顶点,纹理_每_楔形和颜色_每_顶点,那里出了点问题。
我已经通过禁用保存纹理实现了一种变通方法_每_楔形(仅在以下情况下才需要transfer_color_texture_to_vertex过滤器。
import pymeshlab as ml
ms = ml.MeshSet()
#Load a mesh with texture per wedge
ms.load_new_mesh('input_pervertex_uv.ply')
m = ms.current_mesh()
print("Input mesh has", m.vertex_number(), 'vertex and', m.face_number(), 'faces' )
ms.apply_filter('convert_pervertex_uv_into_perwedge_uv')
ms.apply_filter('transfer_color_texture_to_vertex')
#Export mesh with color_per_vertex but without texture
ms.save_current_mesh('output.ply',save_wedge_texcoord=False,save_vertex_coord=False )的有效参数列表save_current_mesh可以在这里阅读https://pymeshlab.readthedocs.io/en/latest/filter\_list.html#save-parameters
请注意save_vertex_coord指的是每顶点纹理坐标!!!
https://stackoverflow.com/questions/65846551
复制相似问题