Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLY importer can't load some custom float properties #368

Open
D4KU opened this issue Apr 16, 2024 · 2 comments
Open

PLY importer can't load some custom float properties #368

D4KU opened this issue Apr 16, 2024 · 2 comments

Comments

@D4KU
Copy link

D4KU commented Apr 16, 2024

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

@alemuntoni
Copy link
Member

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

@D4KU
Copy link
Author

D4KU commented Apr 18, 2024

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants