Back to Jetson Inference

Jetson Inference: jetson

docs/html/objectTracker_8h_source.html

latest10.1 KB
Original Source

| | Jetson Inference

DNN Vision Library |

objectTracker.h

Go to the documentation of this file.

1 /*

2 * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.

3 *

4 * Permission is hereby granted, free of charge, to any person obtaining a

5 * copy of this software and associated documentation files (the "Software"),

6 * to deal in the Software without restriction, including without limitation

7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,

8 * and/or sell copies of the Software, and to permit persons to whom the

9 * Software is furnished to do so, subject to the following conditions:

10 *

11 * The above copyright notice and this permission notice shall be included in

12 * all copies or substantial portions of the Software.

13 *

14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

20 * DEALINGS IN THE SOFTWARE.

21 */

22

23 #ifndef __OBJECT_TRACKER_H__

24 #define __OBJECT_TRACKER_H__

25

26

27 #include "detectNet.h"

28

29

34 #define OBJECT_TRACKER_USAGE_STRING "objectTracker arguments: \n" \

35 " --tracking flag to enable default tracker (IOU)\n" \

36 " --tracker=TRACKER enable tracking with 'IOU' or 'KLT'\n" \

37 " --tracker-min-frames=N the number of re-identified frames for a track to be considered valid (default: 3)\n" \

38 " --tracker-drop-frames=N number of consecutive lost frames before a track is dropped (default: 15)\n" \

39 " --tracker-overlap=N how much IOU overlap is required for a bounding box to be matched (default: 0.5)\n\n" \

40

41

45 #define LOG_TRACKER "[tracker] "

46

47

52 class objectTracker

53 {

54 public:

58enum Type

59 {

60NONE,

61IOU,

62KLT

63 };

64

68static objectTracker* Create( Type type );

69

73static objectTracker* Create( int argc, char** argv );

74

78static objectTracker* Create( const commandLine& cmdLine );

79

83virtual ~objectTracker();

84

88template<typename T> int Process( T* image, uint32_t width, uint32_t height, detectNet::Detection* detections, int numDetections ) { return Process((void*)image, width, height, imageFormatFromType<T>(), detections, numDetections); }

89

93virtual int Process( void* image, uint32_t width, uint32_t height, imageFormat format, detectNet::Detection* detections, int numDetections ) = 0;

94

98inline bool IsEnabled() const { return mEnabled; }

99

103inline virtual void SetEnabled( bool enabled ) { mEnabled = enabled; }

104

108virtual Type GetType() const = 0;

109

113inline bool IsType( Type type ) const { return GetType() == type; }

114

118static inline const char* Usage() { return OBJECT_TRACKER_USAGE_STRING; }

119

123static const char* TypeToStr( Type type );

124

128static Type TypeFromStr( const char* str );

129

130 protected:

131objectTracker();

132

133bool mEnabled;

134 };

135

136 #endif

objectTracker::IsType

bool IsType(Type type) const

IsType.

Definition: objectTracker.h:113

OBJECT_TRACKER_USAGE_STRING

#define OBJECT_TRACKER_USAGE_STRING

Standard command-line options able to be passed to detectNet::Create()

Definition: objectTracker.h:34

objectTracker::~objectTracker

virtual ~objectTracker()

Destructor.

detectNet.h

detectNet::Detection

Object Detection result.

Definition: detectNet.h:122

objectTracker::TypeToStr

static const char * TypeToStr(Type type)

Convert a Type enum to string.

objectTracker::GetType

virtual Type GetType() const =0

GetType.

objectTracker::IOU

@ IOU

Intersection-Over-Union (IOU) tracker.

Definition: objectTracker.h:61

objectTracker

Object tracker interface.

Definition: objectTracker.h:52

objectTracker::IsEnabled

bool IsEnabled() const

IsEnabled.

Definition: objectTracker.h:98

objectTracker::Type

Type

Tracker type enum.

Definition: objectTracker.h:58

objectTracker::NONE

@ NONE

Tracking disabled.

Definition: objectTracker.h:60

objectTracker::Usage

static const char * Usage()

Usage string for command line arguments to Create()

Definition: objectTracker.h:118

objectTracker::KLT

@ KLT

KLT tracker (only available with VPI)

Definition: objectTracker.h:62

objectTracker::objectTracker

objectTracker()

objectTracker::SetEnabled

virtual void SetEnabled(bool enabled)

SetEnabled.

Definition: objectTracker.h:103

objectTracker::Process

int Process(T *image, uint32_t width, uint32_t height, detectNet::Detection *detections, int numDetections)

Process.

Definition: objectTracker.h:88

commandLine

Command line parser for extracting flags, values, and strings.

Definition: commandLine.h:35

objectTracker::Create

static objectTracker * Create(Type type)

Create a new object tracker.

imageFormat

imageFormat

The imageFormat enum is used to identify the pixel format and colorspace of an image.

Definition: imageFormat.h:49

objectTracker::mEnabled

bool mEnabled

Definition: objectTracker.h:133

objectTracker::TypeFromStr

static Type TypeFromStr(const char *str)

Parse a Type enum from a string.