DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Rectifier Workflow
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

This tutorial will show you how to convert images captured with a camera model into a different camera model.

In this example we'll use as input a camera from our rig configuration file:

dwInitialize(&contextHandle, DW_VERSION, &sdkParams)
dwRig_initializeFromFile(&rigConf, contextHandle, rigConfigFilename);
dwRig_findSensorByName(&sensorId, cameraName, rigConf)
dwCameraModel_initialize(&cameraModelIn, sensorId, rigConf)

The following two snippets demonstrate how to initialize different output camera models.
contextHandle is assumed to be previously initialized dwContextHandle_t.

Example of camera for rectification (undistortion)

// Settings
dwPinholeCameraConfig cameraConf = {};
cameraConf.distortion[0] = 0.f;
cameraConf.distortion[1] = 0.f;
cameraConf.distortion[2] = 0.f;
// CODE: other settings of camera
dwCameraModel_initializePinhole(&cameraModelOut, &cameraConf, contextHandle);

Example of camera for model projection (simulation)

// CODE: create settings of simulated ocam
dwCameraModel_initializeOCam(&cameraModelOut, &cameraConf, contextHandle);

Use of the rectifier

The rectifier module can be initialized with the camera models that we have just created:

dwRectifier_initialize(&rectifier, cameraModelIn, cameraModelOut, contextHandle);

And can be used on images coming from a live sensor or from a recording:

while(loop) {
// CODE: get image from camera, stream it (optional)
dwRectifier_setHomography(&homography, rectifier); //optional
dwRectifier_warp(&rectifiedImage, inputImage, rectifier);

For simplicity, the actual sensor management, including retrieving images from a camera, is omitted in this tutorial.
For more information see Camera Workflow.

Finally all handles can be released:


For the full implementation refer to Video Rectification Sample.
See Rig Configuration for more information on Calibrated Cameras.