pcl icon indicating copy to clipboard operation
pcl copied to clipboard

Do not throw error for invalid count when field name is "_" (pcl::PCDReader::readHeader)

Open shreysamdani opened this issue 3 years ago • 7 comments

Description

For LIDAR pcd files, there can be instances where the count for a field is < 1 if the field is "_". In such cases, we shouldn't throw an error when trying to read the file.

Bugs resolved

https://github.com/PDAL/PDAL/issues/2572

shreysamdani avatar Feb 24 '21 18:02 shreysamdani

Hi, sorry for the delay. I am not so sure about this code change. I feel like we might introduce bugs if we allow point fields with count < 1 (even if they are only "_" fields). Do you know how these LIDAR PCD files were created? The PCDWriter from PCL won't write fields with count=0. BTW a solution to "fix" such PCD files would be to remove the columns from the PCD header (remove the respective entries in FIELDS, SIZE, TYPE, COUNT).

mvieth avatar Apr 01 '21 08:04 mvieth

same issue here. many PCD files provided by our client won't work due to this.

.PCD v0.7 - Point Cloud Data file format

VERSION 0.7 FIELDS x y z _ intensity _ timestamp _ ring _ SIZE 4 4 4 1 4 1 8 1 2 1 TYPE F F F U F U F U U U COUNT 1 1 1 4 1 0 1 6 1 12 WIDTH 93504 HEIGHT 1 VIEWPOINT 0 0 0 1 0 0 0 POINTS 93504 DATA binary

weimzh avatar Apr 29 '21 03:04 weimzh

Instead of modifying the core lib, how about a tool to remove 0 count fields?

kunaltyagi avatar Apr 29 '21 05:04 kunaltyagi

Or how about changing the PCDReader so that these fields are removed during reading, as if they had never been in the PCD file?

mvieth avatar Apr 29 '21 07:04 mvieth

😆 Didn't realize this was not an issue, but a single line PR

kunaltyagi avatar Apr 29 '21 19:04 kunaltyagi

This is still an issue in 2022. Will that PR be merged?

xaedes avatar Aug 25 '22 10:08 xaedes

This is still an issue in 2022. Will that PR be merged?

Not with the changes it makes right now. Copied from my earlier comment:

I am not so sure about this code change. I feel like we might introduce bugs if we allow point fields with count < 1 (even if they are only "_" fields). Do you know how these LIDAR PCD files were created? The PCDWriter from PCL won't write fields with count=0. BTW a solution to "fix" such PCD files would be to remove the columns from the PCD header (remove the respective entries in FIELDS, SIZE, TYPE, COUNT).

mvieth avatar Aug 28 '22 18:08 mvieth