DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

imageprocessing/geometry/imagetransformation/docs/usecase1.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
2 
3 @page imagetransformation_usecase1 Image Scaling
4 @tableofcontents
5 
6 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 
8 This section explains how to utilize the ImageTransformation module to downscale an image's ROI.
9 
10 @section imagetransformation_usecase1_creating Creating an Image
11 
12 To create an image for where the output should be copied:
13 
14 ```{cpp}
15 dwImageProperties imgProperties{};
16 dwSensorCamera_getImageProperties(&imgProperties, DW_CAMERA_OUTPUT_NATIVE_PROCESSED, camera);
17 
18 imgProperties.width /= 2;
19 imgProperties.height /= 2;
20 
21 dwImageHandle_t imageSmall = DW_NULL_HANDLE;
22 dwImage_create(&imageSmall, imgProperties, m_context);
23 ```
24 
25 @section imagetransformation_usecase1_initializing Initializing the ImageTransformation Module
26 
27 The ::dwImageTransformationHandle_t handle initializes the ImageTransformation module with the following parameters:
28 
29 For a complete description of all parameters, please refer to ::dwImageTransformationParameters.
30 
31 ```{cpp}
32 dwImageTransformationHandle_t imageTransformationEngine = DW_NULL_HANDLE;
33 dwImageTransformationParameters params{};
34 params.ignoreAspectRatio = false;
35 dwImageTransformation_initialize(&imageTransformationEngine, params, context);
36 
37 dwImageTransformation_setBorderMode(DW_IMAGEPROCESSING_BORDER_MODE_ZERO, imageTransformationEngine);
38 dwImageTransformation_setInterpolationMode(m_interpolation, imageTransformationEngine);
39 ```
40 
41 @section imagetransformation_usecase1_transforming Performing the Transformation
42 
43 ```{cpp}
44 dwImageTransformation_copyFullImage(imageSmall, imageInput, imageTransformationEngine);
45 ```
46 
47 @section imagetransformation_usecase1_releasing_handle Releasing the Handle
48 
49 To release the handle:
50 
51 ```{.cpp}
52  dwImageTransformation_release(imageTransformationEngine);
53 ```
54 
55 To see a full demonstration of this workflow, please refer to @ref dwx_imagetransformation.