NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release

Detailed Description

dw_imageprocessing_features

The test specification can be found at featurearrayapi_features_testgroup

Data Structures

struct  dwFeatureHistoryArray
 Holds pointers to the data exposed by a feature2d list. More...
 
struct  dwFeatureArray
 

Typedefs

typedef enum dwFeature2DStatus dwFeature2DStatus
 Defines the feature array used by detector and tracker. More...
 
typedef struct dwFeatureHistoryArray dwFeatureHistoryArray
 Holds pointers to the data exposed by a feature2d list. More...
 
typedef struct dwFeatureArray dwFeatureArray
 

Enumerations

enum  dwFeature2DStatus {
  DW_FEATURE2D_STATUS_INVALID = 0,
  DW_FEATURE2D_STATUS_DETECTED,
  DW_FEATURE2D_STATUS_TRACKED,
  DW_FEATURE2D_STATUS_TYPE_COUNT
}
 Defines the feature array used by detector and tracker. More...
 

Functions

DW_API_PUBLIC dwStatus dwFeatureArray_create (dwFeatureArray *featureArray, const uint32_t maxFeatureCount, const dwMemoryType memoryType, dwContextHandle_t context)
 Creates and initializes a feature array. More...
 
DW_API_PUBLIC dwStatus dwFeatureArray_createNew (dwFeatureArray *featureArray, const uint32_t maxFeatureCount, const dwMemoryType memoryType, cudaStream_t stream, dwContextHandle_t context)
 Creates and initializes a feature array. More...
 
DW_API_PUBLIC dwStatus dwFeatureArray_destroy (dwFeatureArray featureArray)
 Destroys the featureArray and frees any memory created by dwFeatureArray_createNew(). More...
 
DW_API_PUBLIC dwStatus dwFeatureArray_reset (dwFeatureArray *featureArray, cudaStream_t stream)
 Resets the feature array. More...
 
DW_API_PUBLIC dwStatus dwFeatureArray_copyAsync (dwFeatureArray *dstFeatures, const dwFeatureArray *srcFeatures, cudaStream_t stream)
 Deep copy all contents from srcFeatures to dstFeatures. More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_create (dwFeatureHistoryArray *featureHistoryArray, const uint32_t maxFeatureCount, const uint32_t maxHistoryCapacity, const dwMemoryType memoryType, dwContextHandle_t context)
 Creates and initializes a feature history array. More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_createNew (dwFeatureHistoryArray *featureHistoryArray, const uint32_t maxFeatureCount, const uint32_t maxHistoryCapacity, const dwMemoryType memoryType, cudaStream_t stream, dwContextHandle_t context)
 Creates and initializes a feature history array. More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_destroy (dwFeatureHistoryArray featureHistoryArray)
 Destroys the featureHistoryArray and frees any memory created by dwFeatureHistoryArray_createNew(). More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_reset (dwFeatureHistoryArray *featureHistoryArray, cudaStream_t stream)
 Resets the feature history array. More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_getCurrent (dwFeatureArray *featureArray, dwFeatureHistoryArray const *featureHistoryArray)
 Get the latest feature snapshot(arraySize = maxFeatureCount) from history. More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_getPrevious (dwFeatureArray *featureArray, dwFeatureHistoryArray const *featureHistoryArray)
 Get the feature snapshot(arraySize = maxFeatureCount) 1 frame previous to current time. More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_get (dwFeatureArray *featureArray, const uint32_t historyIdx, dwFeatureHistoryArray const *featureHistoryArray)
 Get the feature snapshot(arraySize = maxFeatureCount) historyIdx-th frame earlier. More...
 
DW_API_PUBLIC dwStatus dwFeatureHistoryArray_copyAsync (dwFeatureHistoryArray *dstFeatureHistory, const dwFeatureHistoryArray *srcFeatureHistory, cudaStream_t stream)
 Deep copy all contents from srcFeatureHistory to dstFeatureHistory. More...
 
DW_API_PUBLIC dwStatus dwFeature_mergeNewToOldMap (uint32_t *d_newToOldMapC2A, const uint32_t *d_newToOldMapC2B, const uint32_t *d_newToOldMapB2A, const uint32_t *d_newToOldMapCount, const uint32_t maxFeatureCount, cudaStream_t stream)
 Merge newToOldMap from 2 inputs. More...
 

