aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide
diff options
context:
space:
mode:
Diffstat (limited to 'docs/user_guide')
-rw-r--r--docs/user_guide/gaze_analysis_pipeline/logging.md31
-rw-r--r--docs/user_guide/gaze_analysis_pipeline/visualisation.md41
2 files changed, 31 insertions, 41 deletions
diff --git a/docs/user_guide/gaze_analysis_pipeline/logging.md b/docs/user_guide/gaze_analysis_pipeline/logging.md
index 617690f..8afb511 100644
--- a/docs/user_guide/gaze_analysis_pipeline/logging.md
+++ b/docs/user_guide/gaze_analysis_pipeline/logging.md
@@ -3,7 +3,7 @@ Log gaze analysis
[ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) analysis can be logged by registering observers to their **look** method.
-## Enable ArFrame and ArLayer analysis logging
+## Export gaze analysis to CSV file
[ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) have an observers attribute to enable pipeline execution logging.
@@ -36,7 +36,7 @@ from argaze.utils import UtilsFeatures
class ScanPathAnalysisLogger(DataFeatures.PipelineStepObserver, UtilsFeatures.FileWriter):
def on_look(self, timestamp, ar_frame):
- """Log scan path metrics"""
+ """Log scan path metrics.ar_frame"""
if ar_frame.analysis_available:
@@ -76,7 +76,7 @@ from argaze.utils import UtilsFeatures
class AOIScanPathAnalysisLogger(DataFeatures.PipelineStepObserver, UtilsFeatures.FileWriter):
def on_look(self, timestamp, ar_layer):
- """Log aoi scan path metrics"""
+ """Log aoi scan path metrics."""
if ar_layer.analysis_available:
@@ -104,4 +104,27 @@ Assuming that [ArGaze.GazeAnalysis.NGram](../../argaze.md/#argaze.GazeAnalysis.N
!!! note ""
- Learn to [script the pipeline](./advanced_topics/scripting.md) to know more about [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer) attributes. \ No newline at end of file
+ Learn to [script the pipeline](./advanced_topics/scripting.md) to know more about [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer) attributes.
+
+### Export gaze analysis to video file
+
+As explained in [pipeline steps visualisation chapter](visualisation.md), it is possible to get [ArFrame.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image) once timestamped gaze positions have been processed by [ArFrame.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method.
+
+```python
+from argaze import DataFeatures
+from argaze.utils import UtilsFeatures
+
+class VideoRecorder(DataFeatures.PipelineStepObserver, UtilsFeatures.VideoWriter):
+
+ def on_look(self, timestamp, ar_frame):
+ """Record frame image into video file."""
+
+ self.write(ar_frame.image())
+
+# Export recorder as observer
+__observers__ = {
+ "Video recorder": VideoRecorder(path="./video.mp4", width=1920, height=1080, fps=15)
+ }
+```
+
+Assuming that [ArFrame.image_parameters](../../argaze.md/#argaze.ArFeatures.ArFrame.image_parameters) are provided, ***video.mp4*** file would be created. \ No newline at end of file
diff --git a/docs/user_guide/gaze_analysis_pipeline/visualisation.md b/docs/user_guide/gaze_analysis_pipeline/visualisation.md
index 5f06fac..e046ddf 100644
--- a/docs/user_guide/gaze_analysis_pipeline/visualisation.md
+++ b/docs/user_guide/gaze_analysis_pipeline/visualisation.md
@@ -82,43 +82,6 @@ Here is an extract from the JSON ArFrame configuration file with a sample where
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/).
-
-```python
-import cv2
-
-# Assuming that timestamped gaze positions have been processed by ArFrame.look method
-...
-
-# Export ArFrame image
-cv2.imwrite('./ar_frame.png', ar_frame.image())
-```
-
-## Export to MP4 file
-
-While timestamped gaze positions are 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 video file thanks to [OpenCV package](https://pypi.org/project/opencv-python/).
-
-```python
-import cv2
-
-# Assuming ArFrame is loaded
-...
-
-# Create a video file to save ArFrame
-video = cv2.VideoWriter('ar_frame.avi', cv2.VideoWriter_fourcc(*'MJPG'), 10, ar_frame.size)
-
-# Assuming that timestamped gaze positions are being processed by ArFrame.look method
-...
-
- # Write ArFrame image into video file
- video.write(ar_frame.image())
-
-# Close video file
-video.release()
-```
-
## Live window display
While timestamped gaze positions are processed by [ArFrame.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method, it is possible to display [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) image thanks to [OpenCV package](https://pypi.org/project/opencv-python/).
@@ -147,3 +110,7 @@ if __name__ == '__main__':
main()
```
+
+!!! note "Export to video file"
+
+ Video exportation is detailed in [gaze analysis logging chapter](logging.md). \ No newline at end of file