aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/utils/README.md28
-rw-r--r--src/argaze/utils/aruco_calibration_board_export.py (renamed from src/argaze/utils/export_calibration_board.py)0
-rw-r--r--src/argaze/utils/aruco_markers_export.py (renamed from src/argaze/utils/export_aruco_markers.py)0
-rw-r--r--src/argaze/utils/tobii_camera_calibrate.py (renamed from src/argaze/utils/calibrate_tobii_camera.py)0
-rw-r--r--src/argaze/utils/tobii_sdcard_explore.py (renamed from src/argaze/utils/explore_tobii_sdcard.py)0
-rw-r--r--src/argaze/utils/tobii_segment_aruco_aoi_edit.py (renamed from src/argaze/utils/edit_tobii_segment_aruco_pose.py)0
-rw-r--r--src/argaze/utils/tobii_segment_aruco_aoi_export.py (renamed from src/argaze/utils/export_tobii_segment_aruco_visual_scan.py)0
-rw-r--r--src/argaze/utils/tobii_segment_display.py (renamed from src/argaze/utils/replay_tobii_session.py)0
-rw-r--r--src/argaze/utils/tobii_segment_gaze_movements_export.py (renamed from src/argaze/utils/export_tobii_segment_movements.py)0
-rw-r--r--src/argaze/utils/tobii_segment_gaze_plot_export.py (renamed from src/argaze/utils/export_tobii_segment_plots.py)0
-rw-r--r--src/argaze/utils/tobii_segment_record.py (renamed from src/argaze/utils/record_tobii_session.py)0
-rw-r--r--src/argaze/utils/tobii_stream_aruco_aoi_display.py104
-rw-r--r--src/argaze/utils/tobii_stream_aruco_aoi_ivy_application.py (renamed from src/argaze/utils/live_tobii_aruco_aoi_ivy_application.py)0
-rw-r--r--src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py (renamed from src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py)0
-rw-r--r--src/argaze/utils/tobii_stream_display.py (renamed from src/argaze/utils/live_tobii_session.py)0
15 files changed, 118 insertions, 14 deletions
diff --git a/src/argaze/utils/README.md b/src/argaze/utils/README.md
index 321e83a..32056d9 100644
--- a/src/argaze/utils/README.md
+++ b/src/argaze/utils/README.md
@@ -15,78 +15,78 @@ python ./src/argaze/utils/UTILS_SCRIPT.py -h
- Export 50 4x4 markers at 300 dpi into an export/markers folder:
```
-python ./src/argaze/utils/export_aruco_markers.py -o export/markers
+python ./src/argaze/utils/aruco_markers_export.py -o export/markers
```
- Export a 7 columns and 5 rows calibration board with 5cm squares and 3cm markers inside at 50 dpi into an export folder:
```
-python ./src/argaze/utils/export_calibration_board.py 7 5 5 3 -o export
+python ./src/argaze/utils/aruco_calibration_board_export.py 7 5 5 3 -o export
```
- Calibrate Tobii Glasses Pro 2 camera (-t IP_ADDRESS) using a 7 columns and 5 rows calibration board with 5cm squares and 3cm markers inside. Then, export its optical parameters into an tobii_camera.json file:
```
-python ./src/argaze/utils/calibrate_tobii_camera.py 7 5 5 3 -t IP_ADDRESS -o export/tobii_camera.json
+python ./src/argaze/utils/tobii_camera_calibrate.py 7 5 5 3 -t IP_ADDRESS -o export/tobii_camera.json
```
- Display Tobii Glasses Pro 2 camera video stream (-t IP_ADDRESS) with a live gaze pointer:
```
-python ./src/argaze/utils/live_tobii_session.py -t IP_ADDRESS
+python ./src/argaze/utils/tobii_stream_display.py -t IP_ADDRESS
```
- Record a Tobii Glasses Pro 2 'myProject' session for a 'myUser' participant on Tobii interface's SD card (-t IP_ADDRESS):
```
-python ./src/argaze/utils/record_tobii_session.py -t IP_ADDRESS -p myProject -u myUser
+python ./src/argaze/utils/tobii_segment_record.py -t IP_ADDRESS -p myProject -u myUser
```
- Explore Tobii Glasses Pro 2 interface's SD Card (-d DRIVE_PATH, -p PROJECT_PATH, -r RECORDING_PATH, -s SEGMENT_PATH):
```
-python ./src/argaze/utils/explore_tobii_sdcard.py -d DRIVE_PATH
+python ./src/argaze/utils/tobii_sdcard_explore.py -d DRIVE_PATH
```
```
-python ./src/argaze/utils/explore_tobii_sdcard.py -p PROJECT_PATH
+python ./src/argaze/utils/tobii_sdcard_explore.py -p PROJECT_PATH
```
```
-python ./src/argaze/utils/explore_tobii_sdcard.py -r RECORDING_PATH
+python ./src/argaze/utils/tobii_sdcard_explore.py -r RECORDING_PATH
```
```
-python ./src/argaze/utils/explore_tobii_sdcard.py -s SEGMENT_PATH
+python ./src/argaze/utils/tobii_sdcard_explore.py -s SEGMENT_PATH
```
- Replay a time range selection (-r IN OUT) Tobii Glasses Pro 2 session (-s SEGMENT_PATH) synchronizing video and gaze data together:
```
-python ./src/argaze/utils/replay_tobii_session.py -s SEGMENT_PATH -r IN OUT
+python ./src/argaze/utils/tobii_segment_display.py -s SEGMENT_PATH -r IN OUT
```
- Export Tobii segment fixations and saccades (-s SEGMENT_PATH) from a time range selection (-r IN OUT) as fixations.csv and saccades.csv files saved into the segment folder:
```
-python ./src/argaze/utils/export_tobii_segment_movements.py -s SEGMENT_PATH -r IN OUT
+python ./src/argaze/utils/tobii_segment_gaze_movements_export.py -s SEGMENT_PATH -r IN OUT
```
- Track ArUco markers into a Tobii camera video segment (-s SEGMENT_PATH) into a time range selection (-r IN OUT). Load aoi scene .obj file related to each marker (-mi MARKER_ID, PATH_TO_AOI_SCENE), position each scene virtually relatively to its detected ArUco markers then project the scene into camera frame. Then, detect if Tobii gaze point is focusing onto AOIs to build the segment visual scan and export it as a visual_scan.csv, visual_scan.jpg, visual_scan.mp4 files:
```
-python ./src/argaze/utils/export_tobii_segment_aruco_visual_scan.py -s SEGMENT_PATH -c export/tobii_camera.json -r IN OUT -ms 5 -mi '{"MARKER_ID":"PATH_TO_AOI_SCENE.obj",...}'
+python ./src/argaze/utils/tobii_segment_aruco_aoi_export.py -s SEGMENT_PATH -c export/tobii_camera.json -r IN OUT -ms 5 -mi '{"MARKER_ID":"PATH_TO_AOI_SCENE.obj",...}'
```
- Track ArUco markers into Tobii camera video stream (-t IP_ADDRESS). Load aoi scene .obj file related to each marker (-mi MARKER_ID, PATH_TO_AOI_SCENE), position each scene virtually relatively to its detected ArUco markers then project the scene into camera frame. Then, detect if Tobii gaze point is inside any AOI and send the look at pointer over Ivy default bus:
```
-python ./src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py -t IP_ADDRESS -c export/tobii_camera.json -ms 5 -mi '{"MARKER_ID":"PATH_TO_AOI_SCENE.obj",...}'
+python ./src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py -t IP_ADDRESS -c export/tobii_camera.json -ms 5 -mi '{"MARKER_ID":"PATH_TO_AOI_SCENE.obj",...}'
```
- Define AOI scene from a ArUco marker (-a AOI_SCENE) and bind to Ivy default bus to receive live look at pointer data.:
```
-python ./src/argaze/utils/live_tobii_aruco_aoi_ivy_application.py.py -a AOI_SCENE -i MARKERS_ID
+python ./src/argaze/utils/tobii_stream_aruco_aoi_ivy_application.py.py -a AOI_SCENE -i MARKERS_ID
```
diff --git a/src/argaze/utils/export_calibration_board.py b/src/argaze/utils/aruco_calibration_board_export.py
index 6d925bd..6d925bd 100644
--- a/src/argaze/utils/export_calibration_board.py
+++ b/src/argaze/utils/aruco_calibration_board_export.py
diff --git a/src/argaze/utils/export_aruco_markers.py b/src/argaze/utils/aruco_markers_export.py
index 78c996f..78c996f 100644
--- a/src/argaze/utils/export_aruco_markers.py
+++ b/src/argaze/utils/aruco_markers_export.py
diff --git a/src/argaze/utils/calibrate_tobii_camera.py b/src/argaze/utils/tobii_camera_calibrate.py
index 61fc56c..61fc56c 100644
--- a/src/argaze/utils/calibrate_tobii_camera.py
+++ b/src/argaze/utils/tobii_camera_calibrate.py
diff --git a/src/argaze/utils/explore_tobii_sdcard.py b/src/argaze/utils/tobii_sdcard_explore.py
index e80057f..e80057f 100644
--- a/src/argaze/utils/explore_tobii_sdcard.py
+++ b/src/argaze/utils/tobii_sdcard_explore.py
diff --git a/src/argaze/utils/edit_tobii_segment_aruco_pose.py b/src/argaze/utils/tobii_segment_aruco_aoi_edit.py
index 61d695d..61d695d 100644
--- a/src/argaze/utils/edit_tobii_segment_aruco_pose.py
+++ b/src/argaze/utils/tobii_segment_aruco_aoi_edit.py
diff --git a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py b/src/argaze/utils/tobii_segment_aruco_aoi_export.py
index a3a31d0..a3a31d0 100644
--- a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py
+++ b/src/argaze/utils/tobii_segment_aruco_aoi_export.py
diff --git a/src/argaze/utils/replay_tobii_session.py b/src/argaze/utils/tobii_segment_display.py
index 86d0057..86d0057 100644
--- a/src/argaze/utils/replay_tobii_session.py
+++ b/src/argaze/utils/tobii_segment_display.py
diff --git a/src/argaze/utils/export_tobii_segment_movements.py b/src/argaze/utils/tobii_segment_gaze_movements_export.py
index b0c273a..b0c273a 100644
--- a/src/argaze/utils/export_tobii_segment_movements.py
+++ b/src/argaze/utils/tobii_segment_gaze_movements_export.py
diff --git a/src/argaze/utils/export_tobii_segment_plots.py b/src/argaze/utils/tobii_segment_gaze_plot_export.py
index d28bafb..d28bafb 100644
--- a/src/argaze/utils/export_tobii_segment_plots.py
+++ b/src/argaze/utils/tobii_segment_gaze_plot_export.py
diff --git a/src/argaze/utils/record_tobii_session.py b/src/argaze/utils/tobii_segment_record.py
index a45727b..a45727b 100644
--- a/src/argaze/utils/record_tobii_session.py
+++ b/src/argaze/utils/tobii_segment_record.py
diff --git a/src/argaze/utils/tobii_stream_aruco_aoi_display.py b/src/argaze/utils/tobii_stream_aruco_aoi_display.py
new file mode 100644
index 0000000..6391a0d
--- /dev/null
+++ b/src/argaze/utils/tobii_stream_aruco_aoi_display.py
@@ -0,0 +1,104 @@
+ #!/usr/bin/env python
+
+import argparse
+import os
+
+from argaze import DataStructures, GazeFeatures
+from argaze.TobiiGlassesPro2 import *
+from argaze.ArUcoMarkers import ArUcoTracker, ArUcoCamera
+from argaze.AreaOfInterest import *
+from argaze.TobiiGlassesPro2 import *
+
+import cv2 as cv
+import numpy
+
+from ivy.std_api import *
+
+def main():
+ """
+ Track any ArUco marker into Tobii Glasses Pro 2 camera video stream.
+ """
+
+ # Manage arguments
+ parser = argparse.ArgumentParser(description=main.__doc__.split('-')[0])
+ parser.add_argument('-t', '--tobii_ip', metavar='TOBII_IP', type=str, default='192.168.1.10', help='tobii glasses ip')
+ parser.add_argument('-c', '--camera_calibration', metavar='CAM_CALIB', type=str, default='tobii_camera.json', help='json camera calibration filepath')
+ parser.add_argument('-d', '--dictionary', metavar='DICT', type=str, default='DICT_ARUCO_ORIGINAL', help='aruco marker dictionnary (DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL,DICT_APRILTAG_16h5, DICT_APRILTAG_25h9, DICT_APRILTAG_36h10, DICT_APRILTAG_36h11)')
+ parser.add_argument('-m', '--marker_size', metavar='MKR', type=float, default=6, help='aruco marker size (cm)')
+ args = parser.parse_args()
+
+ print(f'Track Aruco markers from the {args.dictionary} dictionary')
+
+ # Create tobii controller
+ tobii_controller = TobiiController.TobiiController(args.tobii_ip, 'myProject', 'mySelf')
+
+ # Calibrate tobii glasses
+ tobii_controller.calibrate()
+
+ # Enable tobii data stream
+ tobii_data_stream = tobii_controller.enable_data_stream()
+
+ # Enable tobii video stream
+ tobii_video_stream = tobii_controller.enable_video_stream()
+
+ # create aruco camera
+ aruco_camera = ArUcoCamera.ArUcoCamera()
+ aruco_camera.load_calibration_file(args.camera_calibration)
+
+ # Create aruco tracker
+ aruco_tracker = ArUcoTracker.ArUcoTracker(args.dictionary, args.marker_size, aruco_camera)
+
+ # Start streaming
+ tobii_controller.start_streaming()
+
+ # Live video stream capture loop
+ try:
+
+ past_gaze_positions = DataStructures.TimeStampedBuffer()
+
+ while tobii_video_stream.is_alive():
+
+ video_ts, video_frame = tobii_video_stream.read()
+
+ try:
+
+ # Read data stream
+ data_stream = tobii_data_stream.read()
+
+ # Store received gaze positions
+ past_gaze_positions.append(data_stream['GazePosition'])
+
+ # Get last gaze position before video timestamp and remove all former gaze positions
+ earliest_ts, earliest_gaze_position = past_gaze_positions.pop_first_until(video_ts)
+
+ # Draw gaze position
+ video_gaze_pixel = (int(earliest_gaze_position.value[0] * video_frame.width), int(earliest_gaze_position.value[1] * video_frame.height))
+ cv.circle(video_frame.matrix, video_gaze_pixel, 4, (0, 255, 255), -1)
+
+ # Wait for gaze position
+ except (AttributeError, ValueError):
+ continue
+
+ # Track markers with pose estimation and draw them
+ aruco_tracker.track(video_frame.matrix)
+ aruco_tracker.draw(video_frame.matrix)
+
+ # Close window using 'Esc' key
+ if cv.waitKey(1) == 27:
+ break
+
+ cv.imshow('Live Scene', video_frame.matrix)
+
+ # Exit on 'ctrl+C' interruption
+ except KeyboardInterrupt:
+ pass
+
+ # Stop frame display
+ cv.destroyAllWindows()
+
+ # Stop streaming
+ tobii_controller.stop_streaming()
+
+if __name__ == '__main__':
+
+ main() \ No newline at end of file
diff --git a/src/argaze/utils/live_tobii_aruco_aoi_ivy_application.py b/src/argaze/utils/tobii_stream_aruco_aoi_ivy_application.py
index 70190e2..70190e2 100644
--- a/src/argaze/utils/live_tobii_aruco_aoi_ivy_application.py
+++ b/src/argaze/utils/tobii_stream_aruco_aoi_ivy_application.py
diff --git a/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py b/src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py
index 070e3ee..070e3ee 100644
--- a/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py
+++ b/src/argaze/utils/tobii_stream_aruco_aoi_ivy_controller.py
diff --git a/src/argaze/utils/live_tobii_session.py b/src/argaze/utils/tobii_stream_display.py
index b849357..b849357 100644
--- a/src/argaze/utils/live_tobii_session.py
+++ b/src/argaze/utils/tobii_stream_display.py