Typedef Documentation

◆ dwFeature2DStatus

Defines the feature array used by detector and tracker.

Defines the possible status of a feature.

◆ dwFeatureArray

◆ dwFeatureHistoryArray

Holds pointers to the data exposed by a feature2d list.

The pointers can point to GPU or CPU memory.

The locationHistory field is a 2D structure that stores the pixel positions for each feature at each time instant. It is a column-major matrix, where the column is the time-index and the row is the feature-index, for example: [x_00,y_00],[x_10,y_10],...,[x_N0,y_N0],[x_01,y_01],...,[x_N1,y_N1],...,[x_NH,y_NH], Where N = max feature count and H = location history size.


To avoid unnecessary memory copies, the time-index is treated as a ringbuffer. The feature2d list has a global "currentTimeIdx" that wraps around the location history size. The ages array holds how many frames each feature has been tracked. This value can be larger than historyCapacity, in this case, the accessing will be wrapped in ringbuffer.

@par Example to access the locations for the current and previous frames. @verbatim embed:rst:leading-asterisk .. code-block:: cpp dwVector2f currentLocation = locationHistory[currentTimeIdx * maxFeatureCount + featureIdx]; uint32_t previousTimeIdx = (currentTimeIdx + 1) % historyCapacity; dwVector2f currentLocation = locationHistory[previousTimeIdx * maxFeatureCount + featureIdx]; @endverbatim

Enumeration Type Documentation

◆ dwFeature2DStatus

Defines the feature array used by detector and tracker.

Defines the possible status of a feature.

Enumerator
DW_FEATURE2D_STATUS_INVALID 

A feature with this entry is garbage.

DW_FEATURE2D_STATUS_DETECTED 

The feature was just detected in the current frame.

DW_FEATURE2D_STATUS_TRACKED 

The feature was successfully tracked in the current frame.

DW_FEATURE2D_STATUS_TYPE_COUNT 

Number of different dwFeature2DStatus enum type, mark as enum end.

Definition at line 52 of file FeatureList.h.

Function Documentation

◆ dwFeature_mergeNewToOldMap()

DW_API_PUBLIC dwStatus dwFeature_mergeNewToOldMap ( uint32_t *  d_newToOldMapC2A,
const uint32_t *  d_newToOldMapC2B,
const uint32_t *  d_newToOldMapB2A,
const uint32_t *  d_newToOldMapCount,
const uint32_t  maxFeatureCount,
cudaStream_t  stream 
)

Merge newToOldMap from 2 inputs.

i.e. There're 3 working stages: A->B->C, newToOldMapC2B gives the mapping of C->B, while newToOldMapB2A gives the mapping of B->A. The final C->A mapping will be computed and output to newToOldMapC2A

Parameters
[out]d_newToOldMapC2AA GPU pointer to the output merged newToOldMap
[in]d_newToOldMapC2BA GPU pointer to newToOldMap from stage C->B
[in]d_newToOldMapB2AA GPU pointer to newToOldMap from stage B->A
[in]d_newToOldMapCountA GPU pointer to valid number of entries in newToOldMapC2B
[in]maxFeatureCountmax number of features for newToOldMapC2A, newToOldMapC2B and newToOldMapB2A
[in]streamWorking cuda stream
Returns
DW_INVALID_ARGUMENT if any of the input argument is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeatureArray_copyAsync()

DW_API_PUBLIC dwStatus dwFeatureArray_copyAsync ( dwFeatureArray dstFeatures,
const dwFeatureArray srcFeatures,
cudaStream_t  stream 
)

Deep copy all contents from srcFeatures to dstFeatures.

Parameters
[out]dstFeaturesdwFeatureArray to copy to
[in]srcFeaturesdwFeatureArray to copy from
[in]streamWorking cuda stream
Returns
DW_INVALID_ARGUMENT if dstFeatures or srcFeatures is NULL.
if dstFeatures.maxFeatures != srcFeatures.maxFeatures.
A specific CUDA error in case of an underlying cuda failure.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeatureArray_create()

DW_API_PUBLIC dwStatus dwFeatureArray_create ( dwFeatureArray featureArray,
const uint32_t  maxFeatureCount,
const dwMemoryType  memoryType,
dwContextHandle_t  context 
)

Creates and initializes a feature array.

