aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2023-05-10 19:59:02 +0200
committerThéo de la Hogue2023-05-10 19:59:02 +0200
commit2d5ba9e7a292e71c1ae78da1e0a284ff6edb9ac1 (patch)
tree8a6ef0d2ec4a8f104a6bcb0a0881dc9376e8e5ec /src
parent4b141c3bd11617a3c24412bfd12e59d8af0962a5 (diff)
downloadargaze-2d5ba9e7a292e71c1ae78da1e0a284ff6edb9ac1.zip
argaze-2d5ba9e7a292e71c1ae78da1e0a284ff6edb9ac1.tar.gz
argaze-2d5ba9e7a292e71c1ae78da1e0a284ff6edb9ac1.tar.bz2
argaze-2d5ba9e7a292e71c1ae78da1e0a284ff6edb9ac1.tar.xz
Renaming gaze movement distance into amplitude.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/GazeFeatures.py10
-rw-r--r--src/argaze/utils/demo_gaze_features_run.py18
2 files changed, 22 insertions, 6 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index d6011a0..fd43824 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -146,8 +146,8 @@ class GazeMovement():
duration: float = field(init=False)
"""Inferred duration from first and last timestamps."""
- distance: float = field(init=False)
- """Inferred distance from first and last positions."""
+ amplitude: float = field(init=False)
+ """Inferred amplitude from first and last positions."""
def __post_init__(self):
@@ -160,10 +160,10 @@ class GazeMovement():
_, start_position = self.positions.first
_, end_position = self.positions.last
- distance = numpy.linalg.norm( numpy.array(start_position.value) - numpy.array(end_position.value))
+ amplitude = numpy.linalg.norm( numpy.array(start_position.value) - numpy.array(end_position.value))
- # Update frozen distance attribute
- object.__setattr__(self, 'distance', distance)
+ # Update frozen amplitude attribute
+ object.__setattr__(self, 'amplitude', amplitude)
def __str__(self) -> str:
"""String display"""
diff --git a/src/argaze/utils/demo_gaze_features_run.py b/src/argaze/utils/demo_gaze_features_run.py
index f1c6e19..4fdc10d 100644
--- a/src/argaze/utils/demo_gaze_features_run.py
+++ b/src/argaze/utils/demo_gaze_features_run.py
@@ -55,9 +55,13 @@ def main():
identification_mode = 'I-DT'
visual_scan_path = GazeFeatures.VisualScanPath()
+
tpm = TransitionProbabilityMatrix.VisualScanPathAnalyzer()
tpm_analysis = pandas.DataFrame()
+ cK = CoefficientK.VisualScanPathAnalyzer()
+ cK_analysis = 0
+
gaze_movement_lock = threading.Lock()
# Init timestamp
@@ -68,6 +72,7 @@ def main():
nonlocal gaze_position
nonlocal tpm_analysis
+ nonlocal cK_analysis
# Edit millisecond timestamp
data_ts = int((time.time() - start_ts) * 1e3)
@@ -110,6 +115,8 @@ def main():
tpm_analysis = tpm.analyze(visual_scan_path)
+ cK_analysis = cK.analyze(visual_scan_path)
+
except GazeFeatures.VisualScanStepError as e:
print(f'Error on {e.aoi} step:', e)
@@ -214,7 +221,16 @@ def main():
cv2.line(aoi_matrix, start_line, to_center, color, int(probability*10) + 2)
cv2.line(aoi_matrix, from_center, to_center, [55, 55, 55], 2)
-
+
+ # Write cK analysis
+ if cK_analysis < 0.:
+
+ cv2.putText(aoi_matrix, f'Ambient attention', (20, window_size[1]-80), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv2.LINE_AA)
+
+ elif cK_analysis > 0.:
+
+ cv2.putText(aoi_matrix, f'Focal attention', (20, window_size[1]-80), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 0), 1, cv2.LINE_AA)
+
# Unlock gaze movement identification
gaze_movement_lock.release()