PyMeshLab icon indicating copy to clipboard operation
PyMeshLab copied to clipboard

PLY importer can't load some custom float properties

Open D4KU opened this issue 10 months ago • 2 comments

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

D4KU avatar Apr 16 '24 12:04 D4KU