NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
TemplateTracker.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
28 #ifndef DW_IMAGEPROCESSING_TRACKING_TEMPLATETRACKER_TEMPLATETRACKER_H_
29 #define DW_IMAGEPROCESSING_TRACKING_TEMPLATETRACKER_TEMPLATETRACKER_H_
30 
31 // C api
32 #include <dw/core/base/Config.h>
33 #include <dw/core/context/Context.h>
34 #include <dw/core/base/Types.h>
35 #include <dw/image/Image.h>
36 #include <dw/imageprocessing/features/FeatureList.h>
37 #include <dw/imageprocessing/pyramid/Pyramid.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
94 typedef struct dwTemplateTrackerObject* dwTemplateTrackerHandle_t;
95 
97 typedef struct dwTemplateTrackerObject const* dwConstTemplateTrackerHandle_t;
98 
106 
109 {
112 
115 
117  uint32_t maxPyramidLevel;
118 
121  uint32_t maxTemplateSize;
122 
125  uint32_t minTemplateSize;
126 
128  uint32_t imageWidth;
129 
131  uint32_t imageHeight;
132 
135 
142 
150 
156 
164 
168 
173 
178 
186 
187 typedef struct dwTemplateArray
188 {
191  uint32_t* ids;
192  uint32_t* ages;
194  uint32_t* newToOldMap;
196  uint32_t* templateCount;
197  uint32_t maxTemplates;
199  uint8_t* data;
200  size_t bytes;
205 
207 
227 DW_DEPRECATED("WARNING: will be removed in the next major release, use dwTemplateArray_createNew instead")
229  const uint32_t maxTemplateCount,
230  const dwMemoryType memoryType,
231  dwContextHandle_t context);
232 
255  const uint32_t maxTemplateCount,
256  const dwMemoryType memoryType,
257  cudaStream_t stream,
258  dwContextHandle_t context);
259 
275 
292 dwStatus dwTemplateArray_reset(dwTemplateArray* templateArray, cudaStream_t stream);
293 
313  const dwTemplateArray* srcTemplateArray,
314  cudaStream_t stream);
327 
345  cudaStream_t stream, dwContextHandle_t context);
346 
359 
374 
387 dwStatus dwTemplateTracker_setCUDAStream(cudaStream_t cudaStream,
389 
402 dwStatus dwTemplateTracker_getCUDAStream(cudaStream_t* cudaStream,
404 
431  const dwImageCUDA* currentImage,
432  const dwImageCUDA* previousImage,
434 
461  const dwPyramidImage* currentPyramid,
462  const dwPyramidImage* previousPyramid,
464 
465 #ifdef __cplusplus
466 }
467 #endif
468 
469 #endif // DW_IMAGEPROCESSING_TRACKING_TEMPLATETRACKER_TEMPLATETRACKER_H_
dwTemplateTracker_setCUDAStream
DW_API_PUBLIC dwStatus dwTemplateTracker_setCUDAStream(cudaStream_t cudaStream, dwTemplateTrackerHandle_t obj)
Sets the CUDA stream used.
dwTemplateTrackerParameters::numIterationsFine
uint32_t numIterationsFine
Iteration number to apply the KLT tracker.
Definition: TemplateTracker.h:134
dwTemplateTrackerParameters::maxTemplateSize
uint32_t maxTemplateSize
Maximum size of templates to track, if ROI > maxTemplateSize * maxTemplateSize, template tracker will...
Definition: TemplateTracker.h:121
dwTemplateTracker_reset
DW_API_PUBLIC dwStatus dwTemplateTracker_reset(dwTemplateTrackerHandle_t obj)
Resets the TemplateTracker.
dwTemplateTrackerParameters::maxPyramidLevel
uint32_t maxPyramidLevel
Max pyramid level to track.
Definition: TemplateTracker.h:117
dwPyramidImage
Pyramid image structure.
Definition: Pyramid_1.h:47
dwTemplateArray::memoryType
dwMemoryType memoryType
Whether the template array is located on CPU or GPU.
Definition: TemplateTracker.h:202
dwRectf
Defines a rectangle with floating point numbers.
Definition: GeometricTypes.h:67
dwTemplateTracker_trackImage
DW_API_PUBLIC dwStatus dwTemplateTracker_trackImage(dwTemplateArray *templateArray, const dwImageCUDA *currentImage, const dwImageCUDA *previousImage, dwTemplateTrackerHandle_t obj)
Track the templates in currentImage .
dwTemplateArray::newToOldMap
uint32_t * newToOldMap
New to old index map, 1D array of size maxTemplates.
Definition: TemplateTracker.h:194
dwTemplateArray::maxTemplates
uint32_t maxTemplates
Max number of templates in template array.
Definition: TemplateTracker.h:197
DW_TEMPLATE_TRACKER_ALGORITHM_IA
@ DW_TEMPLATE_TRACKER_ALGORITHM_IA
inverse additive KLT
Definition: TemplateTracker.h:103
dwTemplateTrackerParameters::maxScaleChange
float32_t maxScaleChange
If scalingFactor between frame N to N-1 is outside range [1/maxScaleChange, maxScaleChange] tracking ...
Definition: TemplateTracker.h:167
dwTemplateArray::statuses
dwFeature2DStatus * statuses
Status of each template.
Definition: TemplateTracker.h:189
dwTemplateTracker_getCUDAStream
DW_API_PUBLIC dwStatus dwTemplateTracker_getCUDAStream(cudaStream_t *cudaStream, dwTemplateTrackerHandle_t obj)
Gets the CUDA stream used.
dwTemplateTracker_initDefaultParams
DW_API_PUBLIC dwStatus dwTemplateTracker_initDefaultParams(dwTemplateTrackerParameters *params)
Initializes TemplateTracker parameters with default values.
dwTemplateTrackerParameters::validWidth
float32_t validWidth
Maximum valid template width, any templates with bbox.width > validWidth will be killed after trackin...
Definition: TemplateTracker.h:172
dwProcessorType
dwProcessorType
Processor type definitions.
Definition: TypesExtra.h:116
dwTemplateArray_destroy
DW_API_PUBLIC dwStatus dwTemplateArray_destroy(dwTemplateArray templateArray)
Destroys the template array and frees any memory created by dwTemplateArray_createNew().
dwImageCUDA
Defines a CUDA image.
Definition: Image.h:508
dwTemplateArray::data
uint8_t * data
Pointer to the raw data address.
Definition: TemplateTracker.h:199
float32_t
float float32_t
Specifies POD types.
Definition: BasicTypes.h:41
dwConstTemplateTrackerHandle_t
struct dwTemplateTrackerObject const * dwConstTemplateTrackerHandle_t
Handle representing a const TemplateTracker tracker.
Definition: TemplateTracker.h:97
dwTemplateArray_copyAsync
DW_API_PUBLIC dwStatus dwTemplateArray_copyAsync(dwTemplateArray *dstTemplateArray, const dwTemplateArray *srcTemplateArray, cudaStream_t stream)
Deep copy all contents from srcTemplateArray to dstTemplateArray
dwTemplateTrackerParameters::maxTemplateCount
uint32_t maxTemplateCount
Upper bound on number of templates handled.
Definition: TemplateTracker.h:114
dwTemplateTracker_initialize
DW_API_PUBLIC dwStatus dwTemplateTracker_initialize(dwTemplateTrackerHandle_t *obj, const dwTemplateTrackerParameters *params, cudaStream_t stream, dwContextHandle_t context)
Initialize the TemplateTracker module.
dwTemplateTrackerParameters::imageHeight
uint32_t imageHeight
Height of the images that the tracker runs on.
Definition: TemplateTracker.h:131
dwTemplateArray_create
DW_API_PUBLIC dwStatus dwTemplateArray_create(dwTemplateArray *templateArray, const uint32_t maxTemplateCount, const dwMemoryType memoryType, dwContextHandle_t context)
Creates and initializes a template array.
dwTemplateTrackerParameters::thresholdUpdate
float32_t thresholdUpdate
Updating threshold in [0, 1].
Definition: TemplateTracker.h:149
dwTemplateArray
Definition: TemplateTracker.h:187
dwTemplateArray::templateCount
uint32_t * templateCount
Total number of templates.
Definition: TemplateTracker.h:196
DW_DEPRECATED
#define DW_DEPRECATED(msg)
Definition: Exports.h:50
dwTemplateTracker_release
DW_API_PUBLIC dwStatus dwTemplateTracker_release(dwTemplateTrackerHandle_t obj)
Releases the TemplateTracker module.
dwTemplateTrackerParameters::imageWidth
uint32_t imageWidth
Width of the images that the tracker runs on.
Definition: TemplateTracker.h:128
dwTemplateTrackerParameters::thresholdKill
float32_t thresholdKill
Killing threshold in [0, 1].
Definition: TemplateTracker.h:155
dwTemplateArray_createNew
DW_API_PUBLIC dwStatus dwTemplateArray_createNew(dwTemplateArray *templateArray, const uint32_t maxTemplateCount, const dwMemoryType memoryType, cudaStream_t stream, dwContextHandle_t context)
Creates and initializes a template array.
dwTemplateArray
struct dwTemplateArray dwTemplateArray
dwTemplateArray::ids
uint32_t * ids
Id of each template.
Definition: TemplateTracker.h:191
dwTemplateArray_reset
DW_API_PUBLIC dwStatus dwTemplateArray_reset(dwTemplateArray *templateArray, cudaStream_t stream)
Resets the template array.
dwMemoryType
dwMemoryType
Memory type definitions.
Definition: TypesExtra.h:142
dwFeature2DStatus
dwFeature2DStatus
Defines the feature array used by detector and tracker.
Definition: FeatureList.h:52
dwContextHandle_t
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:74
dwTemplateTrackerParameters
struct dwTemplateTrackerParameters dwTemplateTrackerParameters
Configuration parameters for a dwTemplateTrackerIA.
dwTemplateTrackerParameters
Configuration parameters for a dwTemplateTrackerIA.
Definition: TemplateTracker.h:108
dwTemplateTrackerParameters::thresholdStop
float32_t thresholdStop
for DW_TEMPLATE_TRACKER_ALGO_IC only Stop threshold in [-1, 1].
Definition: TemplateTracker.h:163
dwTemplateTrackerParameters::processorType
dwProcessorType processorType
Processor type which determines on which processor the algorithm should be executed on.
Definition: TemplateTracker.h:184
dwTemplateTrackerParameters::validHeight
float32_t validHeight
Maximum valid template height, any templates with bbox.height > validHeight will be killed after trac...
Definition: TemplateTracker.h:177
dwStatus
dwStatus
Status definition.
Definition: ErrorDefs.h:27
dwTemplateArray::bboxes
dwRectf * bboxes
bounding box of each template.
Definition: TemplateTracker.h:190
dwTemplateTrackerAlgorithm
dwTemplateTrackerAlgorithm
Different versions of the template tracker Both can be found in paper: "Lucas-Kanade 20 Years On: A U...
Definition: TemplateTracker.h:102
dwTemplateTrackerParameters::numIterationsCoarse
uint32_t numIterationsCoarse
for DW_TEMPLATE_TRACKER_ALGO_IA only Iteration number to apply the coarse KLT for robustness.
Definition: TemplateTracker.h:141
params
DW_API_PUBLIC dwPointCloudRangeImageCreatorParams const *const params
Definition: PointCloudRangeImageCreator.h:292
DW_API_PUBLIC
#define DW_API_PUBLIC
Definition: Exports.h:38
dwTemplateTrackerHandle_t
struct dwTemplateTrackerObject * dwTemplateTrackerHandle_t
Handle representing a TemplateTracker tracker.
Definition: TemplateTracker.h:94
obj
const NvSciSyncObj *const obj
Definition: wfdext.h:120
dwTemplateArray::scaleFactors
float32_t * scaleFactors
scaleFactor from frame N to N-1 of each template.
Definition: TemplateTracker.h:193
DW_TEMPLATE_TRACKER_ALGORITHM_IC
@ DW_TEMPLATE_TRACKER_ALGORITHM_IC
inverse compositional KLT.
Definition: TemplateTracker.h:104
dwTemplateTrackerParameters::minTemplateSize
uint32_t minTemplateSize
Minimum size of templates to track, if ROI < minTemplateSize * minTemplateSize, template tracker will...
Definition: TemplateTracker.h:125
dwTemplateTracker_trackPyramid
DW_API_PUBLIC dwStatus dwTemplateTracker_trackPyramid(dwTemplateArray *templateArray, const dwPyramidImage *currentPyramid, const dwPyramidImage *previousPyramid, dwTemplateTrackerHandle_t obj)
Track the templates in currentPyramid .
dwTemplateArray::bytes
size_t bytes
Bytes of raw data.
Definition: TemplateTracker.h:200
dwTemplateTrackerParameters::algorithm
dwTemplateTrackerAlgorithm algorithm
Tracking Algorithm defined by dwTemplateTrackerAlgorithm.
Definition: TemplateTracker.h:111
dwTemplateArray::ages
uint32_t * ages
Age of each template.
Definition: TemplateTracker.h:192