Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch StopIteration when all images do not have stamp #1767

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions jsk_rosbag_tools/python/jsk_rosbag_tools/bag_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ def bag_to_video(input_bagfile,

# remove 0 time stamp
stamp = 0.0
while stamp == 0.0:
stamp, _, img, _ = next(images)
if show_progress_bar:
progress.update(1)
try:
while stamp == 0.0:
stamp, _, img, _ = next(images)
if show_progress_bar:
progress.update(1)
except StopIteration:
print('[bag_to_video] No timestamp found in all images')
print('[bag_to_video] Skipping {}'.format(image_topic))
break
start_stamp = stamp
width, height = img.shape[1], img.shape[0]

Expand Down