NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
Feature 2D Tracker API

Detailed Description

Defines 2D-based feature detection and tracking.

Data Structures

struct  dwFeature2DTrackerConfig
 Holds configuration parameters for a feature tracker. More...
 

Macros

#define DW_FEATURE2D_TRACKER_MAX_WINDOW_SIZE   16
 tracking window size More...
 

Typedefs

typedef struct dwFeature2DTrackerObject * dwFeature2DTrackerHandle_t
 Handle representing a feature tracker. More...
 
typedef struct dwFeature2DTrackerObject const * dwConstFeature2DTrackerHandle_t
 Handle representing a const feature tracker. More...
 
typedef enum dwFeature2DTrackerAlgorithm dwFeature2DTrackerAlgorithm
 Defines different KLT tracking algorithms. More...
 
typedef struct dwFeature2DTrackerConfig dwFeature2DTrackerConfig
 Holds configuration parameters for a feature tracker. More...
 

Enumerations

enum  dwFeature2DTrackerAlgorithm {
  DW_FEATURE2D_TRACKER_ALGORITHM_STD = 0,
  DW_FEATURE2D_TRACKER_ALGORITHM_EX,
  DW_FEATURE2D_TRACKER_ALGORITHM_EX_FAST,
  DW_FEATURE2D_TRACKER_ALGORITHM_COUNT
}
 Defines different KLT tracking algorithms. More...
 

Functions

DW_API_PUBLIC dwStatus dwFeature2DTracker_initDefaultParams (dwFeature2DTrackerConfig *params)
 Initializes dwFeature2DTracker parameters with default values. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_initDefaultParamsForCamera (dwFeature2DTrackerConfig *params, const dwTransformation3f *cameraToRig, dwConstCameraModelHandle_t cameraHandle)
 Initializes dwFeature2DTracker parameters with values best suited for the given camera using camera extrinsic (dwTransformation3f* cameraToRig) and camera intrinsic (dwConstCameraModelHandle_t cameraHandle) More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_initialize (dwFeature2DTrackerHandle_t *obj, const dwFeature2DTrackerConfig *config, cudaStream_t cudaStream, dwContextHandle_t context)
 Creates and initializes a feature tracker. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_reset (dwFeature2DTrackerHandle_t obj)
 Resets a feature tracker. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_release (dwFeature2DTrackerHandle_t obj)
 Releases the feature tracker. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_trackFeatures (dwFeatureHistoryArray *featureHistoryArray, dwFeatureArray *predictedFeatures, float32_t *d_normalizedCrossCorrelation, const dwFeatureArray *featuresToTrack, const dwVector2f *d_predictedPositions, const dwPyramidImage *previousPyramid, const dwPyramidImage *currentPyramid, dwFeature2DTrackerHandle_t obj)
 Tracks features and store the tracked results to predictedFeatures between the previous and current images. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_compact (dwFeatureHistoryArray *featureHistoryArray, dwFeature2DTrackerHandle_t obj)
 Remove invalid features. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_setCUDAStream (cudaStream_t stream, dwFeature2DTrackerHandle_t obj)
 Sets the CUDA stream for CUDA related operations. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_getCUDAStream (cudaStream_t *stream, dwFeature2DTrackerHandle_t obj)
 Gets the CUDA stream used by the feature tracker. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_setPVAStream (cupvaStream_t stream, dwFeature2DTrackerHandle_t obj)
 Sets the cuPVA stream for PVA related operations. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_getPVAStream (cupvaStream_t *stream, dwFeature2DTrackerHandle_t obj)
 Gets the cuPVA stream used by the feature tracker. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_registerOutputNccScore (float32_t *nccScore, uint32_t nccScoreArraySize, dwFeature2DTrackerHandle_t obj)
 Binds output ncc Score. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_registerHistoryArray (dwFeatureHistoryArray *historyArray, dwFeature2DTrackerHandle_t obj)
 Binds feature HistoryArray. More...
 
