aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/GazeFeatures.py
diff options
context:
space:
mode:
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."""