DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Dense Optical Flow Interface

Detailed Description

Defines the Dense Optical Flow module.

Note
SW Release Applicability: These APIs are available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

Data Structures

struct  dwDenseOpticalFlowParams
 Dense Optical Flow parameters. More...
 

Typedefs

typedef struct dwDenseOpticalFlowObject * dwDenseOpticalFlowHandle_t
 Handle to a DenseOpticalFlow object. More...
 

Enumerations

enum  dwDenseOpticalFlowMode {
  DW_DENSE_OPTICAL_FLOW_MODE_HIGH_PERFORMANCE = 0,
  DW_DENSE_OPTICAL_FLOW_MODE_ULTRA_HIGH_PERFORMANCE = 1,
  DW_DENSE_OPTICAL_FLOW_MODE_HIGH_QUALITY = 2
}
 
enum  dwDenseOpticalFlowStage {
  DW_DENSE_OPTICAL_FLOW_STAGE_VIC_ASYNC_PREPARE_DATA = 0,
  DW_DENSE_OPTICAL_FLOW_STAGE_NVENC_ASYNC_PROCESS,
  DW_DENSE_OPTICAL_FLOW_STAGE_PVA_ASYNC_POSTPROCESS,
  DW_DENSE_OPTICAL_FLOW_STAGE_GPU_ASYNC_POSTPROCESS,
  DW_DENSE_OPTICAL_FLOW_STAGE_CPU_SYNC_PROCESS
}
 Dense Optical Flow Pipeline stages. More...
 

Functions

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_bindInput (const dwImageHandle_t input, const dwImageHandle_t inputReference, dwDenseOpticalFlowHandle_t obj)
 Binds the input images to dense optical flow. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_bindOutput (dwImageHandle_t output, dwDenseOpticalFlowHandle_t obj)
 Binds the output image that contains motion vectors. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_calculateOpticalFlow (dwImageHandle_t output, const dwImageHandle_t input, const dwImageHandle_t inputReference, dwDenseOpticalFlowHandle_t obj)
 Calculates Dense Optical Flow between input and inputReference. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_getCUDAStream (cudaStream_t *stream, dwDenseOpticalFlowHandle_t obj)
 Gets the CUDA stream. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_getOutputImageProperties (dwImageProperties *outputProperties, dwDenseOpticalFlowHandle_t obj)
 Returns the required output image properties. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_initDefaultParams (dwDenseOpticalFlowParams *params)
 Initializes DenseOpticalFlow parameters with default values. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_initialize (dwDenseOpticalFlowHandle_t *obj, const dwDenseOpticalFlowParams *params, dwContextHandle_t ctx)
 Initializes Dense Optical Flow module. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_process (dwDenseOpticalFlowStage stageToExecute, dwDenseOpticalFlowHandle_t obj)
 Executes a given stage of the pipeline. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_release (dwDenseOpticalFlowHandle_t obj)
 Releases the DenseOpticalFlow module. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_reset (dwDenseOpticalFlowHandle_t obj)
 Resets DenseOpticalFlow module. More...
 
DW_API_PUBLIC dwStatus dwDenseOpticalFlow_setCUDAStream (cudaStream_t stream, dwDenseOpticalFlowHandle_t obj)
 Sets the CUDA stream. More...
 

Data Structure Documentation

◆ dwDenseOpticalFlowParams

struct dwDenseOpticalFlowParams
Data Fields
dwDenseOpticalFlowMode estimationMode Estimation mode that determines the speed and quality of the optical flow.
uint32_t imageHeight Input image height.
uint32_t imageWidth Input image width.
dwProcessorType processorNVENC Indicates which NVENC the corresponding part of the pipeline to be executed.

Valid options are DW_PROCESSOR_TYPE_NVENC_0, DW_PROCESSOR_TYPE_NVENC_1

dwProcessorType processorPVA Indicates which PVA the corresponding part of the pipeline to be executed.

Valid options are DW_PROCESSOR_TYPE_PVA_0, DW_PROCESSOR_TYPE_PVA_1

Typedef Documentation

◆ dwDenseOpticalFlowHandle_t

typedef struct dwDenseOpticalFlowObject* dwDenseOpticalFlowHandle_t

Handle to a DenseOpticalFlow object.

Definition at line 61 of file DenseOpticalFlow.h.

Enumeration Type Documentation

◆ dwDenseOpticalFlowMode

Enumerator
DW_DENSE_OPTICAL_FLOW_MODE_HIGH_PERFORMANCE 

High performance with lower quality.

DW_DENSE_OPTICAL_FLOW_MODE_ULTRA_HIGH_PERFORMANCE 

Ultra high performance with lowest quality.

DW_DENSE_OPTICAL_FLOW_MODE_HIGH_QUALITY 

High quality with low performance.

Definition at line 63 of file DenseOpticalFlow.h.

◆ dwDenseOpticalFlowStage

Dense Optical Flow Pipeline stages.

Enumerator
DW_DENSE_OPTICAL_FLOW_STAGE_VIC_ASYNC_PREPARE_DATA 

Prepares data by converting pitch linear NvMedia image to block linear on VIC.

DW_DENSE_OPTICAL_FLOW_STAGE_NVENC_ASYNC_PROCESS 

Estimates motion vectors on NVENC.