DW_API_PUBLIC dwStatus dwFeature2DTracker_registerFeatureArray (dwFeatureArray *inFeatures, dwFeature2DTrackerHandle_t obj)
 Binds feature Array. More...
 

Macro Definition Documentation

◆ DW_FEATURE2D_TRACKER_MAX_WINDOW_SIZE

#define DW_FEATURE2D_TRACKER_MAX_WINDOW_SIZE   16

tracking window size

Definition at line 49 of file FeatureTracker.h.

Typedef Documentation

◆ dwConstFeature2DTrackerHandle_t

typedef struct dwFeature2DTrackerObject const* dwConstFeature2DTrackerHandle_t

Handle representing a const feature tracker.

Definition at line 55 of file FeatureTracker.h.

◆ dwFeature2DTrackerAlgorithm

Defines different KLT tracking algorithms.

◆ dwFeature2DTrackerConfig

Holds configuration parameters for a feature tracker.

◆ dwFeature2DTrackerHandle_t

typedef struct dwFeature2DTrackerObject* dwFeature2DTrackerHandle_t

Handle representing a feature tracker.

Definition at line 52 of file FeatureTracker.h.

Enumeration Type Documentation

◆ dwFeature2DTrackerAlgorithm

Defines different KLT tracking algorithms.

Enumerator
DW_FEATURE2D_TRACKER_ALGORITHM_STD 

3-DOF (dx, dy, dscale) standard KLT tracking.

DW_FEATURE2D_TRACKER_ALGORITHM_EX 

3-DOF (dx, dy, dscale) extended KLT tracking.

DW_FEATURE2D_TRACKER_ALGORITHM_EX_FAST 

3-DOF (dx, dy, dscale) fast extended KLT tracking.

DW_FEATURE2D_TRACKER_ALGORITHM_COUNT 

Definition at line 69 of file FeatureTracker.h.

Function Documentation

◆ dwFeature2DTracker_compact()

DW_API_PUBLIC dwStatus dwFeature2DTracker_compact ( dwFeatureHistoryArray featureHistoryArray,
dwFeature2DTrackerHandle_t  obj 
)

Remove invalid features.

Parameters
[in,out]featureHistoryArraySparse feature history array, the features whose status = DW_FEATURE2D_STATUS_INVALID will be removed after calling
[in]objSpecifies the feature tracker handle.
Returns
DW_INVALID_ARGUMENT if featureHistoryArray or obj is NULL.
A specific CUDA error in case of an underlying cuda failure.
DW_SUCCESS otherwise.
Note
this API does real work only when dwFeature2DTrackerConfig::enableSparseOutput = 1, It will also update the dwFeatureHistoryArray::newToOldMap.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_getCUDAStream()

DW_API_PUBLIC dwStatus dwFeature2DTracker_getCUDAStream ( cudaStream_t *  stream,
dwFeature2DTrackerHandle_t  obj 
)

Gets the CUDA stream used by the feature tracker.

Parameters
[out]streamThe CUDA stream currently used.
[in]objA handle to the feature tracker module.
Returns
DW_INVALID_ARGUMENT if feature tracker handle or stream are NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_getPVAStream()

DW_API_PUBLIC dwStatus dwFeature2DTracker_getPVAStream ( cupvaStream_t stream,
dwFeature2DTrackerHandle_t  obj 
)

Gets the cuPVA stream used by the feature tracker.

Parameters
[out]streamThe cuPVA stream currently used.
[in]objA handle to the feature tracker module.
Returns
DW_NOT_AVAILABLE if PVA is not available on the platform.
DW_INVALID_ARGUMENT if feature tracker handle is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_initDefaultParams()

DW_API_PUBLIC dwStatus dwFeature2DTracker_initDefaultParams ( dwFeature2DTrackerConfig params)

Initializes dwFeature2DTracker parameters with default values.

