diff options
Diffstat (limited to 'src/argaze/GazeAnalysis/DeviationCircleCoverage.py')
-rw-r--r-- | src/argaze/GazeAnalysis/DeviationCircleCoverage.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py b/src/argaze/GazeAnalysis/DeviationCircleCoverage.py index 9e2aa77..6847f44 100644 --- a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py +++ b/src/argaze/GazeAnalysis/DeviationCircleCoverage.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 deviation circle coverage over AOI.""" @@ -58,7 +57,7 @@ class AOIMatcher(GazeFeatures.AOIMatcher): self.__matched_region = 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 with the maximal fixation's deviation circle coverage if above coverage threshold.""" if GazeFeatures.is_fixation(gaze_movement): @@ -96,9 +95,11 @@ class AOIMatcher(GazeFeatures.AOIMatcher): if max_coverage > 0: # Update looked aoi data + # noinspection PyAttributeOutsideInit self.__looked_aoi_data = most_likely_looked_aoi_data # Calculate circle ratio means as looked probabilities + # noinspection PyAttributeOutsideInit self.__looked_probabilities = {} for aoi_name, circle_ratio_sum in self.__circle_ratio_sum.items(): @@ -109,9 +110,11 @@ class AOIMatcher(GazeFeatures.AOIMatcher): self.__looked_probabilities[aoi_name] = circle_ratio_mean if circle_ratio_mean < 1 else 1 # Update matched gaze movement + # noinspection PyAttributeOutsideInit self.__matched_gaze_movement = gaze_movement # Update matched region + # noinspection PyAttributeOutsideInit self.__matched_region = matched_region # Return @@ -133,11 +136,13 @@ class AOIMatcher(GazeFeatures.AOIMatcher): 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_matched_region: AOIFeatures.AOI.draw parameters (if None, no matched region is drawn) draw_looked_aoi: AOIFeatures.AOI.draw parameters (if None, no looked aoi is drawn) + update_looked_aoi: 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: @@ -156,6 +161,7 @@ class AOIMatcher(GazeFeatures.AOIMatcher): try: + # noinspection PyAttributeOutsideInit self.__looked_aoi_data = (self.looked_aoi_name(), aoi_scene[self.looked_aoi_name()]) except KeyError: |