diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/utils/demo_gaze_features_run.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/argaze/utils/demo_gaze_features_run.py b/src/argaze/utils/demo_gaze_features_run.py index 915ae86..c19f2c3 100644 --- a/src/argaze/utils/demo_gaze_features_run.py +++ b/src/argaze/utils/demo_gaze_features_run.py @@ -86,31 +86,31 @@ def main(): cv2.putText(frame_image, path, (20, ar_frame.size[1]-40), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 1, cv2.LINE_AA) # Display Transition matrix analysis if loaded - #try: + try: - transition_matrix_analyzer = ar_frame.layers['GrayRectangle'].aoi_scan_path_analyzers["argaze.GazeAnalysis.TransitionMatrix"] + transition_matrix_analyzer = ar_frame.layers['GrayRectangle'].aoi_scan_path_analyzers["argaze.GazeAnalysis.TransitionMatrix"] - cv2.putText(frame_image, f'Transition matrix density: {transition_matrix_analyzer.transition_matrix_density:.2f}', (20, ar_frame.size[1]-160), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv2.LINE_AA) - - # Iterate over indexes (departures) - for from_aoi, row in transition_matrix_analyzer.transition_matrix_probabilities.iterrows(): + cv2.putText(frame_image, f'Transition matrix density: {transition_matrix_analyzer.transition_matrix_density:.2f}', (20, ar_frame.size[1]-160), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 1, cv2.LINE_AA) + + # Iterate over indexes (departures) + for from_aoi, row in transition_matrix_analyzer.transition_matrix_probabilities.iterrows(): - # Iterate over columns (destinations) - for to_aoi, probability in row.items(): + # Iterate over columns (destinations) + for to_aoi, probability in row.items(): - if from_aoi != to_aoi and probability > 0.0: + if from_aoi != to_aoi and probability > 0.0: - from_center = ar_frame.layers['GrayRectangle'].aoi_scene[from_aoi].center.astype(int) - to_center = ar_frame.layers['GrayRectangle'].aoi_scene[to_aoi].center.astype(int) - start_line = (0.5 * from_center + 0.5 * to_center).astype(int) + from_center = ar_frame.layers['GrayRectangle'].aoi_scene[from_aoi].center.astype(int) + to_center = ar_frame.layers['GrayRectangle'].aoi_scene[to_aoi].center.astype(int) + start_line = (0.5 * from_center + 0.5 * to_center).astype(int) - color = [int(probability*200) + 55, int(probability*200) + 55, int(probability*200) + 55] + color = [int(probability*200) + 55, int(probability*200) + 55, int(probability*200) + 55] - cv2.line(frame_image, start_line, to_center, color, int(probability*10) + 2) - cv2.line(frame_image, from_center, to_center, [55, 55, 55], 2) + cv2.line(frame_image, start_line, to_center, color, int(probability*10) + 2) + cv2.line(frame_image, from_center, to_center, [55, 55, 55], 2) - #except KeyError: - # pass + except KeyError: + pass # Display aoi scan path basic metrics analysis if loaded try: |