Nuscenes——环视相机数据准备:当前帧与前一帧所有数据的获取及操作细节

发布时间:2024-01-09 13:30

获取sample

self.samples = [samp for samp in self.nusc.sample if self.nusc.get(\'scene\', samp[\'scene_token\'])[\'name\'] in scenes]

rec = self.samples[idx]

1. 获取当前帧数据

  • 获取当前帧环视图像
self.cam_keys = [\'CAM_FRONT_LEFT\', \'CAM_FRONT\', \'CAM_FRONT_RIGHT\', \'CAM_BACK_RIGHT\', \'CAM_BACK\', \'CAM_BACK_LEFT\']

sample_path = []
for cam_key in self.cam_keys:
    samp = self.nusc.get(\'sample_data\', rec[\'data\'][cam_key])
    cam_path = samp[\'filename\']            
    sample_path.append(cam_path)
  • 获取当前帧ego pose
ego_pose = self.nusc.get(\'ego_pose\', self.nusc.get(\'sample_data\', rec[\'data\'][\'CAM_FRONT\'])[\'ego_pose_token\'])

2. 获取前一帧或后一帧帧数据

关键字:前一帧为\'prev\',后一帧为\'next\'

  • 获取前一帧环视图像
self.cam_keys = [\'CAM_FRONT_LEFT\', \'CAM_FRONT\', \'CAM_FRONT_RIGHT\', \'CAM_BACK_RIGHT\', \'CAM_BACK\', \'CAM_BACK_LEFT\']

sample_path = []
for cam_key in self.cam_keys:
    last_samp = self.nusc.get(\'sample_data\',samp[\'prev\']) # 获取前一帧的sample
    lst_cam_path = last_samp[\'filename\']
    lst_sample_path.append(lst_cam_path)
  • 获取前一帧ego pose
if samp[\'prev\'] == \'\':
    last_ego_pose = ego_pose # 如果没有前一帧,则保持不变
else:
    last_ego_pose = self.nusc.get(\'ego_pose\', self.nusc.get(\'sample_data\', rec[\'data\'][\'CAM_FRONT\'])[\'prev\'])

前一帧和后一帧的ego_pose

\"在这里插入图片描述\"

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号