From 02c931780e08bd21bc6b48136a5430a405478047 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Thu, 1 Feb 2024 02:04:36 +0100 Subject: Adding VideoWriter class. Using it in demo. Documenting its use. --- .../gaze_analysis_pipeline/visualisation.md | 41 +++------------------- 1 file changed, 4 insertions(+), 37 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 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 -- cgit v1.1