Parameters
[in,out]paramsdwFeature2DTracker parameters; user can optionally set imageWidth/imageHeight before the API call to obtain the default parameters for the resolution
Returns
DW_INVALID_ARGUMENT if params is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwFeature2DTracker_initDefaultParamsForCamera()

DW_API_PUBLIC dwStatus dwFeature2DTracker_initDefaultParamsForCamera ( dwFeature2DTrackerConfig params,
const dwTransformation3f cameraToRig,
dwConstCameraModelHandle_t  cameraHandle 
)

Initializes dwFeature2DTracker parameters with values best suited for the given camera using camera extrinsic (dwTransformation3f* cameraToRig) and camera intrinsic (dwConstCameraModelHandle_t cameraHandle)

Parameters
[out]paramsdwFeature2DTracker parameters
[in]cameraToRigtransformed camera extrinsic parameters with respect to rig
[in]cameraHandleholds camera intrinsic information
Returns
DW_INVALID_ARGUMENT if any parameter is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwFeature2DTracker_initialize()

DW_API_PUBLIC dwStatus dwFeature2DTracker_initialize ( dwFeature2DTrackerHandle_t obj,
const dwFeature2DTrackerConfig config,
cudaStream_t  cudaStream,
dwContextHandle_t  context 
)

Creates and initializes a feature tracker.

Parameters
[out]objA pointer to the feature tracker handle is returned here.
[in]configthe configuration parameters for tracker.
[in]cudaStreamthe CUDA stream to use for tracker operations.
[in]contextthe handle to the context under which it is created.
Returns
DW_INVALID_ARGUMENT if feature tracker handle, featureHistoryArray or context are NULL.
if config is invalid.
if featureHistoryArray is not allocated on GPU if featureHistoryArray contains invalid pointers DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwFeature2DTracker_registerFeatureArray()

DW_API_PUBLIC dwStatus dwFeature2DTracker_registerFeatureArray ( dwFeatureArray inFeatures,
dwFeature2DTrackerHandle_t  obj 
)

Binds feature Array.

Internally the cuda pointer to featureArray is mapped to pva address space using the cupva cuda interop api

Parameters
[in]inFeaturescuda pointer to Feature Array
[in]objA handle to the feature tracker module.
Returns
DW_NOT_SUPPORTED if the api is called for non pva platform. DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_registerHistoryArray()

DW_API_PUBLIC dwStatus dwFeature2DTracker_registerHistoryArray ( dwFeatureHistoryArray historyArray,
dwFeature2DTrackerHandle_t  obj 
)

Binds feature HistoryArray.

Internally the cuda pointer to feature History Array is mapped to pva address space using the cupva cuda interop api

Parameters
[in]historyArraycuda pointer to Complete feature History Array
[in]objA handle to the feature tracker module.
Returns
DW_NOT_SUPPORTED if the api is called for non pva platform. DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_registerOutputNccScore()

DW_API_PUBLIC dwStatus dwFeature2DTracker_registerOutputNccScore ( float32_t nccScore,
uint32_t  nccScoreArraySize,
dwFeature2DTrackerHandle_t  obj 
)

Binds output ncc Score.

Internally the cuda pointer to nccScore is mapped to pva address space using the cupva cuda interop api

Parameters
[in]nccScorecuda pointer to Input NccScore
[in]objA handle to the feature tracker module.
[in]nccScoreArraySizeNumber of elements in the ncc Score Array
Returns
DW_NOT_SUPPORTED if the api is called for non pva platform. DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_release()

DW_API_PUBLIC dwStatus dwFeature2DTracker_release ( dwFeature2DTrackerHandle_t  obj)

Releases the feature tracker.

This method releases all resources associated with a feature tracker.

Note
This method renders the handle unusable.
Parameters
[in]objThe object handle to be released.
Returns
DW_INVALID_ARGUMENT if feature tracker handle is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: Yes

◆ dwFeature2DTracker_reset()

