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

Error when loading binary_compressed pcd file #21

Open
bearpaw opened this issue Mar 16, 2019 · 2 comments
Open

Error when loading binary_compressed pcd file #21

bearpaw opened this issue Mar 16, 2019 · 2 comments

Comments

@bearpaw
Copy link

bearpaw commented Mar 16, 2019

Thanks for the great library! When I reload the binary_compressed PCD file, which is saved by pypcd from ros message, there is an error happening at https://github.com/dimatura/pypcd/blob/master/pypcd/pypcd.py#L683

I checked the code, and found out that when decoding the data at https://github.com/dimatura/pypcd/blob/master/pypcd/pypcd.py#L264 pc_data is created as a numpy array with shape (width, ). After decoding, len(pc_data) is also width instead number of points (width x height).

I am not sure whether this problem is caused by different python version. Actually, I tested on both python2.7 and python3.7 (with #9) and noticed the same error.

Any suggestions here?

@yinxiaochuan
Copy link

yinxiaochuan commented Mar 18, 2019

The metadata['width'] should be corrected with metadata['points'] in the parse_binary_compressed_pc_data function.

pc_data = np.zeros(metadata['width'], dtype=dtype)

bytes = dt.itemsize * metadata['width']

The following line can be deleted.
new_metadata['width'] = pc1.width+pc2.width

@bearpaw
Copy link
Author

bearpaw commented Mar 18, 2019

Thanks @yinxiaochuan !

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

2 participants