Loading [MathJax]/extensions/tex2jax.js
  • <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>

  • DriveWorks SDK Reference
    5.8.83 Release
    For Test and Development only

    All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    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:

    #define DW_NULL_HANDLE
    Definition: Types.h:96
    struct dwFrameCaptureObject * dwFrameCaptureHandle_t
    Handle to a Frame Capture module object.
    Definition: FrameCapture.h:63

    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);
    dwSerializerParams params
    SensorSerializer parameters, see SensorSerializer.h.
    Definition: FrameCapture.h:97
    DW_VIZ_API_PUBLIC dwStatus dwFrameCapture_initialize(dwFrameCaptureHandle_t *obj, const dwFrameCaptureParams *params, dwSALHandle_t sal, dwContextHandle_t ctx)
    Create a new frame capture module.
    @ DW_FRAMECAPTURE_MODE_SERIALIZE
    Serialize enables the creation of the serializer which allows the calls to dwFrameCapture_appendFrame...
    Definition: FrameCapture.h:70
    @ DW_FRAMECAPTURE_MODE_SCREENCAP
    Screencapture mode allocates GL resources that enable the capture of the current rendering Window via...
    Definition: FrameCapture.h:68
    Initialization parameters for the frame capture module.
    Definition: FrameCapture.h:77
    @ DW_IMAGE_GL
    This type is provided here for completeness only.
    Definition: Image.h:107
    const char8_t * parameters
    Array for additional parameters provided to sensor serializer creation.

    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);
    Defines a rectangle.
    Definition: Types.h:203
    DW_VIZ_API_PUBLIC dwStatus dwFrameCapture_screenCapture(const dwImageGL **imageGL, const dwRect roi, dwFrameCaptureHandle_t framecapture)
    It grabs what is currently rendered on the current frame buffer and returns a dwImageGL out of it For...
    DW_VIZ_API_PUBLIC dwStatus dwFrameCapture_appendFrameGL(const dwImageGL *img, dwFrameCaptureHandle_t framecapture)
    Append a dwImageGL frame to the capture and it's serialized.
    Defines a GL texture image.
    Definition: Image.h:61

    Releasing the Handle

    To release the handle:

    dwFrameCapture_release(frameCapture);
    DW_VIZ_API_PUBLIC dwStatus dwFrameCapture_release(dwFrameCaptureHandle_t framecapture)
    Releases the frame capture module.

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

    人人超碰97caoporen国产