1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page rectifier_usecase1 Rectifier Workflow
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 This tutorial will show you how to convert images captured with a camera model into a different camera model.
9 In this example we'll use as input a camera from our rig configuration file:
12 dwInitialize(&contextHandle, DW_VERSION, &sdkParams)
13 dwRig_initializeFromFile(&rigConf, contextHandle, rigConfigFilename);
14 dwRig_findSensorByName(&sensorId, cameraName, rigConf)
16 dwCameraModelHandle_t cameraModelIn = DW_NULL_HANDLE;
17 dwCameraModel_initialize(&cameraModelIn, sensorId, rigConf)
20 The following two snippets demonstrate how to initialize different output camera models.<br>
21 `contextHandle` is assumed to be previously initialized `::dwContextHandle_t`.
23 #### Example of camera for rectification (undistortion)
27 dwPinholeCameraConfig cameraConf = {};
28 cameraConf.distortion[0] = 0.f;
29 cameraConf.distortion[1] = 0.f;
30 cameraConf.distortion[2] = 0.f;
31 // CODE: other settings of camera
32 dwCameraModel_initializePinhole(&cameraModelOut, &cameraConf, contextHandle);
35 #### Example of camera for model projection (simulation)
38 // CODE: create settings of simulated ocam
39 dwCameraModel_initializeOCam(&cameraModelOut, &cameraConf, contextHandle);
42 #### Use of the rectifier
44 The rectifier module can be initialized with the camera models that we have just created:
47 dwRectifier_initialize(&rectifier, cameraModelIn, cameraModelOut, contextHandle);
50 And can be used on images coming from a live sensor or from a recording:
54 // CODE: get image from camera, stream it (optional)
55 dwRectifier_setHomography(&homography, rectifier); //optional
56 dwRectifier_warp(&rectifiedImage, inputImage, rectifier);
60 For simplicity, the actual sensor management, including retrieving images from a camera, is omitted in this tutorial.<br>
61 For more information see @ref camera_usecase1.
63 Finally all handles can be released:
66 dwCameraModel_release(cameraModelIn);
67 dwCameraModel_release(cameraModelOut);
68 dwRectifier_release(rectifier);
69 dwRelease(contextHandle);
72 For the full implementation refer to @ref dwx_video_rectifier_sample.<br>
73 See @ref rig_mainsection for more information on Calibrated Cameras.