diff options
author | Théo de la Hogue | 2023-09-13 21:53:16 +0200 |
---|---|---|
committer | Théo de la Hogue | 2023-09-13 21:53:16 +0200 |
commit | b754fdd9f3c74bad33f4a3952268c99ce49c5193 (patch) | |
tree | 5d54f710f0be51868578e8261e6c748389ce0bdb /src | |
parent | e23f36b3f15f291daed077dc7d04d07939f1b7ed (diff) | |
download | argaze-b754fdd9f3c74bad33f4a3952268c99ce49c5193.zip argaze-b754fdd9f3c74bad33f4a3952268c99ce49c5193.tar.gz argaze-b754fdd9f3c74bad33f4a3952268c99ce49c5193.tar.bz2 argaze-b754fdd9f3c74bad33f4a3952268c99ce49c5193.tar.xz |
Allowing to update looked aoi in aoi matcher drawing method.
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/ArFeatures.py | 2 | ||||
-rw-r--r-- | src/argaze/GazeAnalysis/DeviationCircleCoverage.py | 14 | ||||
-rw-r--r-- | src/argaze/GazeAnalysis/FocusPointInside.py | 4 | ||||
-rw-r--r-- | src/argaze/GazeFeatures.py | 10 |
4 files changed, 27 insertions, 3 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index 40e8516..3d4bf87 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -493,7 +493,7 @@ class ArLayer(): # Draw aoi matching if required if draw_aoi_matching is not None and self.aoi_matcher is not None: - self.aoi_matcher.draw(image, **draw_aoi_matching) + self.aoi_matcher.draw(image, self.aoi_scene, **draw_aoi_matching) # Unlock frame exploitation self.__look_lock.release() diff --git a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py b/src/argaze/GazeAnalysis/DeviationCircleCoverage.py index 7b230c4..22da916 100644 --- a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py +++ b/src/argaze/GazeAnalysis/DeviationCircleCoverage.py @@ -102,10 +102,12 @@ class AOIMatcher(GazeFeatures.AOIMatcher): return (None, None) - def draw(self, image: numpy.array, draw_matched_fixation: dict = None, draw_matched_fixation_positions: dict = None, draw_matched_region: 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_matched_fixation_positions: dict = None, draw_matched_region: dict = None, draw_looked_aoi: dict = None, update_looked_aoi: bool = False, 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_positions: GazeMovement.draw_positions parameters (if None, no fixation is drawn) draw_matched_region: AOIFeatures.AOI.draw parameters (if None, no matched region is drawn) @@ -131,6 +133,16 @@ class AOIMatcher(GazeFeatures.AOIMatcher): # Draw matched aoi if self.looked_aoi.all() is not None: + if update_looked_aoi: + + try: + + self.__looked_aoi_data = (self.looked_aoi_name, aoi_scene[self.looked_aoi_name]) + + except KeyError: + + pass + # Draw looked aoi if required if draw_looked_aoi is not None: diff --git a/src/argaze/GazeAnalysis/FocusPointInside.py b/src/argaze/GazeAnalysis/FocusPointInside.py index f48caae..b3651e4 100644 --- a/src/argaze/GazeAnalysis/FocusPointInside.py +++ b/src/argaze/GazeAnalysis/FocusPointInside.py @@ -54,10 +54,12 @@ class AOIMatcher(GazeFeatures.AOIMatcher): return (None, None) - def draw(self, image: numpy.array, draw_matched_fixation: dict = None, draw_matched_fixation_positions: 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_matched_fixation_positions: 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_positions: GazeMovement.draw_positions parameters (if None, no fixation is drawn) draw_looked_aoi: AOIFeatures.AOI.draw parameters (if None, no looked aoi is drawn) diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index eeefcc9..d28986c 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -729,6 +729,16 @@ class AOIMatcher(): raise NotImplementedError('match() method not implemented') + def draw(self, image: numpy.array, aoi_scene: AOIFeatures.AOIScene): + """Draw matching into image. + + Parameters: + image: where to draw + aoi_scene: to refresh looked aoi if required + """ + + raise NotImplementedError('draw() method not implemented') + @property def looked_aoi(self) -> AOIFeatures.AreaOfInterest: """Get most likely looked aoi.""" |