aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2022-03-28 14:41:49 +0200
committerThéo de la Hogue2022-03-28 14:41:49 +0200
commitc637a4c2a33ba4c1d47cf05b78cc9af518c59e85 (patch)
tree0bc65eb5951ef7cc2f525554956fee876582e9f4 /src
parentce756d0668fa78ceb15bda32d7634917cd2fe2e4 (diff)
downloadargaze-c637a4c2a33ba4c1d47cf05b78cc9af518c59e85.zip
argaze-c637a4c2a33ba4c1d47cf05b78cc9af518c59e85.tar.gz
argaze-c637a4c2a33ba4c1d47cf05b78cc9af518c59e85.tar.bz2
argaze-c637a4c2a33ba4c1d47cf05b78cc9af518c59e85.tar.xz
Fixing timestamp unit inconsistency
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/analyse_tobii_segment_fixations.py34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/argaze/utils/analyse_tobii_segment_fixations.py b/src/argaze/utils/analyse_tobii_segment_fixations.py
index ef4ebbb..3fe8c7b 100644
--- a/src/argaze/utils/analyse_tobii_segment_fixations.py
+++ b/src/argaze/utils/analyse_tobii_segment_fixations.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import argparse
+import bisect
from argaze import GazeFeatures
from argaze.TobiiGlassesPro2 import TobiiEntities
@@ -38,18 +39,17 @@ def main():
# Access to video timestamp index
tobii_vts = tobii_segment_data.vts
-
print(f'{len(tobii_vts)} video timestamps loaded')
for ts, vts in tobii_vts.items():
- print(f'ts: {ts/1000000}, vts: {vts.vts/1000000}')
+ print(f'ts: {ts/1000}, vts: {vts.vts/1000}')
- # Format tobii gaze data into generic gaze data and store them using second unit timestamp
+ # Format tobii gaze data into generic gaze data and store them using millisecond unit timestamp
generic_ts_gaze_positions = GazeFeatures.TimeStampedGazePositions()
for ts, tobii_data in tobii_ts_gaze_positions.items():
generic_data = GazeFeatures.GazePosition(tobii_data.gp[0] * tobii_segment_video.get_width(), tobii_data.gp[1] * tobii_segment_video.get_height())
- generic_ts_gaze_positions[ts/1000000] = generic_data
+ generic_ts_gaze_positions[ts/1000] = generic_data
print(f'Dispersion threshold: {args.dispersion_threshold}')
print(f'Duration threshold: {args.duration_threshold}')
@@ -61,10 +61,30 @@ def main():
for ts, f in fixation_analyser.fixations.items():
print(f'start time = {ts}, duration = {f.duration}, dispertion = {f.dispersion}, centroid = {f.centroid}')
- # TODO : Synchronise video and gaze
- #for ts, frame in tobii_segment_video.frames():
+ '''
+ # TODO : Synchronise video and gaze
+ current_vts_ts, current_vts = tobii_vts.pop_first()
+ next_vts_ts, next_vts = tobii_vts.pop_first()
+
+ for ts, frame in tobii_segment_video.frames():
+
+ print(ts)
+
+ vts_offset = current_vts_ts - current_vts.vts
+ print(f'vts_offset = {vts_offset}')
+
+ if ts > next_vts.vts:
+
+ current_vts_ts, current_vts = next_vts_ts, next_vts
+ next_vts_ts, next_vts = tobii_vts.pop_first()
+
+ print(f'ts + vts_offset = {ts + vts_offset}')
- #print(ts)
+ # retreive closest fixation
+ closest_fixation = bisect.bisect_left(list(fixation_analyser.fixations.keys()), ts + vts_offset)
+
+ print(f'closest_fixation = {closest_fixation}')
+ '''
if __name__ == '__main__':