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:
Select the processors for the corresponding stages to run on:
Set input image size dimensions:
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:
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.