NVIDIA DeepStream SDK API Reference

6.2 Release
nvdstracker.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA Corporation and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA Corporation is strictly prohibited.
9  *
10  */
11 
28 #ifndef _NVMOTRACKER_H_
29 #define _NVMOTRACKER_H_
30 
31 #include <stdint.h>
32 #include <time.h>
33 
34 #include "nvbufsurface.h"
35 #include "nvds_tracker_meta.h"
36 
37 #ifdef __cplusplus
38 extern "C"
39 {
40 #endif
41 
42 #define NVMOT_MAX_TRANSFORMS 4
43 
44 typedef uint64_t NvMOTStreamId;
45 
52 #define NVMOTCOMP_GPU 0x01
53 #define NVMOTCOMP_CPU 0x02
54 #define NVMOTCOMP_PVA 0x04
55 #define NVMOTCOMP_ANY 0xff
57 #define NVMOTCOMP_DEFAULT NVMOTCOMP_ANY
58 
62 typedef uint8_t NvMOTCompute;
63 
69 {
73  uint32_t maxWidth;
75  uint32_t maxHeight;
77  uint32_t maxPitch;
79  uint32_t maxSize;
81  uint32_t colorFormat;
83 
84 
88 typedef struct _NvMOTMiscConfig
89 {
91  uint32_t gpuId;
94  uint32_t maxObjPerStream;
97  uint32_t maxObjPerBatch;
99  typedef void (*logMsg) (int logLevel, const char * format, ...);
101 
110 typedef struct _NvMOTConfig
111 {
115  uint32_t maxStreams;
120  uint8_t numTransforms;
131 } NvMOTConfig;
132 
136 typedef enum
137 {
143 
150 typedef struct _NvMOTConfigResponse
151 {
164 
168 typedef enum
169 {
173 } NvMOTStatus;
174 
178 typedef enum
179 {
189 
193 typedef struct _NvMOTRect
194 {
196  float x;
198  float y;
200  float width;
202  float height;
203 } NvMOTRect;
204 
210 typedef struct _NvMOTObjToTrack
211 {
213  uint16_t classId;
217  float confidence;
223 
227 typedef struct _NvMOTObjToTrackList
228 {
235  uint32_t numAllocated;
237  uint32_t numFilled;
239 
249 typedef struct _NvMOTFrame
250 {
255  uint32_t frameNum;
257  uint32_t srcFrameWidth;
259  uint32_t srcFrameHeight;
261  time_t timeStamp;
269  bool reset;
271  uint8_t numBuffers;
278 } NvMOTFrame;
279 
283 typedef struct _NvMOTTrackedObj
284 {
286  uint16_t classId;
288  uint64_t trackingId;
292  float confidence;
294  uint32_t age;
297  uint8_t reserved[128];
299 
303 typedef struct _NvMOTTrackedObjList
304 {
308  uint32_t frameNum;
310  bool valid;
314  uint32_t numAllocated;
316  uint32_t numFilled;
318 
322 typedef struct _NvMOTTrackedObjBatch
323 {
327  uint32_t numAllocated;
329  uint32_t numFilled;
331 
337 typedef struct _NvMOTProcessParams
338 {
339  uint32_t numFrames;
342 
343 typedef struct _NvMOTQuery
344 {
349  uint8_t numTransforms;
358 } NvMOTQuery;
359 
363 struct NvMOTContext;
364 typedef struct NvMOTContext* NvMOTContextHandle;
365 
384  NvMOTContextHandle *pContextHandle,
385  NvMOTConfigResponse *pConfigResponse);
386 
394 void NvMOT_DeInit(NvMOTContextHandle contextHandle);
395 
415  NvMOTProcessParams *pParams,
416  NvMOTTrackedObjBatch *pTrackedObjectsBatch);
417 
431  NvMOTProcessParams *pParams,
432  NvDsPastFrameObjBatch *pPastFrameObjBatch);
447 NvMOTStatus NvMOT_Query(uint16_t customConfigFilePathSize, char* pCustomConfigFilePath, NvMOTQuery *pQuery);
448 
449 
467  // end of API group
469 
470 #ifdef __cplusplus
471 }
472 #endif
473 
474 #endif
_NvMOTPerTransformBatchConfig
Holds a configuration for batches for an input transform (a scaling/color conversion).
Definition: nvdstracker.h:68
_NvMOTFrame::bufferList
NvBufSurfaceParams ** bufferList
Holds a pointer to an array of pointers to buffer parameter structures.
Definition: nvdstracker.h:274
_NvMOTMiscConfig::logMsg
void(* logMsg)(int logLevel, const char *format,...)
Holds a pointer to a callback for logging messages.
Definition: nvdstracker.h:99
_NvMOTObjToTrack::classId
uint16_t classId
Holds the class of the object.
Definition: nvdstracker.h:213
_NvMOTPerTransformBatchConfig::maxPitch
uint32_t maxPitch
Holds the maximum pitch of each buffer.
Definition: nvdstracker.h:77
NvMOTTrackedObj
struct _NvMOTTrackedObj NvMOTTrackedObj
Holds information about each tracked object.
_NvMOTTrackedObj::reserved
uint8_t reserved[128]
Definition: nvdstracker.h:297
NvMOTStatus_Invalid_Path
@ NvMOTStatus_Invalid_Path
Definition: nvdstracker.h:172
_NvMOTQuery::supportPastFrame
bool supportPastFrame
Holds a Boolean which is true if outputing past frame is supported.
Definition: nvdstracker.h:357
_NvMOTObjToTrack::pPreservedData
void * pPreservedData
Holds a pointer to client data associated with the object.
Definition: nvdstracker.h:221
NvMOT_Init
NvMOTStatus NvMOT_Init(NvMOTConfig *pConfigIn, NvMOTContextHandle *pContextHandle, NvMOTConfigResponse *pConfigResponse)
Initializes a tracking context for a batch of one or more image streams.
_NvMOTQuery::batchMode
NvMOTBatchMode batchMode
Holds flags for whether batch or none batch mode is supported.
Definition: nvdstracker.h:355
NvMOTConfigStatus_Invalid
@ NvMOTConfigStatus_Invalid
Definition: nvdstracker.h:140
NvMOTConfig
struct _NvMOTConfig NvMOTConfig
Holds a tracker configuration.
_NvMOTObjToTrack::confidence
float confidence
Holds the detection confidence of the object.
Definition: nvdstracker.h:217
NvMOTTrackedObjBatch
struct _NvMOTTrackedObjBatch NvMOTTrackedObjBatch
Holds a batch of lists of tracked objects.
_NvMOTConfigResponse::customConfigStatus
NvMOTConfigStatus customConfigStatus
Holds the status of the custom configurations.
Definition: nvdstracker.h:162
_NvMOTMiscConfig::gpuId
uint32_t gpuId
Holds the ID of the GPU to be used.
Definition: nvdstracker.h:91
NvMOTMiscConfig
struct _NvMOTMiscConfig NvMOTMiscConfig
Holds miscellaneous configurations.
_NvMOTQuery::numTransforms
uint8_t numTransforms
Holds the number of NvMOTPerTransformBatchConfig entries in perTransformBatchConfig.
Definition: nvdstracker.h:349
NvMOTBatchMode_NonBatch
@ NvMOTBatchMode_NonBatch
Non-batch processing mode.
Definition: nvdstracker.h:185
_NvMOTConfigResponse::summaryStatus
NvMOTConfigStatus summaryStatus
Holds the summary status of the entire configuration request.
Definition: nvdstracker.h:153
_NvMOTTrackedObjBatch
Holds a batch of lists of tracked objects.
Definition: nvdstracker.h:322
_NvMOTObjToTrackList::numFilled
uint32_t numFilled
Holds the number of populated blocks in the list.
Definition: nvdstracker.h:237
_NvMOTPerTransformBatchConfig::maxHeight
uint32_t maxHeight
Holds the maximum height of each frame.
Definition: nvdstracker.h:75
_NvMOTTrackedObjList::numAllocated
uint32_t numAllocated
Holds the number of blocks allocated for the list.
Definition: nvdstracker.h:314
_NvMOTTrackedObj::associatedObjectIn
NvMOTObjToTrack * associatedObjectIn
Holds a pointer to the associated input object, if there is one.
Definition: nvdstracker.h:296
NvMOTFrame
struct _NvMOTFrame NvMOTFrame
Holds a frame containing the image and objects to be tracked.
_NvMOTProcessParams::numFrames
uint32_t numFrames
Holds the number of frames in the batch.
Definition: nvdstracker.h:339
_NvMOTTrackedObj::classId
uint16_t classId
Holds the class ID of the object to be tracked.
Definition: nvdstracker.h:286
_NvMOTTrackedObjList::list
NvMOTTrackedObj * list
Holds a pointer to a list or array of object information blocks.
Definition: nvdstracker.h:312
NvMOT_DeInit
void NvMOT_DeInit(NvMOTContextHandle contextHandle)
Deinitializes a stream context.
_NvMOTRect
Holds the definition of a rectangle.
Definition: nvdstracker.h:193
_NvMOTFrame
Holds a frame containing the image and objects to be tracked.
Definition: nvdstracker.h:249
NvMOT_ProcessPast
NvMOTStatus NvMOT_ProcessPast(NvMOTContextHandle contextHandle, NvMOTProcessParams *pParams, NvDsPastFrameObjBatch *pPastFrameObjBatch)
Process the past-frame data in the low-level tracker lib and retrieve.
_NvMOTFrame::frameNum
uint32_t frameNum
Holds the sequential frame number that identifies the frame within the stream.
Definition: nvdstracker.h:255
_NvMOTTrackedObj::bbox
NvMOTRect bbox
Holds the bounding box.
Definition: nvdstracker.h:290
NVMOT_MAX_TRANSFORMS
#define NVMOT_MAX_TRANSFORMS
Definition: nvdstracker.h:42
NvMOT_RemoveStreams
NvMOTStatus NvMOT_RemoveStreams(NvMOTContextHandle contextHandle, NvMOTStreamId streamIdMask)
Removes streams from a batch.
NvMOTPerTransformBatchConfig
struct _NvMOTPerTransformBatchConfig NvMOTPerTransformBatchConfig
Holds a configuration for batches for an input transform (a scaling/color conversion).
_NvMOTTrackedObjBatch::list
NvMOTTrackedObjList * list
Holds a pointer to an array of object lists.
Definition: nvdstracker.h:325
_NvMOTFrame::reset
bool reset
Holds a Boolean which is true to reset tracking for the stream.
Definition: nvdstracker.h:269
NvMOTRect
struct _NvMOTRect NvMOTRect
Holds the definition of a rectangle.
_NvMOTTrackedObj
Holds information about each tracked object.
Definition: nvdstracker.h:283
NvMOTConfigStatus_Unsupported
@ NvMOTConfigStatus_Unsupported
Definition: nvdstracker.h:141
_NvMOTPerTransformBatchConfig::colorFormat
uint32_t colorFormat
Holds the color format: RGB, NV12 etc.
Definition: nvdstracker.h:81
_NvMOTObjToTrackList::list
NvMOTObjToTrack * list
Holds a pointer to a list or array of object information blocks.
Definition: nvdstracker.h:233
_NvMOTFrame::srcFrameWidth
uint32_t srcFrameWidth
Holds the width of the original source frame.
Definition: nvdstracker.h:257
_NvMOTTrackedObj::trackingId
uint64_t trackingId
Holds a unique ID for the object, assigned by the tracker.
Definition: nvdstracker.h:288
_NvMOTFrame::objectsIn
NvMOTObjToTrackList objectsIn
Holds a list of objects in this frame which are to be tracked.
Definition: nvdstracker.h:277
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: nvbufsurface.h:427
_NvMOTMiscConfig::maxObjPerStream
uint32_t maxObjPerStream
Holds the maximum number of objects to track per stream.
Definition: nvdstracker.h:94
_NvMOTConfigResponse
Holds a tracker's configuration status.
Definition: nvdstracker.h:150
NvMOTConfigResponse
struct _NvMOTConfigResponse NvMOTConfigResponse
Holds a tracker's configuration status.
NvMOT_Query
NvMOTStatus NvMOT_Query(uint16_t customConfigFilePathSize, char *pCustomConfigFilePath, NvMOTQuery *pQuery)
Query tracker lib capabilities and requirements.
_NvMOTMiscConfig::maxObjPerBatch
uint32_t maxObjPerBatch
Holds the maximum number of objects to track per batch.
Definition: nvdstracker.h:97
NvMOTObjToTrack
struct _NvMOTObjToTrack NvMOTObjToTrack
Holds information about an object to be tracked.
_NvMOTQuery::memType
NvBufSurfaceMemType memType
Holds the preferred memory type for input buffers.
Definition: nvdstracker.h:353
_NvMOTFrame::streamID
NvMOTStreamId streamID
Holds the stream ID of the stream source for this frame.
Definition: nvdstracker.h:252
_NvMOTTrackedObjList::frameNum
uint32_t frameNum
Holds the frame number for objects in the list.
Definition: nvdstracker.h:308
_NvMOTConfig::miscConfig
NvMOTMiscConfig miscConfig
Holds miscellaneous configurations.
Definition: nvdstracker.h:125
_NvMOTConfig::customConfigFilePathSize
uint16_t customConfigFilePathSize
Holds the length of customConfigFilePath.
Definition: nvdstracker.h:127
_NvMOTFrame::numBuffers
uint8_t numBuffers
Holds the number of entries in bufferList.
Definition: nvdstracker.h:271
_NvMOTTrackedObj::age
uint32_t age
Holds the track length in frames.
Definition: nvdstracker.h:294
_NvMOTQuery::computeConfig
NvMOTCompute computeConfig
Holds flags for supported compute targets.
Definition: nvdstracker.h:346
_NvMOTObjToTrack::bbox
NvMOTRect bbox
Holds the bounding box of the object.
Definition: nvdstracker.h:215
NvMOTQuery
struct _NvMOTQuery NvMOTQuery
_NvMOTPerTransformBatchConfig::maxSize
uint32_t maxSize
Holds the maximum size of the buffer in bytes.
Definition: nvdstracker.h:79
NvMOTStatus
NvMOTStatus
Defines generic status codes for tracking operations.
Definition: nvdstracker.h:168
_NvMOTTrackedObj::confidence
float confidence
Holds the tracking confidence of the object.
Definition: nvdstracker.h:292
_NvMOTTrackedObjBatch::numFilled
uint32_t numFilled
Holds the number of filled blocks in the list.
Definition: nvdstracker.h:329
NvMOTStreamId
uint64_t NvMOTStreamId
Definition: nvdstracker.h:44
_NvDsPastFrameObjBatch
Batch of lists of buffered objects.
Definition: nvds_tracker_meta.h:75
NvMOTBatchMode_Error
@ NvMOTBatchMode_Error
Unsupported batch mode.
Definition: nvdstracker.h:181
_NvMOTTrackedObjBatch::numAllocated
uint32_t numAllocated
Holds the number of blocks allocated for the list.
Definition: nvdstracker.h:327
_NvMOTObjToTrack
Holds information about an object to be tracked.
Definition: nvdstracker.h:210
_NvMOTObjToTrackList::numAllocated
uint32_t numAllocated
Holds the number of blocks allocated for the list.
Definition: nvdstracker.h:235
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: nvbufsurface.h:265
_NvMOTRect::height
float height
Holds the height of the bounding box, in pixels.
Definition: nvdstracker.h:202
_NvMOTConfig::computeConfig
NvMOTCompute computeConfig
Holds the compute target.
Definition: nvdstracker.h:113
_NvMOTObjToTrack::doTracking
bool doTracking
Holds a Boolean which is true if NvMOT is to track this object.
Definition: nvdstracker.h:219
_NvMOTConfig::maxStreams
uint32_t maxStreams
Holds the maximum number of streams in a batch.
Definition: nvdstracker.h:115
_NvMOTProcessParams
Holds parameters for processing a batch.
Definition: nvdstracker.h:337
_NvMOTConfig::maxBufSurfAddrSize
uint32_t maxBufSurfAddrSize
Holds the max number of surface buffer addresses from buffer pool.
Definition: nvdstracker.h:117
_NvMOTTrackedObjList
Holds a list of tracked objects.
Definition: nvdstracker.h:303
_NvMOTConfig::customConfigFilePath
char * customConfigFilePath
A pointer to the pathname of the tracker's custom configuration file.
Definition: nvdstracker.h:130
NvMOTConfigStatus
NvMOTConfigStatus
Defines configuration request return codes.
Definition: nvdstracker.h:136
NvMOTCompute
uint8_t NvMOTCompute
Definition: nvdstracker.h:62
_NvMOTQuery
Definition: nvdstracker.h:343
NvMOTTrackedObjList
struct _NvMOTTrackedObjList NvMOTTrackedObjList
Holds a list of tracked objects.
_NvMOTQuery::colorFormats
NvBufSurfaceColorFormat colorFormats[NVMOT_MAX_TRANSFORMS]
Holds the color formats for input buffers; a required value.
Definition: nvdstracker.h:351
_NvMOTPerTransformBatchConfig::maxWidth
uint32_t maxWidth
Holds the maximum width of each frame.
Definition: nvdstracker.h:73
NvMOT_Process
NvMOTStatus NvMOT_Process(NvMOTContextHandle contextHandle, NvMOTProcessParams *pParams, NvMOTTrackedObjBatch *pTrackedObjectsBatch)
Processes a batch.
_NvMOTRect::width
float width
Holds the width of the bounding box, in pixels.
Definition: nvdstracker.h:200
NvMOTProcessParams
struct _NvMOTProcessParams NvMOTProcessParams
Holds parameters for processing a batch.
_NvMOTObjToTrackList::detectionDone
bool detectionDone
Holds a Boolean which is true if detection was done on this frame even if the list of objects to trac...
Definition: nvdstracker.h:231
NvMOTStatus_Error
@ NvMOTStatus_Error
Definition: nvdstracker.h:171
NvMOTConfigStatus_Error
@ NvMOTConfigStatus_Error
Definition: nvdstracker.h:139
_NvMOTFrame::srcFrameHeight
uint32_t srcFrameHeight
Holds the height of the original source frame.
Definition: nvdstracker.h:259
_NvMOTRect::x
float x
Holds the left edge position of the object bounding box, in pixels.
Definition: nvdstracker.h:196
_NvMOTRect::y
float y
Holds the top edge position of the object bounding box, in pixels.
Definition: nvdstracker.h:198
_NvMOTConfigResponse::transformBatchStatus
NvMOTConfigStatus transformBatchStatus
Holds the transform batch configuration request status: summary status for all transforms.
Definition: nvdstracker.h:158
_NvMOTPerTransformBatchConfig::bufferType
NvBufSurfaceMemType bufferType
Holds the type of buffer.
Definition: nvdstracker.h:71
NvMOTBatchMode
NvMOTBatchMode
Bitwise flag to define whether batch/nonbatch mode is supported.
Definition: nvdstracker.h:178
_NvMOTTrackedObjList::numFilled
uint32_t numFilled
Holds the number of populated blocks in the list.
Definition: nvdstracker.h:316
_NvMOTObjToTrackList
Holds a list of objects.
Definition: nvdstracker.h:227
NvMOTContextHandle
struct NvMOTContext * NvMOTContextHandle
Definition: nvdstracker.h:364
_NvMOTFrame::timeStampValid
bool timeStampValid
Holds a Boolean which is true if the timestamp value is properly populated.
Definition: nvdstracker.h:264
NvMOTConfigStatus_OK
@ NvMOTConfigStatus_OK
Definition: nvdstracker.h:138
_NvMOTFrame::doTracking
bool doTracking
Holds a Boolean which is true if objects in this frame are to be tracked.
Definition: nvdstracker.h:267
nvds_tracker_meta.h
_NvMOTFrame::timeStamp
time_t timeStamp
Holds the timestamp of the frame at the time of capture.
Definition: nvdstracker.h:261
NvMOTBatchMode_Batch
@ NvMOTBatchMode_Batch
Batch processing mode.
Definition: nvdstracker.h:183
NvMOTStatus_OK
@ NvMOTStatus_OK
Definition: nvdstracker.h:170
NvMOTBatchMode_MaxValue
@ NvMOTBatchMode_MaxValue
Max value of the enum.
Definition: nvdstracker.h:187
NvMOTObjToTrackList
struct _NvMOTObjToTrackList NvMOTObjToTrackList
Holds a list of objects.
_NvMOTConfigResponse::miscConfigStatus
NvMOTConfigStatus miscConfigStatus
Holds the status of the miscellaneous configurations.
Definition: nvdstracker.h:160
_NvMOTTrackedObjList::streamID
NvMOTStreamId streamID
Holds the stream ID of the stream associated with objects in the list.
Definition: nvdstracker.h:306
nvbufsurface.h
_NvMOTConfig
Holds a tracker configuration.
Definition: nvdstracker.h:110
_NvMOTProcessParams::frameList
NvMOTFrame * frameList
Holds a pointer to an array of frame data.
Definition: nvdstracker.h:340
_NvMOTConfig::perTransformBatchConfig
NvMOTPerTransformBatchConfig * perTransformBatchConfig
Holds a pointer to a list of numTransform batch configurations, one per transform,...
Definition: nvdstracker.h:123
_NvMOTConfigResponse::computeStatus
NvMOTConfigStatus computeStatus
Holds the compute target request status.
Definition: nvdstracker.h:155
NvBufSurfaceColorFormat
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
Definition: nvbufsurface.h:103
_NvMOTTrackedObjList::valid
bool valid
Holds a Boolean which is true if this entry in the batch is valid.
Definition: nvdstracker.h:310
_NvMOTConfig::numTransforms
uint8_t numTransforms
Holds the number of NvMOTPerTransformBatchConfig entries in perTransformBatchConfig.
Definition: nvdstracker.h:120
_NvMOTMiscConfig
Holds miscellaneous configurations.
Definition: nvdstracker.h:88