DW_DENSE_OPTICAL_FLOW_STAGE_PVA_ASYNC_POSTPROCESS 

Refines motion vectors on PVA.

DW_DENSE_OPTICAL_FLOW_STAGE_GPU_ASYNC_POSTPROCESS 

Extracts motion vectors on GPU.

DW_DENSE_OPTICAL_FLOW_STAGE_CPU_SYNC_PROCESS 

Synchronizes the output.

Definition at line 58 of file DenseOpticalFlow_processpipeline.h.

Function Documentation

◆ dwDenseOpticalFlow_bindInput()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_bindInput ( const dwImageHandle_t  input,
const dwImageHandle_t  inputReference,
dwDenseOpticalFlowHandle_t  obj 
)

Binds the input images to dense optical flow.

The optical flow will be estimated relative to reference.

Parameters
[in]inputImage of format DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR
[in]inputReferenceReference image of format DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR
[in]objSpecifies the DenseOpticalFlow handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST
Note
InputRGBA and InputYUV420 are the same image in different formats.
InputReferenceRGBA and InputReferenceYUV420 are the same image in different formats.

◆ dwDenseOpticalFlow_bindOutput()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_bindOutput ( dwImageHandle_t  output,
dwDenseOpticalFlowHandle_t  obj 
)

Binds the output image that contains motion vectors.

Parameters
[in]outputoutput Image of format DW_IMAGE_FORMAT_RG_UINT16. This image contains the motion vectors on each pixel, where R channel contains X dimension and G channel contains Y dimension.
[in]objSpecifies the DenseOpticalFlow handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST

◆ dwDenseOpticalFlow_calculateOpticalFlow()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_calculateOpticalFlow ( dwImageHandle_t  output,
const dwImageHandle_t  input,
const dwImageHandle_t  inputReference,
dwDenseOpticalFlowHandle_t  obj 
)

Calculates Dense Optical Flow between input and inputReference.

Parameters
[out]outputImage of format DW_IMAGE_FORMAT_RG_INT16 where R channel contains X coordinates and G channel contains Y coordinates of a motion vector for each pixel. Output image is owned by the application.
[in]inputImage of format DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR
[in]inputReferenceReference image of format DW_IMAGE_FORMAT_YUV420_UINT8_SEMIPLANAR
[in]objSpecifies the DenseOpticalFlow handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST
Note
output must be created via dwDenseOpticalFlow_createOutputImage.

◆ dwDenseOpticalFlow_getCUDAStream()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_getCUDAStream ( cudaStream_t *  stream,
dwDenseOpticalFlowHandle_t  obj 
)

Gets the CUDA stream.

Parameters
[out]streamThe CUDA stream currently used.
[in]objSpecifies the DenseOpticalFlow handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST

◆ dwDenseOpticalFlow_getOutputImageProperties()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_getOutputImageProperties ( dwImageProperties outputProperties,
dwDenseOpticalFlowHandle_t  obj 
)

Returns the required output image properties.

Parameters
[out]outputPropertiesOutput image properties
[in]objSpecifies the DenseOpticalFlow handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST

◆ dwDenseOpticalFlow_initDefaultParams()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_initDefaultParams ( dwDenseOpticalFlowParams params)

Initializes DenseOpticalFlow parameters with default values.

Parameters
[out]paramsDenseOpticalFlow parameters.
Returns
DW_SUCCESS, DW_INVALID_ARGUMENT

◆ dwDenseOpticalFlow_initialize()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_initialize ( dwDenseOpticalFlowHandle_t obj,
const dwDenseOpticalFlowParams params,
dwContextHandle_t  ctx 
)

Initializes Dense Optical Flow module.

Parameters
[out]objA pointer to DenseOpticalFlow handle to be initialized.
[in]paramsDenseOpticalFlow parameters
[in]ctxSpecifies the handle to the context
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST, DW_INVALID_ARGUMENT

◆ dwDenseOpticalFlow_process()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_process ( dwDenseOpticalFlowStage  stageToExecute,
dwDenseOpticalFlowHandle_t  obj 
)

Executes a given stage of the pipeline.

Parameters
[in]stageToExecutestageToExecute Stage to execute.
[in]objSpecifies the DenseOpticalFlow handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST, DW_INVALID_ARGUMENT

◆ dwDenseOpticalFlow_release()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_release ( dwDenseOpticalFlowHandle_t  obj)

Releases the DenseOpticalFlow module.

Parameters
[in]objThe object handle to release.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST
Note
This method renders the handle unusable.

◆ dwDenseOpticalFlow_reset()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_reset ( dwDenseOpticalFlowHandle_t  obj)

Resets DenseOpticalFlow module.

Parameters
[in]objHandle to reset.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST

◆ dwDenseOpticalFlow_setCUDAStream()

DW_API_PUBLIC dwStatus dwDenseOpticalFlow_setCUDAStream ( cudaStream_t  stream,
dwDenseOpticalFlowHandle_t  obj 
)

Sets the CUDA stream.

Note
The ownership of the stream remains by the callee.
Parameters
[in]streamThe CUDA stream to be used. Default is the stream 0, resulting in synchronous operations.
[in]objSpecifies the DenseOpticalFlow handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST