From 4f2377b464f78e9efdf00dc2e5e0024f90fcc8a4 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 22 Jul 2024 18:03:17 +0200 Subject: Timestamping camera images according sync_event too. --- src/argaze/utils/contexts/TobiiProGlasses2.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/argaze/utils/contexts/TobiiProGlasses2.py b/src/argaze/utils/contexts/TobiiProGlasses2.py index d9dbdea..13dcf4a 100644 --- a/src/argaze/utils/contexts/TobiiProGlasses2.py +++ b/src/argaze/utils/contexts/TobiiProGlasses2.py @@ -1303,8 +1303,19 @@ class SegmentPlayback(ArFeatures.DataPlaybackContext): logging.debug('> read image at %i timestamp', video_ts) - # Process camera image - self._process_camera_image(timestamp=video_ts, image=video_image) + # Don't process images if sync is required but sync event not happened yet + if self.__sync_event is not None and self.__sync_ts is not None: + + sync_video_ts = int(self.__sync_ts + video_ts - self.__sync_data_ts) + + # Process camera image + self._process_camera_image(timestamp=sync_video_ts, image=video_image) + + # Otherwise, always process images + elif self.__sync_event is None: + + # Process camera image + self._process_camera_image(timestamp=video_ts, image=video_image) height, width, _ = video_image.shape -- cgit v1.1