将二进制激光雷达数据(.bin)转换为点云数据(.pcd)格式

问题描述 投票:0回答:1

我有一个用Velodyne-128以.bin格式收集的激光雷达数据。我需要将其转换为pcd格式。我使用NVIDIA Driveworks进行数据处理,但是没有工具可将激光雷达二进制数据转换为pcd。

因此,有没有一种方法可将二进制激光雷达数据转换为pcd格式?

binary point-clouds lidar
1个回答
0
投票

我从github找到了一个代码(参考如下):

import numpy as np
import struct
from open3d import *

def convert_kitti_bin_to_pcd(binFilePath):
    size_float = 4
    list_pcd = []
    with open(binFilePath, "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 = PointCloud()
    pcd.points = Vector3dVector(np_pcd)
    return pcd

参考:https://gist.githubusercontent.com/HTLife/e8f1c4ff1737710e34258ef965b48344/raw/76e15821e7cd45cac672dbb1f14d577dc9be5ff8/convert_kitti_bin_to_pcd.py

© www.soinside.com 2019 - 2024. All rights reserved.