DanielPollithy / pypcd

Fork of Dimatura's pypcd with merged pull requests and some extras
Other
37 stars 30 forks source link

Failes to read binar or binary compressed pcd files #6

Open SvenMuc opened 2 years ago

SvenMuc commented 2 years ago

I'm using python 3.8 and want to read binary or binary compressed pcd files. The pcd files seems to be ok, because other tools like pcl_viewer visualize them correctly.

ASCII ==> OK {'version': '0.7', 'fields': ['x', 'y', 'z', 'intensity', 't', 'reflectivity', 'ring', 'ambient', 'range'], 'size': [4, 4, 4, 4, 4, 2, 1, 2, 4], 'type': ['F', 'F', 'F', 'F', 'U', 'U', 'U', 'U', 'U'], 'count': [1, 1, 1, 1, 1, 1, 1, 1, 1], 'width': 2048, 'height': 128, 'viewpoint': [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0], 'points': 262144, 'data': 'ascii'} [(-0.000000000000, 0.000000000000, 0.000000000000, 4.000000000000, 0, 0, 0, 229, 0) (-0.313022673130, 0.022687347606, 0.153115406632, 52.000000000000, 43776, 117, 0, 154, 336) (-0.306455463171, 0.023132724687, 0.150558993220, 60.000000000000, 95232, 119, 0, 165, 329) (-0.306383043528, 0.024072807282, 0.150558993220, 70.000000000000, 149760, 122, 0, 159, 329) (-0.000000000000, 0.000000000000, 0.000000000000, 3.000000000000, 197632, 0, 0, 217, 0) (-0.000000000000, 0.000000000000, 0.000000000000, 4.000000000000, 239872, 0, 0, 211, 0) (-0.301513284445, 0.026466993615, 0.148732990026, 53.000000000000, 289024, 117, 0, 152, 324) (-0.000000000000, 0.000000000000, 0.000000000000, 4.000000000000, 345856, 0, 0, 211, 0) (-0.290227115154, 0.027229102328, 0.144350573421, 62.000000000000, 392960, 120, 0, 160, 312) (-0.288289755583, 0.027932453901, 0.143620163202, 48.000000000000, 435456, 115, 0, 164, 310)]

Binary ==> invalid values {'version': '0.7', 'fields': ['x', 'y', 'z', 'intensity', 't', 'reflectivity', 'ring', 'ambient', 'range'], 'size': [4, 4, 4, 4, 4, 2, 1, 2, 4], 'type': ['F', 'F', 'F', 'F', 'U', 'U', 'U', 'U', 'U'], 'count': [1, 1, 1, 1, 1, 1, 1, 1, 1], 'width': 2048, 'height': 128, 'viewpoint': [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0], 'points': 262144, 'data': 'binary'} [(-0.322375327349, 0.022405456752, 0.156767427921, 1.000000000000, 1116340224, 0, 0, 31232, 3070230528) ( 9007199254740992.000000000000, 0.000000000000, 0.000000000000, 0.000000000000, 2181038080, 40663, 190, 7677, 2870295736) ( 0.000000000000, 0.000000000000, -0.031313404441, 0.000000000000, 10616832, 0, 77, 1, 0) ( 0.000000000000, 0.000000000000, -0.000000000000, -23.072139739990, 483019068, 62, 0, 16256, 1115947008) ( 0.000000000000, 0.000000000000, 0.000000000000, 0.000000000000, 0, 0, 0, 0, 0) ( 0.000000000000, 0.000000000000, 0.000000000000, 0.000000000000, 4194304, 595, 0, 0, 12451840) ( 0.000000000000, 0.000000000000, 0.000000000000, 0.000000000000, 1092157440, 48798, 235, 52953, 457922620) (-0.000000000000, 33554684.000000000000, 0.000000000000, 0.000000000000, 39168, 19456, 1, 0, 0) ( 0.000000000000, 0.000000000000, -0.319211810827, 0.027101533487, 1042245743, 0, 128, 63, 4363264) ( 2658757058587385950290469587571965952.000000000000, -0.000000000000, 140737488355328.000000000000, 0.000000000000, 0, 0, 0, 0, 0)]

Binary Compressed ==> crash File "/datasets/utils/src/pypcd/pypcd/pypcd.py", line 755, in from_path return point_cloud_from_path(fname) File "/datasets/utils/src/pypcd/pypcd/pypcd.py", line 312, in point_cloud_from_path pc = point_cloud_from_fileobj(f) File "/datasets/utils/src/pypcd/pypcd/pypcd.py", line 305, in point_cloud_from_fileobj return PointCloud(metadata, pc_data) File "/datasets/utils/src/pypcd/pypcd/pypcd.py", line 690, in init self.check_sanity() File "/datasets/utils/src/pypcd/pypcd/pypcd.py", line 703, in check_sanity assert(self.pc_data.size == self.points) AssertionError

Any ideas what's going wrong?

DanielPollithy commented 2 years ago

Hi! Can you upload the files so I can look into it?

SvenMuc commented 2 years ago

Hi, please find the test files here: https://drive.google.com/drive/folders/11PkiTw2ZXh1KaXzBlsjYgT4chPIcsOgJ?usp=sharing

In the meanwhile I could fix the binary format. I used another version (fork) of pypcd to write the files. If I use the same version it works. The binary compressed format still produces the same issue.

SvenMuc commented 2 years ago

Any update? Could you download the files?