OpenCV  4.5.0
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
cv::MultiTracker Class Reference

This class is used to track multiple objects using the specified tracker algorithm. More...

#include <opencv2/tracking/tracker.hpp>

Inheritance diagram for cv::MultiTracker:
cv::Algorithm

Public Member Functions

 MultiTracker ()
 Constructor. More...
 
 ~MultiTracker () CV_OVERRIDE
 Destructor. More...
 
bool add (Ptr< Tracker > newTracker, InputArray image, const Rect2d &boundingBox)
 Add a new object to be tracked. More...
 
bool add (std::vector< Ptr< Tracker > > newTrackers, InputArray image, std::vector< Rect2d > boundingBox)
 Add a set of objects to be tracked. More...
 
const std::vector< Rect2d > & getObjects () const
 Returns a reference to a storage for the tracked objects, each object corresponds to one tracker algorithm. More...
 
bool update (InputArray image)
 Update the current tracking status. The result will be saved in the internal storage. More...
 
bool update (InputArray image, std::vector< Rect2d > &boundingBox)
 Update the current tracking status. More...
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage. More...
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage. More...
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 

Static Public Member Functions

static Ptr< MultiTrackercreate ()
 Returns a pointer to a new instance of MultiTracker. More...
 
- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file. More...
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String. More...
 
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node. More...
 

Protected Attributes

std::vector< Rect2dobjects
 
std::vector< Ptr< Tracker > > trackerList
 < storage for the tracker algorithms. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

This class is used to track multiple objects using the specified tracker algorithm.

The MultiTracker is naive implementation of multiple object tracking. It process the tracked objects independently without any optimization accross the tracked objects.

Constructor & Destructor Documentation

◆ MultiTracker()

cv::MultiTracker::MultiTracker ( )
Python:
<MultiTracker object>=cv.MultiTracker()

Constructor.

◆ ~MultiTracker()

cv::MultiTracker::~MultiTracker ( )

Destructor.

Member Function Documentation

◆ add() [1/2]

bool cv::MultiTracker::add ( Ptr< Tracker newTracker,
InputArray  image,
const Rect2d boundingBox 
)
Python:
retval=cv.MultiTracker.add(newTracker, image, boundingBox)

Add a new object to be tracked.

Parameters
newTrackertracking algorithm to be used
imageinput image
boundingBoxa rectangle represents ROI of the tracked object

◆ add() [2/2]

bool cv::MultiTracker::add ( std::vector< Ptr< Tracker > >  newTrackers,
InputArray  image,
std::vector< Rect2d boundingBox 
)
Python:
retval=cv.MultiTracker.add(newTracker, image, boundingBox)

Add a set of objects to be tracked.

Parameters
newTrackerslist of tracking algorithms to be used
imageinput image
boundingBoxlist of the tracked objects

◆ create()

static Ptr<MultiTracker> cv::MultiTracker::create ( )
static
Python:
retval=cv.MultiTracker_create()

Returns a pointer to a new instance of MultiTracker.

◆ getObjects()

const std::vector<Rect2d>& cv::MultiTracker::getObjects ( ) const
Python:
retval=cv.MultiTracker.getObjects()

Returns a reference to a storage for the tracked objects, each object corresponds to one tracker algorithm.

◆ update() [1/2]

bool cv::MultiTracker::update ( InputArray  image)
Python:
retval, boundingBox=cv.MultiTracker.update(image)

Update the current tracking status. The result will be saved in the internal storage.

Parameters
imageinput image

◆ update() [2/2]

bool cv::MultiTracker::update ( InputArray  image,
std::vector< Rect2d > &  boundingBox 
)
Python:
retval, boundingBox=cv.MultiTracker.update(image)

Update the current tracking status.

Parameters
imageinput image
boundingBoxthe tracking result, represent a list of ROIs of the tracked objects.

Member Data Documentation

◆ objects

std::vector<Rect2d> cv::MultiTracker::objects
protected

◆ trackerList

std::vector< Ptr<Tracker> > cv::MultiTracker::trackerList
protected

< storage for the tracker algorithms.

storage for the tracked objects, each object corresponds to one tracker algorithm.


The documentation for this class was generated from the following file: