aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2022-09-20 17:25:38 +0200
committerThéo de la Hogue2022-09-20 17:25:38 +0200
commit16ae51ff71e89a57beaebd259fb95c86fd0c13a0 (patch)
treee213ac005707dbcd63628065fb905d0d4c852cfa
parent7bf5cb9fdd80adae365ca89378b77c19e61518bc (diff)
downloadargaze-16ae51ff71e89a57beaebd259fb95c86fd0c13a0.zip
argaze-16ae51ff71e89a57beaebd259fb95c86fd0c13a0.tar.gz
argaze-16ae51ff71e89a57beaebd259fb95c86fd0c13a0.tar.bz2
argaze-16ae51ff71e89a57beaebd259fb95c86fd0c13a0.tar.xz
Using new Exception definitions
-rw-r--r--src/argaze/utils/export_tobii_segment_aruco_visual_scan.py15
-rw-r--r--src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py6
2 files changed, 14 insertions, 7 deletions
diff --git a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py b/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py
index d301f55..c252124 100644
--- a/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py
+++ b/src/argaze/utils/export_tobii_segment_aruco_visual_scan.py
@@ -244,7 +244,7 @@ def main():
# Ignore frame when gaze position is not valid
if nearest_gaze_position.validity == 1:
- raise GazeFeatures.InvalidGazeData('Unvalid gaze position')
+ raise GazeFeatures.GazeDataMissing('Unvalid gaze position')
gaze_position_pixel = (int(nearest_gaze_position.value[0] * visu_frame.width), int(nearest_gaze_position.value[1] * visu_frame.height))
@@ -256,7 +256,7 @@ def main():
# Ignore frame when gaze position 3D is not valid
if nearest_gaze_position_3d.validity == 1:
- raise GazeFeatures.InvalidGazeData('Unvalid gaze position 3D')
+ raise GazeFeatures.GazeDataMissing('Unvalid gaze position 3D')
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]
@@ -343,8 +343,12 @@ def main():
# Store 2D merged scene at this time in millisecond
ts_aois_scenes[round(video_ts_ms)] = aoi2D_merged_scene
- # Raised when gaze data can't be processed
- except GazeFeatures.InvalidGazeData as e:
+ # Raised when gaze data is missing
+ except GazeFeatures.GazeDataMissing as e:
+
+ # Store missing gaze data exception
+ ts_gaze_positions[round(video_ts_ms)] = GazeFeatures.GazePositionMissingItem
+ ts_gaze_accuracies[round(video_ts_ms)] = GazeFeatures.GazeAccuracyMissingItem
cv.rectangle(visu_frame.matrix, (0, 50), (550, 100), (127, 127, 127), -1)
cv.putText(visu_frame.matrix, str(e), (20, 80), cv.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv.LINE_AA)
@@ -352,6 +356,9 @@ def main():
# Raised when aoi scene is missing
except AOIFeatures.AOISceneMissing as e:
+ # Store missing scene exception
+ ts_aois_scenes[round(video_ts_ms)] = e
+
cv.rectangle(visu_frame.matrix, (0, 50), (550, 100), (127, 127, 127), -1)
cv.putText(visu_frame.matrix, str(e), (20, 80), cv.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv.LINE_AA)
diff --git a/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py b/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py
index b794054..c6aa316 100644
--- a/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py
+++ b/src/argaze/utils/live_tobii_aruco_aoi_ivy_controller.py
@@ -143,7 +143,7 @@ def main():
# Ignore frame when gaze position is not valid
if nearest_gaze_position.validity == 1:
- raise GazeFeatures.InvalidGazeData('Unvalid gaze position')
+ raise GazeFeatures.GazeDataMissing('Unvalid gaze position')
gaze_position_pixel = (int(nearest_gaze_position.value[0] * visu_frame.width), int(nearest_gaze_position.value[1] * visu_frame.height))
@@ -155,7 +155,7 @@ def main():
# Ignore frame when gaze position 3D is not valid
if nearest_gaze_position_3d.validity == 1:
- raise GazeFeatures.InvalidGazeData('Unvalid gaze position 3D')
+ raise GazeFeatures.GazeDataMissing('Unvalid gaze position 3D')
gaze_position_pixel = (int(nearest_gaze_position.value[0] * visu_frame.width), int(nearest_gaze_position.value[1] * visu_frame.height))
@@ -238,7 +238,7 @@ def main():
IvySendMsg(f'looking {name}')
# Raised when gaze data can't be processed
- except GazeFeatures.InvalidGazeData as e:
+ except GazeFeatures.GazeDataMissing as e:
cv.rectangle(visu_frame.matrix, (0, 50), (550, 100), (127, 127, 127), -1)
cv.putText(visu_frame.matrix, str(e), (20, 80), cv.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv.LINE_AA)