Parameters
[out]featureArraypointer to the dwFeatureArray is returned here.
[in]maxFeatureCountmaximum number of features that the feature array can have.
[in]memoryTypeDW_FEATURE2D_MEMORY_TYPE_CUDA for CUDA array,
DW_FEATURE2D_MEMORY_TYPE_CPU for CPU array,
DW_FEATURE2D_MEMORY_TYPE_PINNED for pinned memory
[in]contexthandle to the context under which it is created.
Returns
DW_INVALID_ARGUMENT if feature arry or context are NULL.
if maxFeatureCount is 0.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwFeatureArray_createNew()

DW_API_PUBLIC dwStatus dwFeatureArray_createNew ( dwFeatureArray featureArray,
const uint32_t  maxFeatureCount,
const dwMemoryType  memoryType,
cudaStream_t  stream,
dwContextHandle_t  context 
)

Creates and initializes a feature array.

Parameters
[out]featureArraypointer to the dwFeatureArray is returned here.
[in]maxFeatureCountmaximum number of features that the feature array can have.
[in]memoryTypeDW_FEATURE2D_MEMORY_TYPE_CUDA for CUDA array,
DW_FEATURE2D_MEMORY_TYPE_CPU for CPU array,
DW_FEATURE2D_MEMORY_TYPE_PINNED for pinned memory
[in]streamWorking CUDA stream
[in]contexthandle to the context under which it is created.
Returns
DW_INVALID_ARGUMENT if feature arry or context are NULL.
if maxFeatureCount is 0.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwFeatureArray_destroy()

DW_API_PUBLIC dwStatus dwFeatureArray_destroy ( dwFeatureArray  featureArray)

Destroys the featureArray and frees any memory created by dwFeatureArray_createNew().

Parameters
[in]featureArrayfeature array to be destroyed.
Returns
DW_INVALID_ARGUMENT if featureArray contains invalid pointers.
DW_SUCCESS otherwise.
Note
dwFeatureArray got by dwFeatureHistoryArray_get*() API doesn't need to be destroyed by this API, all resource will be freed when calling dwFeatureHistoryArray_destroy().
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: Yes

◆ dwFeatureArray_reset()

DW_API_PUBLIC dwStatus dwFeatureArray_reset ( dwFeatureArray featureArray,
cudaStream_t  stream 
)

Resets the feature array.

Sets the feature count back to zero.

Parameters
[in]featureArrayfeature array to be reset.
[in]streamCUDA stream used to reset the feature array
Returns
DW_INVALID_ARGUMENT if featureArray.featureCount is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeatureHistoryArray_copyAsync()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_copyAsync ( dwFeatureHistoryArray dstFeatureHistory,
const dwFeatureHistoryArray srcFeatureHistory,
cudaStream_t  stream 
)

Deep copy all contents from srcFeatureHistory to dstFeatureHistory.

Parameters
[out]dstFeatureHistorydwFeatureHistoryArray to copy to
[in]srcFeatureHistorydwFeatureHistoryArray to copy from
[in]streamWorking cuda stream
Returns
DW_INVALID_ARGUMENT if dstFeatureHistory or srcFeatureHistory is NULL.
if dstFeatureHistory.bytes != srcFeaturesHistory.bytes.
A specific CUDA error in case of an underlying cuda failure.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeatureHistoryArray_create()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_create ( dwFeatureHistoryArray featureHistoryArray,
const uint32_t  maxFeatureCount,
const uint32_t  maxHistoryCapacity,
const dwMemoryType  memoryType,
dwContextHandle_t  context 
)

Creates and initializes a feature history array.

Parameters
[out]featureHistoryArraypointer to the dwFeatureHistoryArray is returned here.
[in]maxFeatureCountmaximum number of features that each time slice can have.
[in]maxHistoryCapacitymaximum length of history in feature history array. There'll be maxFeatureCount*maxHistoryCapacity features totally.
[in]memoryTypeDW_FEATURE2D_MEMORY_TYPE_CUDA for CUDA array,
DW_FEATURE2D_MEMORY_TYPE_CPU for CPU array,
DW_FEATURE2D_MEMORY_TYPE_PINNED for pinned memory
[in]contexthandle to the context under which it is created.
Returns
DW_INVALID_ARGUMENT if feature arry or context are NULL.
if maxFeatureCount or maxHistoryCapacity is 0.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwFeatureHistoryArray_createNew()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_createNew ( dwFeatureHistoryArray featureHistoryArray,
const uint32_t  maxFeatureCount,
const uint32_t  maxHistoryCapacity,
const dwMemoryType  memoryType,
cudaStream_t  stream,
dwContextHandle_t  context 
)

