aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/tobii_camera_calibrate.py7
-rw-r--r--src/argaze/utils/tobii_sdcard_explore.py48
-rw-r--r--src/argaze/utils/tobii_segment_record.py7
-rw-r--r--src/argaze/utils/tobii_stream_arcube_display.py7
-rw-r--r--src/argaze/utils/tobii_stream_aruco_aoi_display.py7
-rw-r--r--src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py22
-rw-r--r--src/argaze/utils/tobii_stream_display.py37
7 files changed, 111 insertions, 24 deletions
diff --git a/src/argaze/utils/tobii_camera_calibrate.py b/src/argaze/utils/tobii_camera_calibrate.py
index 2994c36..cd546bb 100644
--- a/src/argaze/utils/tobii_camera_calibrate.py
+++ b/src/argaze/utils/tobii_camera_calibrate.py
@@ -47,7 +47,12 @@ def main():
exit()
# Setup camera at 25 fps to work on Full HD video stream
- tobii_controller.set_video_freq_25()
+ tobii_controller.set_scene_camera_freq_25()
+
+ # Print current confirugration
+ print(f'Tobii Glasses Pro 2 configuration:')
+ for key, value in tobii_controller.get_configuration().items():
+ print(f'\t{key}: {value}')
# Enable tobii video stream
tobii_video_stream = tobii_controller.enable_video_stream()
diff --git a/src/argaze/utils/tobii_sdcard_explore.py b/src/argaze/utils/tobii_sdcard_explore.py
index c462d0f..ed297be 100644
--- a/src/argaze/utils/tobii_sdcard_explore.py
+++ b/src/argaze/utils/tobii_sdcard_explore.py
@@ -4,6 +4,9 @@ import argparse
from argaze.TobiiGlassesPro2 import TobiiEntities, TobiiData, TobiiVideo
+import matplotlib.pyplot as mpyplot
+import matplotlib.patches as mpatches
+
def main():
"""
Explore Tobii Glasses Pro 2 interface's SD Card
@@ -22,43 +25,58 @@ def main():
# Load all projects from a tobii drive
tobii_drive = TobiiEntities.TobiiDrive(args.drive_path)
- for project in tobii_drive.get_projects():
- print(f'Project id: {project.get_id()}, name: {project.get_name()}')
+ for project in tobii_drive.projects():
+ print(f'Project id: {project.id}, name: {project.name}')
elif args.project_path != None:
# Load one tobii project
tobii_project = TobiiEntities.TobiiProject(args.project_path)
- for participant in tobii_project.get_participants():
- print(f'Participant id: {participant.get_id()}, name: {participant.get_name()}')
+ for participant in tobii_project.participants():
+ print(f'Participant id: {participant.id}, name: {participant.name}')
- for recording in tobii_project.get_recordings():
- print(f'Recording id: {recording.get_id()}, name: {recording.get_name()}')
+ for recording in tobii_project.recordings():
+ print(f'Recording id: {recording.id}, name: {recording.name}')
+ print(f'\tProject: {recording.project.name}')
+ print(f'\tParticipant: {recording.participant.name}')
elif args.recording_path != None:
# Load a tobii segment
tobii_recording = TobiiEntities.TobiiRecording(args.recording_path)
- for segment in tobii_recording.get_segments():
- print(f'Segment id: {segment.get_id()}')
+ for segment in tobii_recording.segments():
+ print(f'Segment id: {segment.id}')
elif args.segment_path != None:
# Load a tobii segment
tobii_segment = TobiiEntities.TobiiSegment(args.segment_path)
- tobii_segment_video = tobii_segment.get_video()
- print(f'Video width: {tobii_segment_video.get_width()}, height: {tobii_segment_video.get_height()}, fps: {tobii_segment_video.get_fps()}')
+ tobii_segment_video = tobii_segment.load_video()
+ print(f'Video properties:\n\tduration: {tobii_segment_video.duration/1e6} s\n\twidth: {tobii_segment_video.width} px\n\theight: {tobii_segment_video.height} px')
+
+ tobii_segment_data = tobii_segment.load_data()
+
+ print(f'Loaded data count:')
+ for name in tobii_segment_data.keys():
+ print(f'\t{name}: {len(tobii_segment_data[name])} data')
- tobii_segment_data = tobii_segment.get_data()
+ # Edit figure
+ figure_width = min(tobii_segment_video.duration/10, 56) # maximal width to display: 56 inches at 144 dpi < 2^16 pixels
+ data_sample = 8064 # 56 inches * 144 dpi = 8064 data can be displayed at max
+ figure = mpyplot.figure(figsize=(figure_width, 5), dpi=144)
- data = tobii_segment_data.load()
+ # Plot data
+ subplot = figure.add_subplot(111)
+ subplot.set_title('VideoTimeStamps', loc='left')
+ patches = tobii_segment_data['VideoTimeStamp'].plot(names=['offset','value'], colors=['#276FB6','#9427B6'], samples=data_sample)
+ subplot.legend(handles=patches, loc='upper left')
- for key in data.keys():
- print(f'{key}: {len(data[key])} items')
- print(f'{key} first item: {data[key].popitem()} items')
+ # Display figure
+ mpyplot.show()
+ figure.clear()
if __name__ == '__main__':
diff --git a/src/argaze/utils/tobii_segment_record.py b/src/argaze/utils/tobii_segment_record.py
index a312aa5..25066c4 100644
--- a/src/argaze/utils/tobii_segment_record.py
+++ b/src/argaze/utils/tobii_segment_record.py
@@ -34,7 +34,12 @@ def main():
exit()
# Setup camera at 25 fps to work on Full HD video stream
- tobii_controller.set_video_freq_25()
+ tobii_controller.set_scene_camera_freq_25()
+
+ # Print current confirugration
+ print(f'Tobii Glasses Pro 2 configuration:')
+ for key, value in tobii_controller.get_configuration().items():
+ print(f'\t{key}: {value}')
# Calibrate tobii glasses
tobii_controller.calibrate()
diff --git a/src/argaze/utils/tobii_stream_arcube_display.py b/src/argaze/utils/tobii_stream_arcube_display.py
index aea547f..69dc79e 100644
--- a/src/argaze/utils/tobii_stream_arcube_display.py
+++ b/src/argaze/utils/tobii_stream_arcube_display.py
@@ -65,7 +65,12 @@ def main():
exit()
# Setup camera at 25 fps to work on Full HD video stream
- tobii_controller.set_video_freq_25()
+ tobii_controller.set_scene_camera_freq_25()
+
+ # Print current confirugration
+ print(f'Tobii Glasses Pro 2 configuration:')
+ for key, value in tobii_controller.get_configuration().items():
+ print(f'\t{key}: {value}')
# Enable tobii data stream
tobii_data_stream = tobii_controller.enable_data_stream()
diff --git a/src/argaze/utils/tobii_stream_aruco_aoi_display.py b/src/argaze/utils/tobii_stream_aruco_aoi_display.py
index ea699d4..77f3c7b 100644
--- a/src/argaze/utils/tobii_stream_aruco_aoi_display.py
+++ b/src/argaze/utils/tobii_stream_aruco_aoi_display.py
@@ -50,7 +50,12 @@ def main():
exit()
# Setup camera at 25 fps to work on Full HD video stream
- tobii_controller.set_video_freq_25()
+ tobii_controller.set_scene_camera_freq_25()
+
+ # Print current confirugration
+ print(f'Tobii Glasses Pro 2 configuration:')
+ for key, value in tobii_controller.get_configuration().items():
+ print(f'\t{key}: {value}')
# Enable tobii data stream
tobii_data_stream = tobii_controller.enable_data_stream()
diff --git a/src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py b/src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py
index 31b5969..0e9aeea 100644
--- a/src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py
+++ b/src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py
@@ -43,8 +43,26 @@ def main():
IvyInit(os.path.basename(__file__))
IvyStart(args.ivy_bus)
- # Create tobii controller
- tobii_controller = TobiiController.TobiiController(args.tobii_ip, args.project_name, args.participant_name)
+ # Create tobii controller (with auto discovery network process if no ip argument is provided)
+ print("Looking for a Tobii Glasses Pro 2 device ...")
+
+ try:
+
+ tobii_controller = TobiiController.TobiiController(args.tobii_ip)
+ print(f'Tobii Glasses Pro 2 device found at {tobii_controller.address} address.')
+
+ except ConnectionError as e:
+
+ print(e)
+ exit()
+
+ # Setup camera at 25 fps to work on Full HD video stream
+ tobii_controller.set_scene_camera_freq_25()
+
+ # Print current confirugration
+ print(f'Tobii Glasses Pro 2 configuration:')
+ for key, value in tobii_controller.get_configuration().items():
+ print(f'\t{key}: {value}')
# Calibrate tobii glasses
tobii_controller.calibrate()
diff --git a/src/argaze/utils/tobii_stream_display.py b/src/argaze/utils/tobii_stream_display.py
index d8dbc97..2611b35 100644
--- a/src/argaze/utils/tobii_stream_display.py
+++ b/src/argaze/utils/tobii_stream_display.py
@@ -35,7 +35,12 @@ def main():
exit()
# Setup camera at 25 fps to work on Full HD video stream
- tobii_controller.set_video_freq_25()
+ tobii_controller.set_scene_camera_freq_25()
+
+ # Print current confirugration
+ print(f'Tobii Glasses Pro 2 configuration:')
+ for key, value in tobii_controller.get_configuration().items():
+ print(f'\t{key}: {value}')
# Enable tobii data stream
tobii_data_stream = tobii_controller.enable_data_stream()
@@ -163,9 +168,35 @@ def main():
cv.putText(video_frame.matrix, f'Gaze fps: {int(gaze_ps)}', (350, 80), cv.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv.LINE_AA)
cv.imshow(f'Video and data stream', video_frame.matrix)
-
+
+ key_pressed = cv.waitKey(1)
+
+ #if key_pressed != -1:
+ # print(key_pressed)
+
+ # Set Auto scene camera preset with 'a' key
+ if key_pressed == 97:
+ tobii_controller.set_scene_camera_auto_preset()
+ print('Tobii Glasses Pro 2 scene camera in Auto mode')
+
+ # Set GazeExposure scene camera preset with 'z' key
+ if key_pressed == 122:
+ tobii_controller.set_scene_camera_gaze_preset()
+ print('Tobii Glasses Pro 2 scene camera in GazeExposure mode')
+
+ # Set Indoor eye camera preset with 'i' key
+ if key_pressed == 105:
+ tobii_controller.set_eye_camera_indoor_preset()
+ print('Tobii Glasses Pro 2 eye camera in Indoor mode')
+
+ # Set Outdoor eye camera preset with 'o' key
+ if key_pressed == 111:
+ tobii_controller.set_eye_camera_outdoor_preset()
+ print('Tobii Glasses Pro 2 eye camera in Outdoor mode')
+
+
# Close window using 'Esc' key
- if cv.waitKey(1) == 27:
+ if key_pressed == 27:
break
# Exit on 'ctrl+C' interruption