aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/ArFeatures.py14
-rw-r--r--src/argaze/GazeAnalysis/DeviationCircleCoverage.py7
-rw-r--r--src/argaze/GazeAnalysis/DispersionThresholdIdentification.py13
-rw-r--r--src/argaze/GazeAnalysis/FocusPointInside.py2
-rw-r--r--src/argaze/GazeAnalysis/VelocityThresholdIdentification.py13
-rw-r--r--src/argaze/GazeFeatures.py10
-rw-r--r--src/argaze/utils/demo_data/demo_gaze_analysis_setup.json26
7 files changed, 51 insertions, 34 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 122efe8..cdb7130 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -1022,13 +1022,6 @@ class ArFrame():
self.scan_path.draw(image, **draw_scan_path)
- # Draw layers if required
- if draw_layers is not None:
-
- for layer_name, draw_layer in draw_layers.items():
-
- self.layers[layer_name].draw(image, **draw_layer)
-
# Draw current fixation if required
if draw_fixations is not None and self.gaze_movement_identifier is not None:
@@ -1039,6 +1032,13 @@ class ArFrame():
self.gaze_movement_identifier.current_saccade.draw(image, **draw_saccades)
+ # Draw layers if required
+ if draw_layers is not None:
+
+ for layer_name, draw_layer in draw_layers.items():
+
+ self.layers[layer_name].draw(image, **draw_layer)
+
# Draw current gaze position if required
if draw_gaze_positions is not None:
diff --git a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py b/src/argaze/GazeAnalysis/DeviationCircleCoverage.py
index 6dadaba..d55d8c9 100644
--- a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py
+++ b/src/argaze/GazeAnalysis/DeviationCircleCoverage.py
@@ -109,7 +109,7 @@ class AOIMatcher(GazeFeatures.AOIMatcher):
return (None, None)
- 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)):
+ def draw(self, image: numpy.array, aoi_scene: AOIFeatures.AOIScene, draw_matched_fixation: 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:
@@ -132,11 +132,6 @@ class AOIMatcher(GazeFeatures.AOIMatcher):
self.__matched_gaze_movement.draw(image, **draw_matched_fixation)
- # Draw matched fixation positions if required
- if draw_matched_fixation_positions is not None:
-
- self.__matched_gaze_movement.draw_positions(image, **draw_matched_fixation_positions)
-
# Draw matched aoi
if self.looked_aoi.all() is not None:
diff --git a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
index 15fddf4..a7b9900 100644
--- a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
@@ -73,7 +73,7 @@ class Fixation(GazeFeatures.Fixation):
return self
- def draw(self, image: numpy.array, deviation_circle_color: tuple = None, duration_border_color: tuple = None, duration_factor: float = 1.):
+ def draw(self, image: numpy.array, deviation_circle_color: tuple = None, duration_border_color: tuple = None, duration_factor: float = 1., draw_positions: dict = None):
"""Draw fixation into image.
Parameters:
@@ -82,15 +82,20 @@ class Fixation(GazeFeatures.Fixation):
duration_factor: how many pixels per duration unit
"""
+ # Draw duration border if required
+ if duration_border_color is not None:
+
+ cv2.circle(image, (int(self.focus[0]), int(self.focus[1])), int(self.deviation_max), duration_border_color, int(self.duration * duration_factor))
+
# Draw deviation circle if required
if deviation_circle_color is not None:
cv2.circle(image, (int(self.focus[0]), int(self.focus[1])), int(self.deviation_max), deviation_circle_color, -1)
- # Draw duration border if required
- if duration_border_color is not None:
+ # Draw positions if required
+ if draw_positions is not None:
- cv2.circle(image, (int(self.focus[0]), int(self.focus[1])), int(self.deviation_max), duration_border_color, int(self.duration * duration_factor))
+ self.draw_positions(image, **draw_positions)
@dataclass(frozen=True)
class Saccade(GazeFeatures.Saccade):
diff --git a/src/argaze/GazeAnalysis/FocusPointInside.py b/src/argaze/GazeAnalysis/FocusPointInside.py
index b3651e4..88cfbed 100644
--- a/src/argaze/GazeAnalysis/FocusPointInside.py
+++ b/src/argaze/GazeAnalysis/FocusPointInside.py
@@ -54,7 +54,7 @@ class AOIMatcher(GazeFeatures.AOIMatcher):
return (None, None)
- 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)):
+ 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:
diff --git a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
index 64931f5..d10f666 100644
--- a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
@@ -72,7 +72,7 @@ class Fixation(GazeFeatures.Fixation):
return self
- def draw(self, image: numpy.array, deviation_circle_color: tuple = None, duration_border_color: tuple = None, duration_factor: float = 1.):
+ def draw(self, image: numpy.array, deviation_circle_color: tuple = None, duration_border_color: tuple = None, duration_factor: float = 1., draw_positions: dict = None):
"""Draw fixation into image.
Parameters:
@@ -81,15 +81,20 @@ class Fixation(GazeFeatures.Fixation):
duration_factor: how many pixels per duration unit
"""
+ # Draw duration border if required
+ if duration_border_color is not None:
+
+ cv2.circle(image, (int(self.focus[0]), int(self.focus[1])), int(self.deviation_max), duration_border_color, int(self.duration * duration_factor))
+
# Draw deviation circle if required
if deviation_circle_color is not None:
cv2.circle(image, (int(self.focus[0]), int(self.focus[1])), int(self.deviation_max), deviation_circle_color, -1)
- # Draw duration border if required
- if duration_border_color is not None:
+ # Draw positions if required
+ if draw_positions is not None:
- cv2.circle(image, (int(self.focus[0]), int(self.focus[1])), int(self.deviation_max), duration_border_color, int(self.duration * duration_factor))
+ self.draw_positions(image, **draw_positions)
@dataclass(frozen=True)
class Saccade(GazeFeatures.Saccade):
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 814753e..523bf2c 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -292,16 +292,16 @@ class GazeMovement():
ts_start, start_gaze_position = gaze_positions.pop_first()
ts_next, next_gaze_position = gaze_positions.first
- # Draw position if required
- if position_color is not None:
-
- start_gaze_position.draw(image, position_color, draw_precision=False)
-
# Draw line between positions if required
if line_color is not None:
cv2.line(image, (int(start_gaze_position[0]), int(start_gaze_position[1])), (int(next_gaze_position[0]), int(next_gaze_position[1])), line_color, 1)
+ # Draw position if required
+ if position_color is not None:
+
+ start_gaze_position.draw(image, position_color, draw_precision=False)
+
def draw(self, image: numpy.array, **kwargs):
"""Draw gaze movement into image."""
diff --git a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
index 52945ae..fe5d197 100644
--- a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
+++ b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
@@ -8,6 +8,7 @@
"duration_min_threshold": 200
}
},
+ "filter_in_progress_identification": false,
"scan_path": {
"duration_max": 10000
},
@@ -59,8 +60,7 @@
},
"draw_saccades": {
"line_color": [255, 0, 255]
- },
- "deepness": 0
+ }
},
"draw_layers": {
"main_layer": {
@@ -72,11 +72,11 @@
},
"draw_aoi_matching": {
"draw_matched_fixation": {
- "deviation_circle_color": [255, 255, 255]
- },
- "draw_matched_fixation_positions": {
- "position_color": [0, 255, 255],
- "line_color": [0, 0, 0]
+ "deviation_circle_color": [255, 255, 255],
+ "draw_positions": {
+ "position_color": [0, 255, 0],
+ "line_color": [0, 0, 0]
+ }
},
"draw_matched_region": {
"color": [0, 255, 0],
@@ -91,6 +91,18 @@
}
}
},
+ "draw_fixations": {
+ "deviation_circle_color": [255, 255, 255],
+ "duration_border_color": [127, 0, 127],
+ "duration_factor": 1e-2,
+ "draw_positions": {
+ "position_color": [0, 255, 255],
+ "line_color": [0, 0, 0]
+ }
+ },
+ "draw_saccades": {
+ "line_color": [255, 0, 255]
+ },
"draw_gaze_positions": {
"color": [0, 255, 255],
"size": 2