DW_API_PUBLIC dwStatus dwFeature2DTracker_reset ( dwFeature2DTrackerHandle_t  obj)

Resets a feature tracker.

Parameters
[in]objSpecifies the feature tracker handle to be reset.
Returns
DW_INVALID_ARGUMENT if feature tracker handle is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_setCUDAStream()

DW_API_PUBLIC dwStatus dwFeature2DTracker_setCUDAStream ( cudaStream_t  stream,
dwFeature2DTrackerHandle_t  obj 
)

Sets the CUDA stream for CUDA related operations.

Note
The ownership of the stream remains by the callee.
Parameters
[in]streamThe CUDA stream to be used. Default is the one passed during dwFeature2DTracker_initialize.
[in]objA handle to the feature tracker module to set CUDA stream for.
Returns
DW_INVALID_ARGUMENT if feature tracker handle is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_setPVAStream()

DW_API_PUBLIC dwStatus dwFeature2DTracker_setPVAStream ( cupvaStream_t  stream,
dwFeature2DTrackerHandle_t  obj 
)

Sets the cuPVA stream for PVA related operations.

Note
The ownership of the stream remains by the callee.
Parameters
[in]streamThe cuPVA stream to be used.
[in]objA handle to the feature tracker module to set cuPVA stream for.
Returns
DW_NOT_AVAILABLE if PVA is not available on the platform.
DW_INVALID_ARGUMENT if feature tracker handle is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeature2DTracker_trackFeatures()

DW_API_PUBLIC dwStatus dwFeature2DTracker_trackFeatures ( dwFeatureHistoryArray featureHistoryArray,
dwFeatureArray predictedFeatures,
float32_t d_normalizedCrossCorrelation,
const dwFeatureArray featuresToTrack,
const dwVector2f d_predictedPositions,
const dwPyramidImage previousPyramid,
const dwPyramidImage currentPyramid,
dwFeature2DTrackerHandle_t  obj 
)

Tracks features and store the tracked results to predictedFeatures between the previous and current images.

Features to track are defined by dwFeatureHistoryArray bound to the tracker during initialization

Parameters
[out]featureHistoryArrayoutput feature history array, must be on GPU memory.
[out]predictedFeatureslist of predicted features, it's also the top slice of dwFeatureHistoryArray
[out]d_normalizedCrossCorrelationDevice pointer to nccScore of tracked features, will be ignored if it's NULL.
[in]featuresToTracklist of features to be tracked, usually the output of feature detector.
[in]d_predictedPositionsA GPU pointer to a list of expected positions of the features to be tracked. The indexes of this list must match the indexes of the internal feature list. If this is NULL(== 0), then use the locations in featuresToTrack
[in]previousPyramidpyramid constructed from the last image.
[in]currentPyramidpyramid constructed from the current image.
[in]objSpecifies the feature tracker handle.
Returns
DW_INVALID_ARGUMENT if any parameter except d_normalizedCrossCorrelation and d_predictedPositions is NULL, or previous and current pyramids have a different number of levels.
if previousFeatures or detectedFeatures are not on GPU.
A specific CUDA error in case of an underlying cuda failure.
DW_SUCCESS otherwise.
Note
Output predictedFeatures array contains a list of compacted features, invalid trackings are removed automatically, the orders between input featuresToTrack and output predictedFeatures can be queried by dwFeatureHistoryArray::newToOldMap which maps new->old index: newToOldMap[newIdx] == oldIdx. newToOldMap[i] = j means the i-th feature in output predictedFeatures is the j-th item in input featuresToTrack array. i.e. predictedFeatures[i] = featuresToTrack[newToOldMap[i]], below is an example: data: [1 2 3 4 5 6 7 8 9] tracked/untracked: [O O X X O X O X O] compacted output (overwrite 3 and 4 by 9 and 7): data: [1 2 9 7 5] newToOldMap: [0 1 8 6 4]
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes