VPI - Vision Programming Interface

1.2 Release

Pyramidal LK Optical Flow

Algorithm used to track points from one frame to the next. More...

Data Structures

struct  VPIOpticalFlowPyrLKParams
 Structure that defines the parameters for vpiSubmitOpticalFlowPyrLK. More...
 

Enumerations

enum  VPIEpsilonType
 Defines the error measurement types. More...
 

Functions

VPIStatus vpiInitOpticalFlowPyrLKParams (VPIOpticalFlowPyrLKParams *params)
 Initializes VPIOpticalFlowPyrLKParams with default values. More...
 
VPIStatus vpiCreateOpticalFlowPyrLK (uint32_t backends, int32_t width, int32_t height, VPIImageFormat fmt, int32_t levels, float scale, VPIPayload *payload)
 Creates payload for vpiSubmitOpticalFlowPyrLK. More...
 
VPIStatus vpiSubmitOpticalFlowPyrLK (VPIStream stream, uint32_t backend, VPIPayload payload, VPIPyramid prevPyr, VPIPyramid curPyr, VPIArray prevPts, VPIArray curPts, VPIArray trackingStatus, const VPIOpticalFlowPyrLKParams *params)
 Runs Pyramidal LK Optical Flow on two frames. More...
 

Detailed Description

Algorithm used to track points from one frame to the next.


Data Structure Documentation

◆ VPIOpticalFlowPyrLKParams

struct VPIOpticalFlowPyrLKParams

Structure that defines the parameters for vpiSubmitOpticalFlowPyrLK.

Definition at line 92 of file OpticalFlowPyrLK.h.

+ Collaboration diagram for VPIOpticalFlowPyrLKParams:
Data Fields
float epsilon Specifies the error for terminating the algorithm.
VPIEpsilonType epsilonType Specifies the tracking error type.
int32_t numIterations Specifies the number of iterations.

Value must be >= 1 and <= 32.

uint32_t termination Specifies the termination criteria.

It can be bitwise combination of VPI_TERMINATION_CRITERIA_ITERATIONS and VPI_TERMINATION_CRITERIA_EPSILON.

uint32_t useInitialFlow Uses initial estimations stored in curPts when this flag is not 0, otherwise prevPts is copied to curPts and is considered the initial estimate.
int32_t windowDimension Specifies the size of the window on which to perform the algorithm.

Value must be >= 6 and <= 32.

Enumeration Type Documentation

◆ VPIEpsilonType

#include <vpi/algo/OpticalFlowPyrLK.h>

Defines the error measurement types.

Enumerator
VPI_LK_ERROR_L1 

L1 distance between previous feature and a next feature.

Definition at line 82 of file OpticalFlowPyrLK.h.

Function Documentation

◆ vpiCreateOpticalFlowPyrLK()

VPIStatus vpiCreateOpticalFlowPyrLK ( uint32_t  backends,
int32_t  width,
int32_t  height,
VPIImageFormat  fmt,
int32_t  levels,
float  scale,
VPIPayload payload 
)

#include <vpi/algo/OpticalFlowPyrLK.h>

Creates payload for vpiSubmitOpticalFlowPyrLK.

Parameters
[in]backendsVPI backends that are eligible to execute the algorithm. Currently only one backend is accepted.
[in]fmtSpecifies the format for the pyramid.
[in]width,heightSpecifies the dimensions of the pyramid on the finest resolution.
[in]levelsSpecifies the level of the pyramid.
[in]scaleSpecifies the scale of the pyramid.
[out]payloadPointer to memory where the created payload handle will be written to.
Returns
an error code on failure else VPI_SUCCESS.

◆ vpiInitOpticalFlowPyrLKParams()

VPIStatus vpiInitOpticalFlowPyrLKParams ( VPIOpticalFlowPyrLKParams params)

#include <vpi/algo/OpticalFlowPyrLK.h>

Initializes VPIOpticalFlowPyrLKParams with default values.

Defaults:

  • useInitialFlow = 0
  • termination = VPI_TERMINATION_CRITERIA_ITERATIONS | VPI_TERMINATION_CRITERIA_EPSILON
  • epsilonType = VPI_LK_ERROR_L1
  • epsilon = 0
  • windowDimension = 15
  • numIterations = 6
Parameters
[in]paramsStructure to be filled with default values.
Returns
an error code on failure else VPI_SUCCESS

◆ vpiSubmitOpticalFlowPyrLK()

VPIStatus vpiSubmitOpticalFlowPyrLK ( VPIStream  stream,
uint32_t  backend,
VPIPayload  payload,
VPIPyramid  prevPyr,
VPIPyramid  curPyr,
VPIArray  prevPts,
VPIArray  curPts,
VPIArray  trackingStatus,
const VPIOpticalFlowPyrLKParams params 
)

#include <vpi/algo/OpticalFlowPyrLK.h>

Runs Pyramidal LK Optical Flow on two frames.

Outputs estimated feature points and tracking status.

Parameters
[in]streamThe stream where the operation will be queued in.
[in]backendBackend that will execute the algorithm. Must be one of the backends specified during payload creation. If 0, VPI will select one of the eligible backends from the payload that accepts the given parameters, usually the fastest one.
[in]payloadPayload created with vpiCreateOpticalFlowPyrLK
[in]prevPyrPrevious frame, represented as a gaussian pyramid.
[in]curPyrCurrent frame, represented as a gaussian pyramid.
[in]prevPtsarray of keypoints in the prevPyr high resolution pyramid. The type of array must be VPI_ARRAY_TYPE_KEYPOINT.
[in,out]curPtsarray of keypoints in the curPyr high resolution pyramid. It is used as starting search point in curPyr if useInitialFlow is not 0. The type of array must be VPI_ARRAY_TYPE_KEYPOINT.
[in,out]trackingStatusStatus array for tracking status for each input in prevPts. If element is one, the corresponding keypoint isn't being tracked, otherwise, it is. The type of the array must be VPI_ARRAY_TYPE_U8.
[in]paramsParameters for the LK tracker. If NULL, it uses default parameters are returned by vpiInitOpticalFlowPyrLKParams.
Returns
an error code on failure else VPI_SUCCESS