OpenCV
4.1.1
Open Source Computer Vision

This sampler is based on particle filtering. More...
#include <opencv2/tracking/tracker.hpp>
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 ¶meters=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< TrackerSamplerAlgorithm >  create (const String &trackerSamplerType) 
Create TrackerSamplerAlgorithm by tracker sampler type. More...  
Protected Attributes inherited from cv::TrackerSamplerAlgorithm  
String  className 
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.
cv::TrackerSamplerPF::TrackerSamplerPF  (  const Mat &  chosenRect, 
const TrackerSamplerPF::Params &  parameters = TrackerSamplerPF::Params() 

) 
Constructor.
chosenRect  Initial rectangle, that is supposed to contain target we'd like to track. 
parameters 

protectedvirtual 
Implements cv::TrackerSamplerAlgorithm.