DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

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


NVIDIA® DriveWorks includes a sample pipeline demonstrating the Dense Optical Flow module across multiple video frames. The following summarizes the sample's initialization steps:

Initialize the parameters for the module with default values:

dwDenseOpticalFlowParameters params;

Select the processors for the corresponding stages to run on:

params.processorNVENC = DW_PROCESSOR_TYPE_NVENC_0;
params.processorPVA = DW_PROCESSOR_TYPE_PVA_0;

Set input image size dimensions:

params.imageWidth = 1280;
params.imageHeight = 800;

Initialize the Dense Optical Flow module:

Finally, the output image must be allocated by the application. This can be achieved by acquiring the required properties and using the dwImage API:

dwImageProperties outputProperties;
dwImageHandle_t outputImage;
dwImage_create(&imageOutput, outputProperties, sdk);


DriveWorks accepts two images as input: a reference image, and a template image. These two are used to compute the motion vectors.

The input images must have the following format: DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR.

The output image has the following format: `DW_IMAGE_FORMAT_RG_INT16. The R and G channels represent motion in the X and Y dimensions, respectively.



Finally, release the resources used:

For a demonstration of this workflow, see Dense Optical Flow Sample.