DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Image Capture

This tutorial demonstrates how to utilize the FrameCapture module to capture images from a window rendered on screen.

The FrameCapture module is accessed through a handle:

Initializing the FrameCapture Module

The dwFrameCaptureHandle_t handle initializes the FrameCapture module with the following parameters, once they are declared and assigned.

dwFrameCaptureParams frameParams{};
std::string params = "type=disk";
params += ",format=h264";
params += ",bitrate=8000000";
params += ",framerate=30";
params += ",file=video.h264";
frameParams.params.parameters = params.c_str();
frameParams.width = imageWidth;
frameParams.height = imageHeight;
frameParams.serializationType = DW_IMAGE_GL;
dwFrameCapture_initialize(frameCapture,frameParams,dwSALHandle,dwContextHandle);

For a complete description of all parameters, please refer to dwFrameCaptureParams.

For simplicity, steps to render this window are left out of this tutorial. Please refer to Rendering Engine Sample for more information.

Capturing the Window's Content

To capture the content inside the window:

dwRect roiCapture = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
const dwImageGL* imgGL = nullptr;
dwFrameCapture_screenCapture(&imgGL, roiCapture,frameCapture);
dwFrameCapture_appendFrameGL(imgGL,frameCapture);

Releasing the Handle

To release the handle:

dwFrameCapture_release(frameCapture);

To see a full demonstration of this workflow, please refer to Image Capture Sample.