diff options
Diffstat (limited to 'src/argaze/GazeAnalysis/FocusPointInside.py')
-rw-r--r-- | src/argaze/GazeAnalysis/FocusPointInside.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/argaze/GazeAnalysis/FocusPointInside.py b/src/argaze/GazeAnalysis/FocusPointInside.py index dbcb438..5d26650 100644 --- a/src/argaze/GazeAnalysis/FocusPointInside.py +++ b/src/argaze/GazeAnalysis/FocusPointInside.py @@ -17,13 +17,12 @@ __credits__ = [] __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)" __license__ = "GPLv3" -import math +import cv2 +import numpy from argaze import GazeFeatures, DataFeatures from argaze.AreaOfInterest import AOIFeatures -import numpy -import cv2 class AOIMatcher(GazeFeatures.AOIMatcher): """Matching algorithm based on fixation's focus point.""" @@ -34,7 +33,8 @@ class AOIMatcher(GazeFeatures.AOIMatcher): # Init AOIMatcher class super().__init__() - self.__reset() + self.__looked_aoi_data = (None, None) + self.__matched_gaze_movement = None def __reset(self): @@ -42,7 +42,7 @@ class AOIMatcher(GazeFeatures.AOIMatcher): self.__matched_gaze_movement = None @DataFeatures.PipelineStepMethod - def match(self, gaze_movement, aoi_scene) -> tuple[str, AOIFeatures.AreaOfInterest]: + def match(self, gaze_movement: GazeFeatures.GazeMovement, aoi_scene) -> tuple[str, AOIFeatures.AreaOfInterest]: """Returns AOI containing fixation focus point.""" if GazeFeatures.is_fixation(gaze_movement): @@ -65,16 +65,18 @@ class AOIMatcher(GazeFeatures.AOIMatcher): return (None, None) - def draw(self, image: numpy.array, aoi_scene: AOIFeatures.AOIScene, draw_matched_fixation: dict = None, draw_looked_aoi: dict = None, looked_aoi_name_color: tuple = None, looked_aoi_name_offset: tuple = (0, 0)): + def draw(self, image: numpy.array, aoi_scene: AOIFeatures.AOIScene, draw_matched_fixation: dict = None, + draw_looked_aoi: dict = None, looked_aoi_name_color: tuple = None, looked_aoi_name_offset: tuple = (0, 0)): """Draw matching into image. Parameters: image: where to draw aoi_scene: to refresh looked aoi if required - draw_matched_fixation: Fixation.draw parameters (which depends of the loaded gaze movement identifier module, if None, no fixation is drawn) + draw_matched_fixation: Fixation.draw parameters (which depends on the loaded gaze movement identifier + module, if None, no fixation is drawn) draw_looked_aoi: AOIFeatures.AOI.draw parameters (if None, no looked aoi is drawn) looked_aoi_name_color: color of text (if None, no looked aoi name is drawn) - looked_aoi_name_offset: ofset of text from the upper left aoi bounding box corner + looked_aoi_name_offset: offset of text from the upper left aoi bounding box corner """ if self.__matched_gaze_movement is not None: |