aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/GazeAnalysis/DispersionThresholdIdentification.py13
-rw-r--r--src/argaze/GazeAnalysis/VelocityThresholdIdentification.py13
-rw-r--r--src/argaze/GazeFeatures.py2
3 files changed, 17 insertions, 11 deletions
diff --git a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
index 85f2fb5..15fddf4 100644
--- a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
@@ -99,17 +99,20 @@ class Saccade(GazeFeatures.Saccade):
def __post_init__(self):
super().__post_init__()
- def draw(self, image: numpy.array, line_color=(255, 255, 255)):
+ def draw(self, image: numpy.array, line_color: tuple = None):
"""Draw saccade into image.
Parameters:
- color: color of line from first position to last position
+ line_color: color of line from first position to last position
"""
- _, start_position = self.positions.first
- _, last_position = self.positions.last
+ # Draw line if required
+ if line_color is not None:
- cv2.line(image, (int(start_position[0]), int(start_position[1])), (int(last_position[0]), int(last_position[1])), line_color, 2)
+ _, start_position = self.positions.first
+ _, last_position = self.positions.last
+
+ cv2.line(image, (int(start_position[0]), int(start_position[1])), (int(last_position[0]), int(last_position[1])), line_color, 2)
@dataclass
class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
diff --git a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
index ab90fe7..64931f5 100644
--- a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
@@ -98,17 +98,20 @@ class Saccade(GazeFeatures.Saccade):
def __post_init__(self):
super().__post_init__()
- def draw(self, image: numpy.array, line_color=(255, 255, 255)):
+ def draw(self, image: numpy.array, line_color: tuple = None):
"""Draw saccade into image.
Parameters:
- color: color of line from first position to last position
+ line_color: color of line from first position to last position
"""
- _, start_position = self.positions.first
- _, last_position = self.positions.last
+ # Draw line if required
+ if line_color is not None:
- cv2.line(image, (int(start_position[0]), int(start_position[1])), (int(last_position[0]), int(last_position[1])), line_color, 2)
+ _, start_position = self.positions.first
+ _, last_position = self.positions.last
+
+ cv2.line(image, (int(start_position[0]), int(start_position[1])), (int(last_position[0]), int(last_position[1])), line_color, 2)
@dataclass
class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 4c377d1..c49dc09 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -672,7 +672,7 @@ class ScanPath(list):
self.__last_fixation = fixation
- def draw(self, image: numpy.array, draw_fixations: dict = None, draw_saccades: dict = None, deepness=0):
+ def draw(self, image: numpy.array, draw_fixations: dict = None, draw_saccades: dict = None, deepness: int = 0):
"""Draw scan path into image.
Parameters: