diff options
author | Théo de la Hogue | 2022-12-19 15:54:11 +0100 |
---|---|---|
committer | Théo de la Hogue | 2022-12-19 15:54:11 +0100 |
commit | 175ff54e321cd6acd7d723a8193b2edb740fa338 (patch) | |
tree | d7eac2d9adcfbc3ab12809e2fb27bced569d4fd0 | |
parent | 9e13b3f7f5191301256a8a4e657b1ec74d78f356 (diff) | |
download | argaze-175ff54e321cd6acd7d723a8193b2edb740fa338.zip argaze-175ff54e321cd6acd7d723a8193b2edb740fa338.tar.gz argaze-175ff54e321cd6acd7d723a8193b2edb740fa338.tar.bz2 argaze-175ff54e321cd6acd7d723a8193b2edb740fa338.tar.xz |
Identifiying GazeMovement before first fixation detection.
-rw-r--r-- | src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py b/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py index 19f7fef..1364c99 100644 --- a/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py +++ b/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py @@ -117,7 +117,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): # Append this last out position to the valid gaze positions selection valid_gaze_positions[last_new_ts] = last_new_position - + yield self.__last_fixation self.__last_fixation = None @@ -248,9 +248,6 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): # Edit last movement gaze position movement_gaze_positions[stop_movement_ts] = stop_position - # End of inter fixations movement edition - #print(f'Inter: <{start_movement_ts} {stop_movement_ts}>, duration: {stop_movement_ts - start_movement_ts}, length: {len(movement_gaze_positions)}') - # Does new fixation overlap last fixation? if self.__last_fixation.overlap(new_fixation): @@ -293,11 +290,30 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): unmatched_gaze_positions = GazeFeatures.TimeStampedGazePositions() # First fixation is stored to allow further merging + # The movement before is outputed else: self.__last_fixation = new_fixation - # Forget former unmatched gaze positions + # Is there unmatched gaze positions? + if len(unmatched_gaze_positions) > 0: + + start_movement_ts, _ = unmatched_gaze_positions.first + stop_movement_ts, _ = unmatched_gaze_positions.last + + # Short time between fixations : this movement is a saccade + if stop_movement_ts - start_movement_ts <= self.duration_min_threshold: + + # Output saccade + yield Saccade(unmatched_gaze_positions) + + # Too much time between fixations: this movement is unknown + else: + + # Output unknown movement + yield GazeFeatures.GazeMovement(unmatched_gaze_positions) + + # In any case, forget former unmatched gaze positions unmatched_gaze_positions = GazeFeatures.TimeStampedGazePositions() # Dispersion too wide: |