aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2022-03-29 13:18:21 +0200
committerThéo de la Hogue2022-03-29 13:18:21 +0200
commit80bffcd07062b12fadc74162b7a952655f5fbd63 (patch)
treed7ce33feddf6bcca0ba3108e4f6043f0f1f1d8ab /src
parentfbe2c8a57ed2986ce64de5745ceea970ccbda56c (diff)
downloadargaze-80bffcd07062b12fadc74162b7a952655f5fbd63.zip
argaze-80bffcd07062b12fadc74162b7a952655f5fbd63.tar.gz
argaze-80bffcd07062b12fadc74162b7a952655f5fbd63.tar.bz2
argaze-80bffcd07062b12fadc74162b7a952655f5fbd63.tar.xz
Renaming utils scripts
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/analyse_tobii_segment_fixations.py91
-rw-r--r--src/argaze/utils/map_tobii_gaze_on_camera.py0
2 files changed, 0 insertions, 91 deletions
diff --git a/src/argaze/utils/analyse_tobii_segment_fixations.py b/src/argaze/utils/analyse_tobii_segment_fixations.py
deleted file mode 100644
index 3fe8c7b..0000000
--- a/src/argaze/utils/analyse_tobii_segment_fixations.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-import bisect
-
-from argaze import GazeFeatures
-from argaze.TobiiGlassesPro2 import TobiiEntities
-
-
-def main():
- """
- Analyse Tobii segment fixations
- """
-
- # manage arguments
- parser = argparse.ArgumentParser(description=main.__doc__.split('-')[0])
- parser.add_argument('-s', '--segment_path', metavar='SEGMENT_PATH', type=str, default=None, help='segment path')
- parser.add_argument('-d', '--dispersion_threshold', metavar='DISPERSION_THRESHOLD', type=int, default=10, help='dispersion threshold in pixel')
- parser.add_argument('-t', '--duration_threshold', metavar='DURATION_THRESHOLD', type=int, default=100, help='duration threshold in ms')
- args = parser.parse_args()
-
- if args.segment_path != None:
-
- # Load a tobii segment
- tobii_segment = TobiiEntities.TobiiSegment(args.segment_path)
-
- # Load a tobii segment video
- tobii_segment_video = tobii_segment.load_video()
- print(f'Video duration: {tobii_segment_video.get_duration()}, frame number: {tobii_segment_video.get_frame_number()}, width: {tobii_segment_video.get_width()}, height: {tobii_segment_video.get_height()}')
-
- # Load a tobii segment data
- tobii_segment_data = tobii_segment.load_data()
- print(f'Data keys: {tobii_segment_data.keys()}')
-
- # Access to timestamped gaze position data buffer
- tobii_ts_gaze_positions = tobii_segment_data.gidx_l_gp
-
- print(f'{len(tobii_ts_gaze_positions)} gaze positions loaded')
-
- # 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/1000}, vts: {vts.vts/1000}')
-
- # 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/1000] = generic_data
-
- print(f'Dispersion threshold: {args.dispersion_threshold}')
- print(f'Duration threshold: {args.duration_threshold}')
-
- fixation_analyser = GazeFeatures.DispersionBasedFixationIdentifier(generic_ts_gaze_positions, args.dispersion_threshold, args.duration_threshold)
-
- print(f'{len(fixation_analyser.fixations)} fixations found')
-
- 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
- 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}')
-
- # 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__':
-
- main() \ No newline at end of file
diff --git a/src/argaze/utils/map_tobii_gaze_on_camera.py b/src/argaze/utils/map_tobii_gaze_on_camera.py
deleted file mode 100644
index e69de29..0000000
--- a/src/argaze/utils/map_tobii_gaze_on_camera.py
+++ /dev/null