发布时间:2024-01-09 13:30
self.samples = [samp for samp in self.nusc.sample if self.nusc.get(\'scene\', samp[\'scene_token\'])[\'name\'] in scenes]
rec = self.samples[idx]
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\'])
关键字:前一帧为\'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