From 40c339f7f153537a419dade38fd7cbafa2d411ba Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 28 Jun 2023 15:29:44 +0200 Subject: Adding abstract draw method to GazeMovement class. --- src/argaze/GazeFeatures.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index 65afdf8..14d4f62 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -274,6 +274,11 @@ class GazeMovement(): # Draw movement from start to next cv2.line(image, (int(start_gaze_position[0]), int(start_gaze_position[1])), (int(next_gaze_position[0]), int(next_gaze_position[1])), color, 1) + def draw(self, image: numpy.array, color): + """Draw gaze movement into image.""" + + raise NotImplementedError('draw() method not implemented') + class UnvalidGazeMovement(GazeMovement): """Unvalid gaze movement.""" @@ -283,6 +288,10 @@ class UnvalidGazeMovement(GazeMovement): super().__init__([]) + def draw(self, image: numpy.array, color): + + pass + FixationType = TypeVar('Fixation', bound="Fixation") # Type definition for type annotation convenience @@ -301,11 +310,6 @@ class Fixation(GazeMovement): raise NotImplementedError('merge() method not implemented') - def draw(self, image: numpy.array, color): - """Draw fixation into image.""" - - raise NotImplementedError('draw() method not implemented') - def is_fixation(gaze_movement): """Is a gaze movement a fixation?""" @@ -318,11 +322,6 @@ class Saccade(GazeMovement): super().__post_init__() - def draw(self, image: numpy.array, color): - """Draw saccade into image.""" - - raise NotImplementedError('draw() method not implemented') - def is_saccade(gaze_movement): """Is a gaze movement a saccade?""" -- cgit v1.1