From 6ba7d69e36cdae670d49897daa300d371fddfc42 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 30 Aug 2023 23:25:50 +0200 Subject: Fixing code annotations. --- docs/user_guide/gaze_analysis_pipeline/introduction.md | 5 +++-- .../GazeAnalysis/DispersionThresholdIdentification.py | 13 ++++++++----- src/argaze/GazeAnalysis/VelocityThresholdIdentification.py | 13 ++++++++----- src/argaze/GazeFeatures.py | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/docs/user_guide/gaze_analysis_pipeline/introduction.md b/docs/user_guide/gaze_analysis_pipeline/introduction.md index 8c4d159..c3f574b 100644 --- a/docs/user_guide/gaze_analysis_pipeline/introduction.md +++ b/docs/user_guide/gaze_analysis_pipeline/introduction.md @@ -12,8 +12,9 @@ To build your own gaze analysis pipeline, you need to know: * [How to edit timestamped gaze positions](timestamped_gaze_positions_edition.md), * [How to deal with an ArFrame instance](ar_frame_configuration_and_execution.md), * [How to deal with an ArLayer instance](ar_layer_configuration_and_execution.md), -* [How to log resulted gaze analysis](gaze_analysis_logging.md), -* [How to visualize heatmap](heatmap_visualisation.md). +* [How to visualize ArFrame and ArLayers](visualisation.md), +* [How to log resulted gaze analysis](logging.md), +* [How to add heatmap](heatmap.md). More advanced features are also explained like: 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: -- cgit v1.1