From 01378ae467b6399a13042f02a67010dfc820aee2 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 4 Sep 2023 14:49:27 +0200 Subject: Moving scripting features into a dedicated advanced chapter. --- .../gaze_analysis_pipeline/visualisation.md | 196 +++++++-------------- 1 file changed, 68 insertions(+), 128 deletions(-) (limited to 'docs/user_guide/gaze_analysis_pipeline/visualisation.md') diff --git a/docs/user_guide/gaze_analysis_pipeline/visualisation.md b/docs/user_guide/gaze_analysis_pipeline/visualisation.md index ad59d54..852cdc5 100644 --- a/docs/user_guide/gaze_analysis_pipeline/visualisation.md +++ b/docs/user_guide/gaze_analysis_pipeline/visualisation.md @@ -1,10 +1,75 @@ -Visualize ArFrame and ArLayers -============================== +Visualize ArFrame +================= -All [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and [ArLayers](../../argaze.md/#argaze.ArFeatures.ArFrame) pipeline steps result can be drawn in real time or afterward. +Visualisation is not a pipeline step but each [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) pipeline steps outputs can be drawn in real time or afterward, depending of application purpose. ![ArFrame visualisation](../../img/ar_frame_visualisation.png) +## Add image parameters to ArFrame JSON configuration file + +[ArFrame.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image) method parameters can be configured thanks to a dedicated JSON entry. + +Here is an extract from the JSON ArFrame configuration file with a sample where image parameters are added: + +```json +{ + "name": "My FullHD screen", + "size": [1920, 1080], + ... + "image_parameters": { + "draw_scan_path": { + "draw_fixations": { + "deviation_circle_color": [255, 0, 255], + "duration_border_color": [127, 0, 127], + "duration_factor": 1e-2 + }, + "draw_saccades": { + "line_color": [255, 0, 255] + }, + "deepness": 0 + }, + "draw_layers": { + "MyLayer": { + "draw_aoi_scene": { + "draw_aoi": { + "color": [255, 255, 255], + "border_size": 1 + } + }, + "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] + }, + "draw_matched_region": { + "color": [0, 255, 0], + "border_size": 4 + }, + "draw_looked_aoi": { + "color": [0, 255, 0], + "border_size": 2 + }, + "looked_aoi_name_color": [255, 255, 255], + "looked_aoi_name_offset": [0, -10] + } + } + }, + "draw_gaze_position": { + "color": [0, 255, 255] + } + } +} +``` + +!!! warning + Most of *image_parameters* entries work if related ArFrame/ArLayer pipeline steps are enabled. + For example, JSON *draw_scan_path* entry needs GazeMovementIdentifier and ScanPath steps to be enabled. + +Then, [ArFrame.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image) method can be called in various situations. + ## Export to PNG file Once timestamped gaze positions have been processed by [ArFrame.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method, it is possible to write [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) image into a file thanks to [OpenCV package](https://pypi.org/project/opencv-python/). @@ -70,128 +135,3 @@ if __name__ == '__main__': main() ``` - -## Edit ArFrame image parameters - -[ArFrame.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image) method parameters can be configured thanks to dictionary. - -```python -# Assuming ArFrame is loaded -... - -# Edit ArFrame image parameters -image_parameters = { - "draw_scan_path": { - "draw_fixations": { - "deviation_circle_color": [255, 0, 255], - "duration_border_color": [127, 0, 127], - "duration_factor": 1e-2 - }, - "draw_saccades": { - "line_color": [255, 0, 255] - }, - "deepness": 0 - }, - "draw_layers": { - "MyLayer": { - "draw_aoi_scene": { - "draw_aoi": { - "color": [255, 255, 255], - "border_size": 1 - } - }, - "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] - }, - "draw_matched_region": { - "color": [0, 255, 0], - "border_size": 4 - }, - "draw_looked_aoi": { - "color": [0, 255, 0], - "border_size": 2 - }, - "looked_aoi_name_color": [255, 255, 255], - "looked_aoi_name_offset": [0, -10] - } - } - }, - "draw_gaze_position": { - "color": [0, 255, 255] - } -} - -# Pass image parameters to ArFrame -ar_frame_image = ar_frame.image(**image_parameters) - -# Do something with ArFrame image -... -``` - -## Configure ArFrame image parameters - -[ArFrame.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image) method parameters can also be configured thanks to a dedicated JSON entry. - -Here is the JSON ArFrame configuration file example with image parameters included: - -```json -{ - "name": "My FullHD screen", - "size": [1920, 1080], - ... - "image_parameters": { - "draw_scan_path": { - "draw_fixations": { - "deviation_circle_color": [255, 0, 255], - "duration_border_color": [127, 0, 127], - "duration_factor": 1e-2 - }, - "draw_saccades": { - "line_color": [255, 0, 255] - }, - "deepness": 0 - }, - "draw_layers": { - "MyLayer": { - "draw_aoi_scene": { - "draw_aoi": { - "color": [255, 255, 255], - "border_size": 1 - } - }, - "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] - }, - "draw_matched_region": { - "color": [0, 255, 0], - "border_size": 4 - }, - "draw_looked_aoi": { - "color": [0, 255, 0], - "border_size": 2 - }, - "looked_aoi_name_color": [255, 255, 255], - "looked_aoi_name_offset": [0, -10] - } - } - }, - "draw_gaze_position": { - "color": [0, 255, 255] - } - } -} -``` - -!!! warning - Most of *image_parameters* entries work if related ArFrame/ArLayer pipeline steps are enabled. - For example, JSON *draw_scan_path* entry needs GazeMovementIdentifier and ScanPath steps to be enabled. \ No newline at end of file -- cgit v1.1