2021-09-21 10:14:16 -07:00
|
|
|
#!/usr/bin/env python3
|
2024-01-11 13:14:10 -05:00
|
|
|
import argparse
|
2021-09-21 10:14:16 -07:00
|
|
|
import os
|
|
|
|
|
from tqdm import tqdm
|
|
|
|
|
|
2024-01-12 15:53:50 -05:00
|
|
|
from openpilot.tools.lib.logreader import LogReader
|
2021-09-21 10:14:16 -07:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
parser.add_argument("route", help="The route name")
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
2024-01-11 13:14:10 -05:00
|
|
|
out_path = os.path.join("jpegs", f"{args.route.replace('|', '_').replace('/', '_')}")
|
2023-12-06 09:55:29 -08:00
|
|
|
os.makedirs(out_path, exist_ok=True)
|
2021-09-21 10:14:16 -07:00
|
|
|
|
2024-01-12 15:53:50 -05:00
|
|
|
lr = LogReader(args.route)
|
2021-09-21 10:14:16 -07:00
|
|
|
|
|
|
|
|
for msg in tqdm(lr):
|
2022-03-24 23:23:29 -07:00
|
|
|
if msg.which() == 'thumbnail':
|
|
|
|
|
with open(os.path.join(out_path, f"{msg.thumbnail.frameId}.jpg"), 'wb') as f:
|
|
|
|
|
f.write(msg.thumbnail.thumbnail)
|
|
|
|
|
elif msg.which() == 'navThumbnail':
|
|
|
|
|
with open(os.path.join(out_path, f"nav_{msg.navThumbnail.frameId}.jpg"), 'wb') as f:
|
|
|
|
|
f.write(msg.navThumbnail.thumbnail)
|