diff options
author | Théo de la Hogue | 2022-04-20 16:21:06 +0200 |
---|---|---|
committer | Théo de la Hogue | 2022-04-20 16:21:06 +0200 |
commit | 63e9efb0d38d6f13df7de85a2bbd143809b64ccc (patch) | |
tree | 8e81b17c4f3e3957082b60a907ee8b0d40255f70 | |
parent | 859a4b4230c1fc6fc0f61b5ae48f3e3f70bd5d2a (diff) | |
download | argaze-63e9efb0d38d6f13df7de85a2bbd143809b64ccc.zip argaze-63e9efb0d38d6f13df7de85a2bbd143809b64ccc.tar.gz argaze-63e9efb0d38d6f13df7de85a2bbd143809b64ccc.tar.bz2 argaze-63e9efb0d38d6f13df7de85a2bbd143809b64ccc.tar.xz |
Adding frames member to visual scan step.
-rw-r--r-- | src/argaze/GazeFeatures.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index e132849..a04e511 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -194,11 +194,11 @@ class DispersionBasedFixationIdentifier(FixationIdentifier): return -1, None class VisualScanStep(DataStructures.DictObject): - """Define a visual scan step as a duration and an area of interest.""" + """Define a visual scan step as a duration, the name of the area of interest and all its frames during the step.""" - def __init__(self, duration, aoi): + def __init__(self, duration, aoi, frames = []): - super().__init__(type(self).__name__, **{'duration': duration, 'aoi': aoi}) + super().__init__(type(self).__name__, **{'duration': duration, 'aoi': aoi, 'frames': frames}) class TimeStampedVisualScanSteps(DataStructures.TimeStampedBuffer): """Define timestamped buffer to store visual scan steps.""" @@ -262,26 +262,32 @@ class PointerBasedVisualScan(VisualScanGenerator): for name in aoi_scene_current.areas(): - aoi_looked = aoi_scene_current[name].pointer != None + aoi = aoi_scene_current[name] + aoi_looked = aoi.pointer != None if aoi_looked: if not name in self.__start_dict.keys(): # aoi starts to be looked - self.__start_dict[name] = ts_current + self.__start_dict[name] = { + 'start': ts_current, + 'frames': DataStructures.TimeStampedBuffer() + } + + # store current aoi + self.__start_dict[name]['frames'][ts_current] = aoi elif name in self.__start_dict.keys(): + ts_start = self.__start_dict[name]['start'] + # aoi stops to be looked - ts_start = self.__start_dict[name] - duration = ts_current - ts_start + yield ts_start, VisualScanStep(ts_current - ts_start, name, self.__start_dict[name]['frames']) # forget the aoi del self.__start_dict[name] - yield ts_start, VisualScanStep(duration, name) - class FixationBasedVisualScan(VisualScanGenerator): """Build visual scan on the basis of timestamped fixations.""" |