cnr-isti-vclab/PyMeshLab

PLY importer can't load some custom float properties

D4KU opened this issue · 2 comments

D4KU commented

I am trying to load a PLY file with a custom float vertex property named confidence, ranging between 0 and 100. The MeshLab GUI automatically converts this property to vertex quality, but PyMeshLab seems to do something wrong when trying to do the same. The vertex_scalar_array is filled, but only with near-zero values. Because vertex_custom_scalar_attribute_array isn't populated either, I see no way of getting at my values. Is there another way I'm missing? Interestingly, everything works smoothly when I rename the property to quality with a text editor inside the PLY file. I've uploaded the file here: confidence.zip

from pymeshlab import MeshSet
import sys

ms = MeshSet()
ms.load_new_mesh(sys.argv[1])
mesh = ms.current_mesh()

# contains values around 1.5e-313
scalars = mesh.vertex_scalar_array()

# No valid per vertex scalar attribute named confidence was found
confs = mesh.vertex_custom_scalar_attribute_array('confidence')

# No valid per vertex scalar attribute named quality was found
quals = mesh.vertex_custom_scalar_attribute_array('quality')

System: Windows 11
PyMeshLab version: 2023.12.post1

Thank you for this amazing tool,
David

I think that it should work if you make the custom attribute double instead of float in the ply file.

D4KU commented

I have a lot of these meshes exported from another application, where I don't have any settings for this and since renaming it to float quality also helps, I'll do that with a little script without having to mess with the binary part of the PLY file.

Just wanted to make sure I'm not missing anything inside PyMeshLab that would spare me the custom script. :)