1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page image_usecase1 Image Capture
6 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
8 This tutorial demonstrates how to utilize the FrameCapture module to capture images from a window rendered on screen.<br>
10 The FrameCapture module is accessed through a handle:
13 dwFrameCaptureHandle_t frameCapture = DW_NULL_HANDLE;
15 @section image_usecase1_initializing Initializing the FrameCapture Module
17 The ::dwFrameCaptureHandle_t handle initializes the FrameCapture module with the following parameters, once they are declared and assigned.
20 dwFrameCaptureParams frameParams{};
21 std::string params = "type=disk";
22 params += ",format=h264";
23 params += ",bitrate=8000000";
24 params += ",framerate=30";
25 params += ",file=video.h264";
26 frameParams.params.parameters = params.c_str();
27 frameParams.width = imageWidth;
28 frameParams.height = imageHeight;
29 frameParams.mode = DW_FRAMECAPTURE_MODE_SCREENCAP | DW_FRAMECAPTURE_MODE_SERIALIZE;
30 frameParams.serializationType = DW_IMAGE_GL;
32 dwFrameCapture_initialize(frameCapture,frameParams,dwSALHandle,dwContextHandle);
34 For a complete description of all parameters, please refer to ::dwFrameCaptureParams.
36 For simplicity, steps to render this window are left out of this tutorial. Please refer to @ref dwx_render_engine_sample for more information.<br>
38 @section image_usecase1_capturing Capturing the Window's Content
40 To capture the content inside the window:
43 dwRect roiCapture = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
44 const dwImageGL* imgGL = nullptr;
45 dwFrameCapture_screenCapture(&imgGL, roiCapture,frameCapture);
46 dwFrameCapture_appendFrameGL(imgGL,frameCapture);
49 @section image_usecase1_releasing_handle Releasing the Handle
51 To release the handle:
54 dwFrameCapture_release(frameCapture);
57 To see a full demonstration of this workflow, please refer to @ref dwx_image_capture_sample.