Creates and initializes a feature history array.

Parameters
[out]featureHistoryArraypointer to the dwFeatureHistoryArray is returned here.
[in]maxFeatureCountmaximum number of features that each time slice can have.
[in]maxHistoryCapacitymaximum length of history in feature history array. There'll be maxFeatureCount*maxHistoryCapacity features totally.
[in]memoryTypeDW_FEATURE2D_MEMORY_TYPE_CUDA for CUDA array,
DW_FEATURE2D_MEMORY_TYPE_CPU for CPU array,
DW_FEATURE2D_MEMORY_TYPE_PINNED for pinned memory
[in]streamWorking CUDA stream
[in]contexthandle to the context under which it is created.
Returns
DW_INVALID_ARGUMENT if feature arry or context are NULL.
if maxFeatureCount or maxHistoryCapacity is 0.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwFeatureHistoryArray_destroy()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_destroy ( dwFeatureHistoryArray  featureHistoryArray)

Destroys the featureHistoryArray and frees any memory created by dwFeatureHistoryArray_createNew().

Parameters
[in]featureHistoryArrayfeature history array to be destroyed.
Returns
DW_INVALID_ARGUMENT if featureHistoryArray contains invalid pointers.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: Yes

◆ dwFeatureHistoryArray_get()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_get ( dwFeatureArray featureArray,
const uint32_t  historyIdx,
dwFeatureHistoryArray const *  featureHistoryArray 
)

Get the feature snapshot(arraySize = maxFeatureCount) historyIdx-th frame earlier.

Assuming dwFeatureHistoryArray has N valid features in current Time(t), this API returns a dwFeatureArray that contains the snapshot of those N features in Time(t-historyIdx)

Parameters
[out]featureArraySnapshot of the timeIdx that is historyIdx frame previous to current in feature history.
[in]historyIdxTime index that need to be backtraced.
[in]featureHistoryArrayComplete feature history.
Returns
DW_INVALID_ARGUMENT if featureArray or featureHistoryArray is NULL
DW_SUCCESS otherwise
Note
featureArray got by this API DOES NOT need to be freed by dwFeatureArray_destroy().
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeatureHistoryArray_getCurrent()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_getCurrent ( dwFeatureArray featureArray,
dwFeatureHistoryArray const *  featureHistoryArray 
)

Get the latest feature snapshot(arraySize = maxFeatureCount) from history.

Parameters
[out]featureArraySnapshot of latest time in feature history.
[in]featureHistoryArrayComplete feature history.
Returns
DW_INVALID_ARGUMENT if featureArray or featureHistoryArray is NULL.
DW_SUCCESS otherwise.
Note
featureArray got by this API DOES NOT need to be freed by dwFeatureArray_destroy().
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeatureHistoryArray_getPrevious()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_getPrevious ( dwFeatureArray featureArray,
dwFeatureHistoryArray const *  featureHistoryArray 
)

Get the feature snapshot(arraySize = maxFeatureCount) 1 frame previous to current time.

Assuming dwFeatureHistoryArray has N valid features in current Time(t), this API returns a dwFeatureArray that contains the snapshot of those N features in Time(t-1).

Parameters
[out]featureArraySnapshot of the timeIdx that is 1 frame previous to current in feature history.
[in]featureHistoryArrayComplete feature history.
Returns
DW_INVALID_ARGUMENT if featureArray or featureHistoryArray is NULL.
DW_SUCCESS otherwise.
Note
featureArray got by this API DOES NOT need to be freed by dwFeatureArray_destroy()
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwFeatureHistoryArray_reset()

DW_API_PUBLIC dwStatus dwFeatureHistoryArray_reset ( dwFeatureHistoryArray featureHistoryArray,
cudaStream_t  stream 
)

Resets the feature history array.

Sets the feature count back to zero.

Parameters
[in]featureHistoryArrayfeature history array to be reset.
[in]streamCUDA stream used to reset the feature history array
Returns
DW_INVALID_ARGUMENT if featureHistoryArray.featureCount is NULL.
DW_SUCCESS otherwise.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes