读取激光雷达数据

Read Lidar data

我有来自 Neptec 的 Opal 激光雷达的 .mat 格式的点云数据。数据采用笛卡尔格式,其中我的结构类型是一个 table 中的点和另一个结构中的强度。我将它转换为 python 中的 csv 文件,并想阅读它以拟合 CNN。读取 PCD 文件的代码如下(来自一个 github 存储库):

def load_pc_from_pcd(pcd_path):
    """Load PointCloud data from pcd file."""
    p = pcl.load(pcd_path)
    return np.array(list(p), dtype=np.float32)

但是我没有任何 pcd 数据类型的样本。我的 csv 文件如下:

X,Y,Z,Intensity
-8121.6904296875,163.50155639648438,-18.94129180908203,42.0
-8140.76123046875,182.27249145507812,-22.06368637084961,35.0
-8141.88916015625,183.74932861328125,-21.510177612304688,37.0

由于我无法访问任何 pcd 文件,任何使用过 pcd 文件的人都可以告诉我如何以正确的方式读取 CSV 文件吗?

谢谢!

您可以像 pcd 文件一样添加 header。在你的情况下你可以写: # .PCD v.7 - Point Cloud Data file format VERSION .7 FIELDS x y z SIZE 4 4 4 TYPE F F F COUNT 1 1 1 WIDTH no_of_points HEIGHT 1 POINTS no_of_points DATA ascii

然后删除文件中的逗号并替换为 space。