nuScenes数据集操作笔记

本文详细介绍了如何操作nuScenes数据集,包括读取点云二进制数据并转化为txt文本,显示点云图像,读取和处理毫米波pcd数据,以及将点云数据投影到图像上。
摘要由CSDN通过智能技术生成

在这里插入图片描述

本文所用数据示例参考👉详见👈

1.读取点云二进制数据

输入:bin点云数据
输出:txt文本文件

from tkinter import filedialog
import struct


def open_file():
    file_path = filedialog.askopenfilename(title='Select file')
    return file_path


file_path = open_file()
output_path = "D:\Data\output.txt"

pc_list = []
with open(file_path, 'rb') as bin_file:
    data = bin_file.read()
    pc_float = struct.iter_unpack('fffff', data)  # 把bytes变成相应的python数据类型
    for point in pc_float:
        pc_list.append(point)

with open(output_path, 'w') as txt_file:
    for point in pc_list:
        txt_file.write(str(point).replace('(', '').replace(')', '') + '\n')

2.显示点云二进制数据

输入:bin点云数据
输出:点云图片

from tkinter import filedialog
import numpy as np
import mayavi.mlab

def open_file():
    file_path = filedialog.askopenfilename(title='Select file')
    return file_path

# load .bin file
lidar_path = open_file()
pointcloud = np.fromfile(lidar_path, dtype=np.float32, count=-1).reshape([-1,5])

x = pointcloud[:, 0]  # x position of point
y = pointcloud[:, 1]  # y position of point
z = pointcloud[:, 2]  # z position of point
r = pointcloud[:, 3]  # reflectance value of point
d = np.sqrt(x 
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值