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

How do I read pcd.bin with pcl? #17

Closed
RogerAylagas opened this issue Nov 26, 2018 · 7 comments
Closed

How do I read pcd.bin with pcl? #17

RogerAylagas opened this issue Nov 26, 2018 · 7 comments

Comments

@RogerAylagas
Copy link

Hi,
I know this might be a noob question, but I am trying to read the point cloud of a pcd.bin file of the Lidar using PCL library in C++ but as the extension is pcd.bin loadPCDFile() does not work. I have alredy tried PCDReader but same error occurs

[pcl::PCDReader::readHeader] No points to read

How can I read the binary pointclouds using pcl in c++?

@holger-motional
Copy link
Contributor

Hi,
that is actually a good question! The .pcd.bin extension is a bit confusing. Essentially we took a .pcd file, removed the headers and saved the data in binary format. You can see how we load it here. So the LIDAR data is simply a bunch of float32 = 4 Bytes and each point is described by 5 floats. The following code in Python would print out the numbers:

import numpy as np

file_path = '/data/nuscenes/samples/LIDAR_TOP/n015-2018-07-18-11-50-34+0800__LIDAR_TOP__1531886224949600.pcd.bin'

with open(file_path, "rb") as f:
    number = f.read(4)
    while number != b"":
        print(np.frombuffer(number, dtype=np.float32))
        number = f.read(4)

Now you just need to implement that in C++.

@RogerAylagas
Copy link
Author

Thank you for the quick response, just one more question: what are the fields of the points? x ,y ,z and intensity I supose, but what is the 5th field?
Thank you again!

@holger-motional
Copy link
Contributor

As described at https://github.com/nutonomy/nuscenes-devkit/blob/radar-visualization/python-sdk/nuscenes_utils/data_classes.py#L228 , that's the ring index (an integer between 0 and 31). We do not currently use it.

@RogerAylagas
Copy link
Author

Oh okey thank you so much!!

@dada9375
Copy link

dada9375 commented May 24, 2019

Hi Holger,
unfortunately I cannot find the page https://github.com/nutonomy/nuscenes-devkit/blob/radar-visualization/python-sdk/nuscenes_utils/data_classes.py#L228
Was it removed?

@holger-motional
Copy link
Contributor

Hi @dada9375,
yes, we changed the folder structure a bit. It is now under: https://github.com/nutonomy/nuscenes-devkit/blob/master/python-sdk/nuscenes/utils/data_classes.py#L249

@dada9375
Copy link

Thanks Holger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants