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

  • DriveWorks SDK Reference
    5.14.77 Release
    For Test and Development only

    All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    Image Scaling

    This section explains how to utilize the ImageTransformation module to downscale an image's ROI.

    Creating an Image

    To create an image for where the output should be copied:

    dwImageProperties imgProperties{};
    imgProperties.width /= 2;
    imgProperties.height /= 2;
    dwImage_create(&imageSmall, imgProperties, m_context);
    DW_API_PUBLIC dwStatus dwSensorCamera_getImageProperties(dwImageProperties *const imageProperties, dwCameraOutputType const outputType, dwSensorHandle_t const sensor)
    Gets information about the image properties for a given 'dwCameraImageOutputType'.
    @ DW_CAMERA_OUTPUT_NATIVE_PROCESSED
    processed images (usually be YUV420 planar or RGB planar)
    Definition: Camera.h:80
    #define DW_NULL_HANDLE
    Definition: Types.h:80
    struct dwImageObject * dwImageHandle_t
    Definition: Image.h:110
    DW_API_PUBLIC dwStatus dwImage_create(dwImageHandle_t *const image, dwImageProperties properties, dwContextHandle_t const ctx)
    Creates and allocates resources for a dwImageHandle_t based on the properties passed as input.
    Defines the properties of the image.
    Definition: Image.h:485

    Initializing the ImageTransformation Module

    The dwImageTransformationHandle_t handle initializes the ImageTransformation module with the following parameters:

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

    dwImageTransformationHandle_t imageTransformationEngine = DW_NULL_HANDLE;
    params.ignoreAspectRatio = false;
    dwImageTransformation_initialize(&imageTransformationEngine, params, context);
    dwImageTransformation_setInterpolationMode(m_interpolation, imageTransformationEngine);
    bool ignoreAspectRatio
    Boolean indicating whether the aspect ratio of the input image should be kept (false) or the image sh...
    DW_API_PUBLIC dwStatus dwImageTransformation_initialize(dwImageTransformationHandle_t *handle, dwImageTransformationParameters params, dwContextHandle_t context)
    Initializes an Image Transformation Engine with the given parameters.
    struct dwImageTransformationObject * dwImageTransformationHandle_t
    The image transformation handle.
    DW_API_PUBLIC dwStatus dwImageTransformation_setInterpolationMode(dwImageProcessingInterpolation mode, dwImageTransformationHandle_t handle)
    Sets the interpolation mode used by the APIs of Image Transformation.
    DW_API_PUBLIC dwStatus dwImageTransformation_setBorderMode(dwImageProcessingBorderMode mode, dwImageTransformationHandle_t handle)
    Sets the border mode used by the APIs of Image Transformation.
    @ DW_IMAGEPROCESSING_BORDER_MODE_ZERO
    No Border.

    Performing the Transformation

    dwImageTransformation_copyFullImage(imageSmall, imageInput, imageTransformationEngine);
    DW_API_PUBLIC dwStatus dwImageTransformation_copyFullImage(dwImageHandle_t const outputImage, dwImageHandle_t const inputImage, dwImageTransformationHandle_t const handle)
    Resizes the input image and copies the result into the previously allocated output image,...

    Releasing the Handle

    To release the handle:

    dwImageTransformation_release(imageTransformationEngine);
    DW_API_PUBLIC dwStatus dwImageTransformation_release(dwImageTransformationHandle_t handle)
    Releases the passed Transformation Engine, deallocating all the resources used.

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

    人人超碰97caoporen国产