赞
踩
访问 https://github.com/nutonomy/nuscenes-devkit,下载依赖。
使用方法,可以学习教程 https://www.nuscenes.org/tutorials/nuscenes_tutorial.html
nusc.render_scene_channel(my_scene_token, 'CAM_FRONT', out_path=f"{query}.mp4")
指定保存路径参数。
from nuscenes.nuscenes import NuScenes
import cv2
nusc = NuScenes(version='v1.0', dataroot=r'{path-to-nuscenes}', verbose=True)
print(nusc)
print(nusc.list_scenes())
table_name, field, query = 'scene', 'name', 'scene-0061'
print("field2token", nusc.field2token(table_name, field, query))
my_scene_token = nusc.field2token(table_name, field, query)[0]
print("token", my_scene_token)
nusc.render_scene_channel(my_scene_token, 'CAM_FRONT', out_path=f"{query}.mp4")
深入nusc.render_scene_channel
,修改依赖包,文件D:\programs\anaconda\Lib\site-packages\nuscenes\nuscenes.py
的render_scene_channel函数,如下两处:
if out_path is not None:
assert osp.splitext(out_path)[-1] == '.avi' or osp.splitext(out_path)[-1] == '.mp4'
if out_path is not None:
# fourcc = cv2.VideoWriter_fourcc(*'MJPG')
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(out_path, fourcc, freq, imsize)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。