forked from nutonomy/nuscenes-devkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nutonomy#11 from nutonomy/dev
Visualization scripts and minor refactoring
- Loading branch information
Showing
11 changed files
with
280 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Exports an image for each map location with all the ego poses drawn on the map. | ||
""" | ||
import os | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
from nuscenes_utils.nuscenes import NuScenes | ||
|
||
# Load NuScenes class | ||
nusc = NuScenes() | ||
locations = np.unique([l['location'] for l in nusc.log]) | ||
|
||
# Create output directory | ||
out_dir = os.path.expanduser('~/nuscenes-visualization/map-poses') | ||
if not os.path.isdir(out_dir): | ||
os.makedirs(out_dir) | ||
|
||
for location in locations: | ||
nusc.render_egoposes_on_map(log_location=location) | ||
out_path = os.path.join(out_dir, 'egoposes-%s.png' % location) | ||
plt.tight_layout() | ||
plt.savefig(out_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Exports a video of each scene (with annotations) to disk. | ||
""" | ||
import os | ||
|
||
from nuscenes_utils.nuscenes import NuScenes | ||
|
||
# Load NuScenes class | ||
nusc = NuScenes() | ||
scene_tokens = [s['token'] for s in nusc.scene] | ||
|
||
# Create output directory | ||
out_dir = os.path.expanduser('~/nuscenes-visualization/scene-videos') | ||
if not os.path.isdir(out_dir): | ||
os.makedirs(out_dir) | ||
|
||
# Write videos to disk | ||
for scene_token in scene_tokens: | ||
scene = nusc.get('scene', scene_token) | ||
print('Writing scene %s' % scene['name']) | ||
out_path = os.path.join(out_dir, scene['name']) + '.avi' | ||
if not os.path.exists(out_path): | ||
nusc.render_scene(scene['token'], out_path=out_path) |
Oops, something went wrong.