Augmenting the LiDAR data (Creating a .pcd.bin file)

Hey Guys,

My goal:
Take the nuscene lidar data, augment it so it is noisy, sparse or incomplete, then turn it back into the starting format.

What I have done so far:

  • Found a way to get the points:

scan = np.fromfile(file_name, dtype=np.float32)
points = scan.reshape((-1, 5))[:, :4]
return points.T

  • Add the aAugmentations to the array (using numpy)

Where I fail:
Using open3d I am able to create .pcd files using “pcd.points = o3d.utility.Vector3dVector(array)”.
However, this creates a 3d vector without intensity. I could add the RGB intensity with “pcd.colors”, but this would be different than the grayscale 0.0 - 255.0 format for intensity nuscenes uses. ( I just realized that I forgot the ring index, which might be necessary aswell)

Second problem is that using “write_point_cloud” i get a .pcd file instead of .pcd.bin, even if I set write_ascii=False (to create a binary format) (Now that I think of it, having a .pcd formatted as bin should be equal to .pcd.bin)

Does anyone have any tipps on how to create the default structure, and a way to create .pcd.bin files.

My last goal is to create fully empy .pcd.bin files to simulate a failing LiDAR, any thoughts on that would be appreciated aswell.

Thanks in advance!

Just saw this Query regarding pcd data format.

Consequently this should mean that I can just do the augmentation on the numpy array, flatten the array into (x,y,z,intensity, ringindex) and save it as a binary using .to file(“lidar_test.pcd.bin”).

which… worked :sweat_smile: