首页 > 解决方案 > 读取激光雷达数据

问题描述

我有来自 Neptec 的 Opal Lidar 的点云数据,格式为 .mat。数据采用笛卡尔格式,其中我的结构类型在一个表中具有点,在另一个结构中具有强度。我将它转换为 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 文件?

谢谢!

标签: computer-visionpoint-cloudsfile-readlidar-data

解决方案


您可以像 pcd 文件一样添加标题。在你的情况下,你可以写: # .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

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


推荐阅读