Integer scalar fields are exported as float (ply)
When creating a scalar field for classification, e.g. using the segmentation tool. The values are represented as integers in cloudcompare (as expected). However, when exporting the classified point cloud to .ply, the field is converted to float.
Steps to reproduce the behaviour:
- Open a pointcloud
- Use the segmentation tool to create a new classification field and segment part of the cloud in any class
- Save the classified pointcloud as .ply through the save menu
- See that all scalar fields are converted to float in the header of the generated ply-file
Expected behaviour Integer scalar fields such as classification should be exported as such and not converted to float. While the classification field and point cloud index (after a merge) is easy to infer as integer fields, it's not obvious in general, so adding an export menu where the type of each scalar field can be manually defined would probably be the best solution.
Additional context This problem could possibly also be occurring for other export formats
Your environment CloudCompare v2.12.4 (Kyiv) Windows
Internally, CloudCompare uses float for scalar fields. So it cannot make the difference between a generic scalar field and an integer-only scalar field at save time...
Ok, thanks
Another question that popped up, what is the expected behaviour when merging two pointclouds where one of them has an extra scalar field compared to the other? I noticed that cloudcompare seem to assign 0 as default value for the points that does not have that scalar field when visualizing, however, when exporting it is assigned as NaN.
Is this guaranteed to be the case or does it depend on the output format or other factors?
Normally, CC should assign the NaN values when merging (the points of the cloud which did not have the scalar field should appear in grey).