OpenCV  4.2.0
Open Source Computer Vision
Classes | Public Member Functions | Protected Member Functions | List of all members
cv::TrackerSamplerPF Class Reference

This sampler is based on particle filtering. More...

#include <opencv2/tracking/tracker.hpp>

Inheritance diagram for cv::TrackerSamplerPF:
cv::TrackerSamplerAlgorithm

Classes

struct  Params
 This structure contains all the parameters that can be varied during the course of sampling algorithm. Below is the structure exposed, together with its members briefly explained with reference to the above discussion on algorithm's working. More...
 

Public Member Functions

 TrackerSamplerPF (const Mat &chosenRect, const TrackerSamplerPF::Params &parameters=TrackerSamplerPF::Params())
 Constructor. More...
 
- Public Member Functions inherited from cv::TrackerSamplerAlgorithm
virtual ~TrackerSamplerAlgorithm ()
 Destructor. More...
 
String getClassName () const
 Get the name of the specific TrackerSamplerAlgorithm. More...
 
bool sampling (const Mat &image, Rect boundingBox, std::vector< Mat > &sample)
 Computes the regions starting from a position in an image. More...
 

Protected Member Functions

bool samplingImpl (const Mat &image, Rect boundingBox, std::vector< Mat > &sample) CV_OVERRIDE
 

Additional Inherited Members

- Static Public Member Functions inherited from cv::TrackerSamplerAlgorithm
static Ptr< TrackerSamplerAlgorithmcreate (const String &trackerSamplerType)
 Create TrackerSamplerAlgorithm by tracker sampler type. More...
 
- Protected Attributes inherited from cv::TrackerSamplerAlgorithm
String className
 

Detailed Description

This sampler is based on particle filtering.

In principle, it can be thought of as performing some sort of optimization (and indeed, this tracker uses opencv's optim module), where tracker seeks to find the rectangle in given frame, which is the most *"similar"* to the initial rectangle (the one, given through the constructor).

The optimization performed is stochastic and somehow resembles genetic algorithms, where on each new image received (submitted via TrackerSamplerPF::sampling()) we start with the region bounded by boundingBox, then generate several "perturbed" boxes, take the ones most similar to the original. This selection round is repeated several times. At the end, we hope that only the most promising box remaining, and these are combined to produce the subrectangle of image, which is put as a sole element in array sample.

It should be noted, that the definition of "similarity" between two rectangles is based on comparing their histograms. As experiments show, tracker is not very succesfull if target is assumed to strongly change its dimensions.

Constructor & Destructor Documentation

◆ TrackerSamplerPF()

cv::TrackerSamplerPF::TrackerSamplerPF ( const Mat chosenRect,
const TrackerSamplerPF::Params parameters = TrackerSamplerPF::Params() 
)

Constructor.

Parameters
chosenRectInitial rectangle, that is supposed to contain target we'd like to track.
parameters

Member Function Documentation

◆ samplingImpl()

bool cv::TrackerSamplerPF::samplingImpl ( const Mat image,
Rect  boundingBox,
std::vector< Mat > &  sample 
)
protectedvirtual

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