mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-04 13:02:09 +08:00
Updated RouteFrameReader to work on routes with missing segments (#20971)
old-commit-hash: 0dc27e3d6deaec1029852874297abd614bb257b1
This commit is contained in:
@@ -16,7 +16,7 @@ class _FrameReaderDict(dict):
|
||||
self._framereader_kwargs = framereader_kwargs
|
||||
|
||||
def __missing__(self, key):
|
||||
if key < len(self._camera_paths) and self._camera_paths[key] is not None:
|
||||
if self._camera_paths.get(key) is not None:
|
||||
frame_reader = FrameReader(self._camera_paths[key],
|
||||
self._cache_paths.get(key), **self._framereader_kwargs)
|
||||
self[key] = frame_reader
|
||||
@@ -36,7 +36,10 @@ class RouteFrameReader(object):
|
||||
kwargs: Forwarded to the FrameReader function. If cache_prefix is included, that path
|
||||
will also be used for frame position indices.
|
||||
"""
|
||||
self._first_camera_idx = next(i for i in range(len(camera_paths)) if camera_paths[i] is not None)
|
||||
if not isinstance(camera_paths, dict):
|
||||
camera_paths = {int(k.split('/')[-2]):k for k in camera_paths}
|
||||
|
||||
self._first_camera_idx = min(key for key, value in camera_paths.items() if value is not None)
|
||||
self._frame_readers = _FrameReaderDict(camera_paths, cache_paths, kwargs)
|
||||
self._frame_id_lookup = frame_id_lookup
|
||||
|
||||
|
||||
Reference in New Issue
Block a user