aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2023-07-05 16:57:21 +0200
committerThéo de la Hogue2023-07-05 16:57:21 +0200
commit0d866d860a988104f531a2accbf5819681ec1336 (patch)
tree1bd3521fdceaa089980761dce781efb51fdd4d80 /src
parentbc60c825b4b91954b9506132e805c744fe862e58 (diff)
downloadargaze-0d866d860a988104f531a2accbf5819681ec1336.zip
argaze-0d866d860a988104f531a2accbf5819681ec1336.tar.gz
argaze-0d866d860a988104f531a2accbf5819681ec1336.tar.bz2
argaze-0d866d860a988104f531a2accbf5819681ec1336.tar.xz
Drawing current gaze movements.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/ArFeatures.py44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 94ae4af..2a54349 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -93,9 +93,6 @@ class ArFrame():
# Init current gaze position
self.__gaze_position = GazeFeatures.UnvalidGazePosition()
- # Init current gaze movement
- self.__gaze_movement = GazeFeatures.UnvalidGazeMovement()
-
# Init current look at aoi
self.__look_at = None
@@ -323,15 +320,12 @@ class ArFrame():
if GazeFeatures.is_fixation(new_gaze_movement):
- # Update current gaze movement
- self.__gaze_movement = new_gaze_movement
-
# Does the fixation match an AOI?
self.__look_at = None
for name, aoi in self.aoi_2d_scene.items():
- _, _, circle_ratio = aoi.circle_intersection(self.__gaze_movement.focus, self.__gaze_movement.deviation_max)
+ _, _, circle_ratio = aoi.circle_intersection(new_gaze_movement.focus, new_gaze_movement.deviation_max)
if circle_ratio > 0.25:
@@ -344,12 +338,12 @@ class ArFrame():
# Append fixation to scan path
if self.scan_path != None:
- self.scan_path.append_fixation(timestamp, self.__gaze_movement)
+ self.scan_path.append_fixation(timestamp, new_gaze_movement)
# Append fixation to aoi scan path
if self.aoi_scan_path != None and self.__look_at != None:
- aoi_scan_step = self.aoi_scan_path.append_fixation(timestamp, self.__gaze_movement, self.__look_at)
+ aoi_scan_step = self.aoi_scan_path.append_fixation(timestamp, new_gaze_movement, self.__look_at)
# Analyze aoi scan path
if aoi_scan_step and len(self.aoi_scan_path) > 1:
@@ -362,16 +356,13 @@ class ArFrame():
elif GazeFeatures.is_saccade(new_gaze_movement):
- # Update current gaze movement
- self.__gaze_movement = new_gaze_movement
-
# Update current look at
self.__look_at = None
# Append saccade to scan path
if self.scan_path != None:
- scan_step = self.scan_path.append_saccade(timestamp, self.__gaze_movement)
+ scan_step = self.scan_path.append_saccade(timestamp, new_gaze_movement)
# Analyze aoi scan path
if scan_step and len(self.scan_path) > 1:
@@ -385,7 +376,7 @@ class ArFrame():
# Append saccade to aoi scan path
if self.aoi_scan_path != None:
- self.aoi_scan_path.append_saccade(timestamp, self.__gaze_movement)
+ self.aoi_scan_path.append_saccade(timestamp, new_gaze_movement)
# Update heatmap
if self.heatmap:
@@ -415,17 +406,25 @@ class ArFrame():
# Draw gaze position
self.__gaze_position.draw(image, color=(255, 255, 255))
- # Draw gaze movement
+ # Draw current gaze movements
if self.gaze_movement_identifier:
- self.__gaze_movement.draw(image, color=(0, 255, 255))
- self.__gaze_movement.draw_positions(image)
+ current_fixation = self.gaze_movement_identifier.current_fixation
- # Check fixation case
- if GazeFeatures.is_fixation(self.__gaze_movement):
+ if current_fixation.valid:
+
+ current_fixation.draw(image, color=(0, 255, 255))
+ current_fixation.draw_positions(image)
# Draw looked AOI
- self.aoi_2d_scene.draw_circlecast(image, self.__gaze_movement.focus, self.__gaze_movement.deviation_max, base_color=(0, 0, 0), matching_color=(255, 255, 255))
+ self.aoi_2d_scene.draw_circlecast(image, current_fixation.focus, current_fixation.deviation_max, base_color=(0, 0, 0), matching_color=(255, 255, 255))
+
+ current_saccade = self.gaze_movement_identifier.current_saccade
+
+ if current_saccade.valid:
+
+ current_saccade.draw(image, color=(0, 255, 255))
+ current_saccade.draw_positions(image)
# Unlock frame exploitation
self.__look_lock.release()
@@ -555,7 +554,10 @@ class ArScene():
# Setup aoi frame
new_aoi_frame.name = aoi_name
new_aoi_frame.aoi_2d_scene = new_aoi_3d_scene.orthogonal_projection.reframe(aoi_name, new_aoi_frame.size)
- new_aoi_frame.aoi_scan_path.expected_aois = list(new_aoi_3d_scene.keys())
+
+ if new_aoi_frame.aoi_scan_path != None:
+
+ new_aoi_frame.aoi_scan_path.expected_aois = list(new_aoi_3d_scene.keys())
# Append new aoi frame
new_aoi_frames[aoi_name] = new_aoi_frame