Search code examples
binarypoint-cloudslidar

Conversion of binary lidar data (.bin) to point cloud data (.pcd) format


I have a lidar data collected with Velodyne-128 in .bin format. I need to convert it into pcd format. I use NVIDIA Driveworks for data manipulation but there is no tool to convert lidar binary data into pcd.

Thus, is there a method to convert binary lidar data into pcd format?


Solution

  • Here is a snippet to converting a lidar data (in .bin format) into .pcd format

    with open ("lidar_velodyne64.bin", "rb") as f:
        byte = f.read(size_float*4)
        while byte:
            x,y,z,intensity = struct.unpack("ffff", byte)
            list_pcd.append([x, y, z])
            byte = f.read(size_float*4)
    np_pcd = np.asarray(list_pcd)
    pcd = o3d.geometry.PointCloud()
    v3d = o3d.utility.Vector3dVector
    pcd.points = v3d(np_pcd)
    

    According to the example here, you can save it to file it as below:

    import open3d as o3d
    o3d.io.write_point_cloud("copy_of_fragment.pcd", pcd)