computer-vision - 读取激光雷达数据
问题描述
我有来自 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 文件?
谢谢!
解决方案
您可以像 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
然后删除文件中的逗号并替换为空格。
推荐阅读
- linux-kernel - 内核恐慌未同步尝试终止初始化退出代码 0x0000000b
- python - 为什么用户仍然可以在密码中输入 umgc 并且它不会返回为假?
- github - 当目录不存在时,如何停止/取消带有错误消息的工作流?
- python-3.x - 检索集成在 httptrigger/queuetrigger -Python 中的 Keyvault Secret
- c++ - 将 QString 写入 Excel 会产生额外的选项卡吗?
- npm - 当构建成功运行“下一个构建”时,AWS CodeBuild 不产生任何工件
- reactjs - 你如何在 react redux 中将动作拆分为多个动作?
- amazon-web-services - Lambda 上的秘密文件
- git - 在不覆盖工作(签出)版本的情况下获取文件的 --ours 和 --theirs 版本的最简单方法是什么?
- java - 无法在 android studio 上使用 File.delete() 获取要删除的下载目录中的文件