aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/TobiiGlassesPro2/__init__.py2
-rw-r--r--src/argaze/utils/tobii_segment_aruco_aoi_export.py11
-rw-r--r--src/argaze/utils/tobii_segment_display.py13
-rw-r--r--src/argaze/utils/tobii_segment_gaze_movements_export.py12
4 files changed, 9 insertions, 29 deletions
diff --git a/src/argaze/TobiiGlassesPro2/__init__.py b/src/argaze/TobiiGlassesPro2/__init__.py
index 329402c..4fc65bb 100644
--- a/src/argaze/TobiiGlassesPro2/__init__.py
+++ b/src/argaze/TobiiGlassesPro2/__init__.py
@@ -2,4 +2,4 @@
.. include:: README.md
"""
__docformat__ = "restructuredtext"
-__all__ = ['TobiiEntities', 'TobiiNetworkInterface', 'TobiiController', 'TobiiData', 'TobiiVideo'] \ No newline at end of file
+__all__ = ['TobiiEntities', 'TobiiNetworkInterface', 'TobiiController', 'TobiiData', 'TobiiVideo', 'TobiiSpecifications'] \ No newline at end of file
diff --git a/src/argaze/utils/tobii_segment_aruco_aoi_export.py b/src/argaze/utils/tobii_segment_aruco_aoi_export.py
index b1fe4ed..25ea334 100644
--- a/src/argaze/utils/tobii_segment_aruco_aoi_export.py
+++ b/src/argaze/utils/tobii_segment_aruco_aoi_export.py
@@ -6,7 +6,7 @@ import json
from argaze import DataStructures
from argaze import GazeFeatures
-from argaze.TobiiGlassesPro2 import TobiiEntities, TobiiVideo
+from argaze.TobiiGlassesPro2 import TobiiEntities, TobiiVideo, TobiiSpecifications
from argaze.ArUcoMarkers import *
from argaze.AreaOfInterest import *
from argaze.utils import MiscFeatures
@@ -139,13 +139,6 @@ def main():
# Create timestamped buffer to store AOIs scene in time
ts_aois_scenes = AOIFeatures.TimeStampedAOIScenes()
- # !!! the parameters below are specific to the TobiiGlassesPro2 !!!
- # Reference : https://www.biorxiv.org/content/10.1101/299925v1
- tobii_accuracy = 1.42 # degree
- tobii_precision = 0.34 # degree
- tobii_camera_hfov = 82 # degree
- tobii_visual_hfov = 160 # degree
-
# Video and data replay loop
try:
@@ -224,7 +217,7 @@ def main():
# Get aoi inside vision cone field
cone_vision_height_cm = 200 # cm
- cone_vision_radius_cm = numpy.tan(numpy.deg2rad(tobii_visual_hfov / 2)) * cone_vision_height_cm
+ cone_vision_radius_cm = numpy.tan(numpy.deg2rad(TobiiSpecifications.VISUAL_HFOV / 2)) * cone_vision_height_cm
aoi3D_inside, aoi3D_outside = aoi3D_camera.vision_cone(cone_vision_radius_cm, cone_vision_height_cm)
diff --git a/src/argaze/utils/tobii_segment_display.py b/src/argaze/utils/tobii_segment_display.py
index 604ebcf..7997d37 100644
--- a/src/argaze/utils/tobii_segment_display.py
+++ b/src/argaze/utils/tobii_segment_display.py
@@ -3,7 +3,7 @@
import argparse
from argaze import GazeFeatures
-from argaze.TobiiGlassesPro2 import TobiiEntities, TobiiVideo, TobiiData
+from argaze.TobiiGlassesPro2 import TobiiEntities, TobiiVideo, TobiiData, TobiiSpecifications
from argaze.utils import MiscFeatures
import numpy
@@ -49,13 +49,6 @@ def main():
# Access to timestamped events data buffer
tobii_ts_events = tobii_segment_data['Event']
- # !!! the parameters below are specific to the TobiiGlassesPro2 !!!
- # Reference : https://www.biorxiv.org/content/10.1101/299925v1
- tobii_accuracy = 1.42 # degree
- tobii_precision = 0.34 # degree
- tobii_camera_hfov = 82 # degree
- tobii_visual_hfov = 160 # degree
-
# Video and data replay loop
try:
@@ -100,8 +93,8 @@ def main():
# Ignore frame when gaze position 3D is not valid
if nearest_gaze_position_3d.validity == 0:
- gaze_accuracy_mm = numpy.tan(numpy.deg2rad(tobii_accuracy)) * nearest_gaze_position_3d.value[2]
- tobii_camera_hfov_mm = numpy.tan(numpy.deg2rad(tobii_camera_hfov / 2)) * nearest_gaze_position_3d.value[2]
+ gaze_accuracy_mm = numpy.tan(numpy.deg2rad(TobiiSpecifications.ACCURACY)) * nearest_gaze_position_3d.value[2]
+ tobii_camera_hfov_mm = numpy.tan(numpy.deg2rad(TobiiSpecifications.CAMERA_HFOV / 2)) * nearest_gaze_position_3d.value[2]
gaze_position_pixel.accuracy = round(video_frame.width * float(gaze_accuracy_mm) / float(tobii_camera_hfov_mm))
diff --git a/src/argaze/utils/tobii_segment_gaze_movements_export.py b/src/argaze/utils/tobii_segment_gaze_movements_export.py
index cf11431..1047065 100644
--- a/src/argaze/utils/tobii_segment_gaze_movements_export.py
+++ b/src/argaze/utils/tobii_segment_gaze_movements_export.py
@@ -4,7 +4,7 @@ import argparse
import os
from argaze import GazeFeatures
-from argaze.TobiiGlassesPro2 import TobiiEntities, TobiiVideo
+from argaze.TobiiGlassesPro2 import TobiiEntities, TobiiVideo, TobiiSpecifications
from argaze.utils import MiscFeatures
import cv2 as cv
@@ -81,12 +81,6 @@ def main():
# Access to timestamped gaze 3D positions data buffer
tobii_ts_gaze_positions_3d = tobii_segment_data['GazePosition3D']
- # !!! the parameters below are specific to the TobiiGlassesPro2 !!!
- # Reference : https://www.biorxiv.org/content/10.1101/299925v1
- tobii_accuracy = 1.42 # degree
- tobii_precision = 0.34 # degree
- tobii_camera_hfov = 82 # degree
-
# Format tobii gaze position and accuracy in pixel
ts_gaze_positions = GazeFeatures.TimeStampedGazePositions()
@@ -103,8 +97,8 @@ def main():
# Test gaze position 3d validity
if tobii_gaze_position_3d.validity == 0:
- gaze_accuracy_mm = numpy.sin(numpy.deg2rad(tobii_accuracy)) * tobii_gaze_position_3d.value[2]
- tobii_camera_hfov_mm = numpy.sin(numpy.deg2rad(tobii_camera_hfov)) * tobii_gaze_position_3d.value[2]
+ gaze_accuracy_mm = numpy.sin(numpy.deg2rad(TobiiSpecifications.ACCURACY)) * tobii_gaze_position_3d.value[2]
+ tobii_camera_hfov_mm = numpy.sin(numpy.deg2rad(TobiiSpecifications.CAMERA_HFOV)) * tobii_gaze_position_3d.value[2]
gaze_position_pixel.accuracy = round(tobii_segment_video.get_width() * float(gaze_accuracy_mm) / float(tobii_camera_hfov_mm))