从pandaset中导入点云数据
但是无法显示立体框 只能使用open3d
#! /usr/bin/env python3
# -*-coding:utf-8-*-
import pcl
import pcl.pcl_visualization
from pandaset import DataSet, geometry
import numpy as np
import pandas
dataset_root = "/nuscenes/pandaset"
dataset = DataSet(dataset_root)
print(dataset.sequences())
seq002 = dataset["002"]
seq002.load_lidar().load_cuboids().load_timestamps()
lidar0_data = seq002.lidar[0].to_numpy()[...,:4]
# print(lidar0_data.shape)
# print(seq002.lidar.poses)
pose0 = seq002.lidar.poses[0]
print(pose0)
cuboid0 = seq002.cuboids[0]
#transform from world-frame to local
#from global to local
ego_pandar_points = np.zeros(lidar0_data.shape,dtype='float32')
ego_pandar_points[:,:3] = geometry.lidar_points_to_ego(lidar0_data[:, :3], pose0)
ego_pandar_points[:, 3] = 3329330
print(lidar0_data.shape)
# color_cloud = pcl.PointCloud_PointXYZRGB(ego_pandar_points)
vs=pcl.pcl_visualization.PCLVisualizering
vss1 = pcl.pcl_visualization.PCLVisualizering()
pointcloud = pcl.PointCloud()
pointcloud.from_array(ego_pandar_points[:,:3])
# visual.ShowColorCloud(color_cloud,b'cloud')
visualcolor0 = pcl.pcl_visualization.PointCloudColorHandleringCustom(pointcloud, 0, 250, 200)# 设置颜色
vs.AddPointCloud_ColorHandler(vss1,pointcloud,visualcolor0,id=b'cloud0',viewport=0)# 添加点云及标签
while not vs.WasStopped(vss1):
vs.Spin(vss1)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)