PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.64k stars 4.59k forks source link

Allow type conversion in fromPCLPointCloud2 #6059

Closed mvieth closed 3 weeks ago

mvieth commented 4 weeks ago

These changes enable automatic type conversion/casting, for example if x, y, z are of double type (but the PCL point types use float). This also takes effect if data is loaded from a file. Previously fields without an exact match were left empty. The prints now look like this, for example:

Failed to find exact match for field 'x'.
Failed to find exact match for field 'y'.
Failed to find exact match for field 'z'.
Will try to cast field 'x' (original type is double). You may loose precision during casting. Make sure that this is acceptable or choose a different point type.
Will try to cast field 'y' (original type is double). You may loose precision during casting. Make sure that this is acceptable or choose a different point type.
Will try to cast field 'z' (original type is double). You may loose precision during casting. Make sure that this is acceptable or choose a different point type.

Fixes https://github.com/PointCloudLibrary/pcl/issues/5639