aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/GazeFeatures.py
diff options
context:
space:
mode:
authorThéo de la Hogue2023-08-30 20:32:48 +0200
committerThéo de la Hogue2023-08-30 20:32:48 +0200
commite6d7257954ea343329460a4d8e3863eacc47d222 (patch)
tree7b8195e79834aad033a25e93cdb2f2d51265750e /src/argaze/GazeFeatures.py
parente030928f9a182cfcdf78b93adfec422fcdb80f78 (diff)
downloadargaze-e6d7257954ea343329460a4d8e3863eacc47d222.zip
argaze-e6d7257954ea343329460a4d8e3863eacc47d222.tar.gz
argaze-e6d7257954ea343329460a4d8e3863eacc47d222.tar.bz2
argaze-e6d7257954ea343329460a4d8e3863eacc47d222.tar.xz
Fixing empty parameters cases.
Diffstat (limited to 'src/argaze/GazeFeatures.py')
-rw-r--r--src/argaze/GazeFeatures.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 3946e0c..4c377d1 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -91,15 +91,16 @@ class GazePosition():
else:
return distance < self.precision
- def draw(self, image: numpy.array, color=(255, 255, 255), draw_precision=True):
+ def draw(self, image: numpy.array, color: tuple = None, size: int = None, draw_precision=True):
"""Draw gaze position point and precision circle."""
if self.valid:
int_value = (int(self.value[0]), int(self.value[1]))
- # Draw point at position
- cv2.circle(image, int_value, 2, color, -1)
+ # Draw point at position if required
+ if color is not None:
+ cv2.circle(image, int_value, size, color, -1)
# Draw precision circle
if self.precision > 0 and draw_precision:
@@ -292,12 +293,12 @@ class GazeMovement():
ts_next, next_gaze_position = gaze_positions.first
# Draw position if required
- if position_color:
+ if position_color is not None:
start_gaze_position.draw(image, position_color, draw_precision=False)
# Draw line between positions if required
- if line_color:
+ if line_color is not None:
cv2.line(image, (int(start_gaze_position[0]), int(start_gaze_position[1])), (int(next_gaze_position[0]), int(next_gaze_position[1])), line_color, 1)
@@ -682,8 +683,15 @@ class ScanPath(list):
for step in self[-deepness:]:
- step.first_fixation.draw(image, **draw_fixations)
- step.last_saccade.draw(image, **draw_saccades)
+ # Draw fixation if required
+ if draw_fixations is not None:
+
+ step.first_fixation.draw(image, **draw_fixations)
+
+ # Draw saccade if required
+ if draw_saccades is not None:
+
+ step.last_saccade.draw(image, **draw_saccades)
class ScanPathAnalyzer():
"""Abstract class to define what should provide a scan path analyzer."""