DriveWorks SDK Reference

| 0.6.67 Release

Features.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2015-2016 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
45 #ifndef DW_FEATURES_FEATURES_H__
46 #define DW_FEATURES_FEATURES_H__
47 
48 #include <dw/core/Config.h>
49 #include <dw/core/Exports.h>
50 #include <dw/core/Context.h>
51 #include <dw/core/Types.h>
52 #include <dw/image/Image.h>
53 
54 #include <stdint.h>
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
61 typedef struct dwFeatureListObject *dwFeatureListHandle_t;
62 
64 typedef struct dwFeatureListObject const *dwConstFeatureListHandle_t;
65 
67 typedef struct dwFeatureTrackerObject *dwFeatureTrackerHandle_t;
68 
70 typedef struct dwFeatureTrackerObject const *dwConstFeaturesTrackerHandle_t;
71 
73 typedef struct dwPyramidObject *dwPyramidHandle_t;
74 
76 typedef struct dwPyramidObject const *dwConstPyramidHandle_t;
77 
88 typedef enum dwFeatureStatus {
93 
98 
103 
106 
143 typedef struct dwFeatureListPointers {
144  dwFeatureStatus *statuses;
145  uint32_t *ages;
147  uint32_t *featureCount;
149 
150 
152 // dwFeatureList
153 
171 dwStatus dwFeatureList_initialize(dwFeatureListHandle_t *obj, dwContextHandle_t context, cudaStream_t stream,
172  const uint32_t maxFeatureCount, const uint32_t historyCapacity,
173  const uint32_t imageWidth, uint32_t imageHeight);
174 
186 dwStatus dwFeatureList_reset(dwFeatureListHandle_t obj);
187 
201 dwStatus dwFeatureList_release(dwFeatureListHandle_t *obj);
202 
216 dwStatus dwFeatureList_getDataBasePointer(void **d_basePointer, size_t *size, dwFeatureListHandle_t obj);
217 
231 dwStatus dwFeatureList_getDataPointers(dwFeatureListPointers *pointers, void *basePointer, dwFeatureListHandle_t obj);
232 
248 dwStatus dwFeatureList_getCurrentTimeIdx(uint32_t *currentTimeIdx, dwFeatureListHandle_t obj);
249 
263 dwStatus dwFeatureList_setCurrentTimeIdx(uint32_t currentTimeIdx, dwFeatureListHandle_t obj);
264 
276 dwStatus dwFeatureList_getFeatureListSize(uint32_t *maxFeatureCount, uint32_t *historyCapacity, dwFeatureListHandle_t obj);
277 
293 dwStatus dwFeatureList_selectValid(uint32_t *d_validIndexCount, uint32_t *d_validIndexes,
294  uint32_t *d_invalidIndexCount, uint32_t *d_invalidIndexes,
295  dwConstFeatureListHandle_t obj);
296 
313 dwStatus dwFeatureList_compact(dwFeatureListHandle_t featureList,
314  const uint32_t *d_validIndexCount, const uint32_t *d_validIndexes,
315  const uint32_t *d_invalidIndexCount, const uint32_t *d_invalidIndexes);
316 
326 dwStatus dwFeatureList_proximityFilter(dwFeatureListHandle_t list);
327 
340 dwStatus dwFeatureList_setCUDAStream(cudaStream_t stream, dwFeatureListHandle_t obj);
341 
352 dwStatus dwFeatureList_getCUDAStream(cudaStream_t *stream, dwFeatureListHandle_t obj);
353 
354 
364 // dwPyramid
366 
370 typedef struct dwPyramidConfig {
372  uint32_t width;
373 
375  uint32_t height;
376 
378  uint32_t levelCount;
379 
383 
398 dwStatus dwPyramid_initialize(dwPyramidHandle_t *obj, dwContextHandle_t context, cudaStream_t stream,
399  const dwPyramidConfig config);
400 
410 dwStatus dwPyramid_reset(dwPyramidHandle_t obj);
411 
425 dwStatus dwPyramid_release(dwPyramidHandle_t *obj);
426 
438 dwStatus dwPyramid_build(const dwImageCUDA *image, dwPyramidHandle_t obj);
439 
451 dwStatus dwPyramid_getLevelCount(uint32_t *levelCount, dwConstPyramidHandle_t obj);
452 
466 dwStatus dwPyramid_getLevelSize(uint32_t *width, uint32_t *height,
467  const uint32_t level, dwConstPyramidHandle_t obj);
468 
482 dwStatus dwPyramid_getLevelData(uint8_t **d_data, size_t *strideBytes, const uint32_t level,
483  dwPyramidHandle_t obj);
484 
497 dwStatus dwPyramid_getLevelImageCUDA(const dwImageCUDA **img, const uint32_t level,
498  dwConstPyramidHandle_t obj);
499 
512 dwStatus dwPyramid_setCUDAStream(cudaStream_t stream, dwPyramidHandle_t obj);
513 
524 dwStatus dwPyramid_getCUDAStream(cudaStream_t *stream, dwConstPyramidHandle_t obj);
525 
535 // dwFeaturesTracker
537 
541 typedef struct dwFeatureTrackerConfig {
542  /* Width of the images that the tracker runs on. */
543  uint32_t imageWidth;
544 
545  /* Height of the images that the tracker runs on. */
546  uint32_t imageHeight;
547 
549  uint32_t windowSizeLK;
550 
552  uint32_t interationsLK;
553 
555  uint32_t maxFeatureCount;
556 
560 
573 dwStatus dwFeatureTracker_initialize(dwFeatureTrackerHandle_t *obj, dwContextHandle_t context,
574  cudaStream_t stream, const dwFeatureTrackerConfig config);
575 
585 dwStatus dwFeatureTracker_reset(dwFeatureTrackerHandle_t obj);
586 
600 dwStatus dwFeatureTracker_release(dwFeatureTrackerHandle_t *obj);
601 
616 dwStatus dwFeatureTracker_setMask(const uint8_t *d_mask,
617  const uint32_t maskStrideBytes,
618  const uint32_t maskWidth, const uint32_t maskHeight,
619  dwFeatureTrackerHandle_t obj);
620 
633 dwStatus dwFeatureTracker_detectNewFeatures(dwFeatureListHandle_t list,
634  dwConstPyramidHandle_t pyramid,
635  dwFeatureTrackerHandle_t obj);
636 
654 dwStatus dwFeatureTracker_trackFeatures(dwFeatureListHandle_t list,
655  dwConstPyramidHandle_t previousPyramid,
656  dwConstPyramidHandle_t currentPyramid,
657  const float32_t *d_predictedPositions,
658  dwFeatureTrackerHandle_t obj);
659 
672 dwStatus dwFeatureTracker_setCUDAStream(cudaStream_t stream, dwFeatureTrackerHandle_t obj);
673 
684 dwStatus dwFeatureTracker_getCUDAStream(cudaStream_t *stream, dwFeatureTrackerHandle_t obj);
685 
686 
687 #ifdef __cplusplus
688 }
689 #endif
690 
692 #endif // DW_FEATURES_FEATURES_H__
uint32_t interationsLK
Upper bound on number of Lucas-Kanade iterations per level.
Definition: Features.h:552
DW_API_PUBLIC dwStatus dwFeatureTracker_setMask(const uint8_t *d_mask, const uint32_t maskStrideBytes, const uint32_t maskWidth, const uint32_t maskHeight, dwFeatureTrackerHandle_t obj)
Sets a mask to ignore areas of the image.
NVIDIA DriveWorks API: Core Types
float float32_t
Specifies POD types.
Definition: Types.h:77
dwFeatureStatus
Defines the possible status of a feature.
Definition: Features.h:88
dwTrivialDataType
Specifies a type indicator of the underlying trivial data type.
Definition: Types.h:104
DW_API_PUBLIC dwStatus dwFeatureList_getDataBasePointer(void **d_basePointer, size_t *size, dwFeatureListHandle_t obj)
Returns the start position of the data buffer that stores all of the feature list information (in GPU...
uint32_t width
Width of level 0.
Definition: Features.h:372
DW_API_PUBLIC dwStatus dwPyramid_getCUDAStream(cudaStream_t *stream, dwConstPyramidHandle_t obj)
Gets the CUDA stream used by the pyramid.
struct dwFeatureTrackerObject const * dwConstFeaturesTrackerHandle_t
Handle representing a const feature tracker.
Definition: Features.h:70
Defines a two-element floating-point vector.
Definition: Types.h:207
uint32_t maxFeatureCount
Upper bound on number of features handled.
Definition: Features.h:555
DW_API_PUBLIC dwStatus dwFeatureTracker_initialize(dwFeatureTrackerHandle_t *obj, dwContextHandle_t context, cudaStream_t stream, const dwFeatureTrackerConfig config)
Creates and initializes a feature tracker.
struct dwFeatureListObject * dwFeatureListHandle_t
Handle representing a list of 2D features.
Definition: Features.h:61
DW_API_PUBLIC dwStatus dwFeatureTracker_release(dwFeatureTrackerHandle_t *obj)
Releases the feature tracker.
Defines a CUDA image.
Definition: Image.h:263
DW_API_PUBLIC dwStatus dwPyramid_initialize(dwPyramidHandle_t *obj, dwContextHandle_t context, cudaStream_t stream, const dwPyramidConfig config)
Creates and initializes an image pyramid.
NVIDIA DriveWorks API: Core Methods
DW_API_PUBLIC dwStatus dwFeatureList_setCurrentTimeIdx(uint32_t currentTimeIdx, dwFeatureListHandle_t obj)
Sets the current time index of the feature-history circular buffer.
Holds the configuration parameters for a pyramid.
Definition: Features.h:370
struct dwFeatureListObject const * dwConstFeatureListHandle_t
Handle representing a const list of 2D features.
Definition: Features.h:64
DW_API_PUBLIC dwStatus dwPyramid_reset(dwPyramidHandle_t obj)
Resets a pyramid.
DW_API_PUBLIC dwStatus dwFeatureList_initialize(dwFeatureListHandle_t *obj, dwContextHandle_t context, cudaStream_t stream, const uint32_t maxFeatureCount, const uint32_t historyCapacity, const uint32_t imageWidth, uint32_t imageHeight)
Creates and initializes a feature list.
DW_API_PUBLIC dwStatus dwPyramid_getLevelSize(uint32_t *width, uint32_t *height, const uint32_t level, dwConstPyramidHandle_t obj)
Gets the size of a level in the pyramid.
NVIDIA DriveWorks API: Core Exports
dwTrivialDataType dataType
Data Type of pyramid.
Definition: Features.h:381
uint32_t height
Height of level 0.
Definition: Features.h:375
NVIDIA DriveWorks API: Image Conversion and Streaming Functionality
The feature was succesfully tracked in the current frame.
Definition: Features.h:102
DW_API_PUBLIC dwStatus dwFeatureList_proximityFilter(dwFeatureListHandle_t list)
Invalidates features that are too close to each other.
dwStatus
Status definition.
Definition: Status.h:167
DW_API_PUBLIC dwStatus dwFeatureList_getFeatureListSize(uint32_t *maxFeatureCount, uint32_t *historyCapacity, dwFeatureListHandle_t obj)
Returns the maximum feature count and history capacity of the feature list.
Holds configuration parameters for a feature tracker.
Definition: Features.h:541
DW_API_PUBLIC dwStatus dwPyramid_setCUDAStream(cudaStream_t stream, dwPyramidHandle_t obj)
Sets the CUDA stream for CUDA related operations.
DW_API_PUBLIC dwStatus dwFeatureTracker_setCUDAStream(cudaStream_t stream, dwFeatureTrackerHandle_t obj)
Sets the CUDA stream for CUDA related operations.
uint32_t levelCount
Number of levels in the pyramid.
Definition: Features.h:378
uint32_t * ages
Age of each feature.
Definition: Features.h:145
A feature with this entry is garbage.
Definition: Features.h:92
struct dwFeatureTrackerObject * dwFeatureTrackerHandle_t
Handle representing a feature tracker.
Definition: Features.h:67
DW_API_PUBLIC dwStatus dwFeatureList_reset(dwFeatureListHandle_t obj)
Resets the feature list.
The feature was just detected in the current frame.
Definition: Features.h:97
DW_API_PUBLIC dwStatus dwFeatureTracker_reset(dwFeatureTrackerHandle_t obj)
Resets a feature tracker.
struct dwPyramidObject const * dwConstPyramidHandle_t
Handle representing a const image pyramid.
Definition: Features.h:76
float32_t detectorScoreThreshold
Higher thresholds detect less features.
Definition: Features.h:558
DW_API_PUBLIC dwStatus dwFeatureList_release(dwFeatureListHandle_t *obj)
Releases the feature list.
DW_API_PUBLIC dwStatus dwPyramid_getLevelData(uint8_t **d_data, size_t *strideBytes, const uint32_t level, dwPyramidHandle_t obj)
Gets the data of a level in the pyramid.
DW_API_PUBLIC dwStatus dwFeatureList_getCurrentTimeIdx(uint32_t *currentTimeIdx, dwFeatureListHandle_t obj)
Returns the current time index of feature-history circular buffer.
DW_API_PUBLIC dwStatus dwFeatureTracker_trackFeatures(dwFeatureListHandle_t list, dwConstPyramidHandle_t previousPyramid, dwConstPyramidHandle_t currentPyramid, const float32_t *d_predictedPositions, dwFeatureTrackerHandle_t obj)
Tracks features from the internal list between the previous and current images.
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:78
DW_API_PUBLIC dwStatus dwFeatureList_setCUDAStream(cudaStream_t stream, dwFeatureListHandle_t obj)
Sets the CUDA stream for CUDA related operations.
dwVector2f * locationHistory
Location history of feature points.
Definition: Features.h:146
DW_API_PUBLIC dwStatus dwFeatureList_compact(dwFeatureListHandle_t featureList, const uint32_t *d_validIndexCount, const uint32_t *d_validIndexes, const uint32_t *d_invalidIndexCount, const uint32_t *d_invalidIndexes)
Removes features from the list.
uint32_t * featureCount
Total number of feature points.
Definition: Features.h:147
DW_API_PUBLIC dwStatus dwFeatureTracker_detectNewFeatures(dwFeatureListHandle_t list, dwConstPyramidHandle_t pyramid, dwFeatureTrackerHandle_t obj)
Detects new features and adds them to the feature list.
DW_API_PUBLIC dwStatus dwPyramid_build(const dwImageCUDA *image, dwPyramidHandle_t obj)
Builds the pyramid from the level 0 image.
DW_API_PUBLIC dwStatus dwPyramid_getLevelImageCUDA(const dwImageCUDA **img, const uint32_t level, dwConstPyramidHandle_t obj)
Gets the data of a level in the const pyramid as a dwImageCUDA.
DW_API_PUBLIC dwStatus dwFeatureList_getDataPointers(dwFeatureListPointers *pointers, void *basePointer, dwFeatureListHandle_t obj)
Returns the pointers to the actual data of a feature list given the base pointer. ...
Holds pointers to the data exposed by a feature list.
Definition: Features.h:143
DW_API_PUBLIC dwStatus dwFeatureTracker_getCUDAStream(cudaStream_t *stream, dwFeatureTrackerHandle_t obj)
Gets the CUDA stream used by the feature tracker.
struct dwPyramidObject * dwPyramidHandle_t
Handle representing an image pyramid.
Definition: Features.h:73
dwFeatureStatus * statuses
Status of each feature.
Definition: Features.h:144
DW_API_PUBLIC dwStatus dwPyramid_getLevelCount(uint32_t *levelCount, dwConstPyramidHandle_t obj)
Gets the number of levels in the pyramid.
DW_API_PUBLIC dwStatus dwPyramid_release(dwPyramidHandle_t *obj)
Releases the pyramid.
DW_API_PUBLIC dwStatus dwFeatureList_getCUDAStream(cudaStream_t *stream, dwFeatureListHandle_t obj)
Gets the CUDA stream used by the feature list.
#define DW_API_PUBLIC
Definition: Exports.h:76
DW_API_PUBLIC dwStatus dwFeatureList_selectValid(uint32_t *d_validIndexCount, uint32_t *d_validIndexes, uint32_t *d_invalidIndexCount, uint32_t *d_invalidIndexes, dwConstFeatureListHandle_t obj)
Creates a list of indexes of those features with a status of detected or tracked, and list of indexes...
uint32_t windowSizeLK
Window size used in the Lucas-Kanade tracker.
Definition: Features.h:549