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

Failes to read binar or binary compressed pcd files #36

Open
SvenMuc opened this issue Feb 10, 2022 · 3 comments
Open

Failes to read binar or binary compressed pcd files #36

SvenMuc opened this issue Feb 10, 2022 · 3 comments

Comments

@SvenMuc
Copy link

SvenMuc commented Feb 10, 2022

I'm using python 2.7 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?

@HaisenbergPeng
Copy link

I got the same error when reading binary_compressed pcd!

@hhhharold
Copy link

In the source code, only 'width' is used to read the binary data.
Two ways to solve the problem, one is to modify the source code. Another is to change the width from 2048 to 2048*128 in pcd file

@joelosw
Copy link

joelosw commented Mar 20, 2023

Hi, since this project seems to be inactive I forked it and started to improve some things. It uses the height as well, so structured point clouds should not be a problem anymore.

You can find it here: pypcd-imp or install it right away via pip install pypcd_imp.
If the issue is still present there feel free to reopen it in my repo and I will try to fix it.

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

4 participants