Table Of Contents

Previous topic

Common Interfaces of TrackerSampler

Next topic

Common Interfaces of TrackerModel

Common Interfaces of TrackerFeatureSet

TrackerFeatureSet

Class that manages the extraction and selection of features

[AAM] Feature Extraction and Feature Set Refinement (Feature Processing and Feature Selection). See table I and section III C [AMVOT] Appearance modelling -> Visual representation (Table II, section 3.1 - 3.2)

class TrackerFeatureSet

TrackerFeatureSet class:

class CV_EXPORTS_W TrackerFeatureSet
{
 public:

  TrackerFeatureSet();
  ~TrackerFeatureSet();

  void extraction( const std::vector<Mat>& images );
  void selection();
  void removeOutliers();

  bool addTrackerFeature( String trackerFeatureType );
  bool addTrackerFeature( Ptr<TrackerFeature>& feature );

  const std::vector<std::pair<String, Ptr<TrackerFeature> > >& getTrackerFeature() const;
  const std::vector<Mat>& getResponses() const;

};

TrackerFeatureSet is an aggregation of TrackerFeature

See also

TrackerFeature

TrackerFeatureSet::extraction

Extract features from the images collection

C++: void TrackerFeatureSet::extraction(const std::vector<Mat>& images)
Parameters:
  • images – The input images

TrackerFeatureSet::selection

Identify most effective features for all feature types (optional)

C++: void TrackerFeatureSet::selection()

TrackerFeatureSet::removeOutliers

Remove outliers for all feature types (optional)

C++: void TrackerFeatureSet::removeOutliers()

TrackerFeatureSet::addTrackerFeature

Add TrackerFeature in the collection. Return true if TrackerFeature is added, false otherwise

C++: bool TrackerFeatureSet::addTrackerFeature(String trackerFeatureType)
Parameters:
  • trackerFeatureType – The TrackerFeature name
C++: bool TrackerFeatureSet::addTrackerFeature(Ptr<TrackerFeature>& feature)
Parameters:
  • feature – The TrackerFeature class

The modes available now:

  • "HAAR" – Haar Feature-based

The modes that will be available soon:

  • "HOG" – Histogram of Oriented Gradients features
  • "LBP" – Local Binary Pattern features
  • "FEATURE2D" – All types of Feature2D

Example TrackerFeatureSet::addTrackerFeature :

//sample usage:

Ptr<TrackerFeature> trackerFeature = new TrackerFeatureHAAR( HAARparameters );
featureSet->addTrackerFeature( trackerFeature );

//or add CSC sampler with default parameters
//featureSet->addTrackerFeature( "HAAR" );

Note

If you use the second method, you must initialize the TrackerFeature

TrackerFeatureSet::getTrackerFeature

Get the TrackerFeature collection (TrackerFeature name, TrackerFeature pointer)

C++: const std::vector<std::pair<String, Ptr<TrackerFeature>>>& TrackerFeatureSet::getTrackerFeature() const

TrackerFeatureSet::getResponses

Get the responses

C++: const std::vector<Mat>& TrackerFeatureSet::getResponses() const

Note

Be sure to call extraction before getResponses

Example TrackerFeatureSet::getResponses :

//get the patches from sampler
std::vector<Mat> detectSamples = sampler->getSamples();

if( detectSamples.empty() )
   return false;

//features extraction
featureSet->extraction( detectSamples );

//get responses
std::vector<Mat> response = featureSet->getResponses();

TrackerFeature

Abstract base class for TrackerFeature that represents the feature.

class TrackerFeature

TrackerFeature class:

class CV_EXPORTS_W TrackerFeature
{
 public:
  virtual ~TrackerFeature();

  static Ptr<TrackerFeature> create( const String& trackerFeatureType );

  void compute( const std::vector<Mat>& images, Mat& response );

  virtual void selection( Mat& response, int npoints ) = 0;

  String getClassName() const;
};

TrackerFeature::create

Create TrackerFeature by tracker feature type

C++: static Ptr<TrackerFeature> TrackerFeature::create(const String& trackerFeatureType)
Parameters:
  • trackerFeatureType – The TrackerFeature name

The modes available now:

  • "HAAR" – Haar Feature-based

The modes that will be available soon:

  • "HOG" – Histogram of Oriented Gradients features
  • "LBP" – Local Binary Pattern features
  • "FEATURE2D" – All types of Feature2D

TrackerFeature::compute

Compute the features in the images collection

C++: void TrackerFeature::compute(const std::vector<Mat>& images, Mat& response)
Parameters:
  • images – The images
  • response – The output response

TrackerFeature::selection

Identify most effective features

C++: void TrackerFeature::selection(Mat& response, int npoints)
Parameters:
  • response – Collection of response for the specific TrackerFeature
  • npoints – Max number of features

Note

This method modifies the response parameter

TrackerFeature::getClassName

Get the name of the specific TrackerFeature

C++: String TrackerFeature::getClassName() const

Specialized TrackerFeature

In [AAM] table I and section III C are described the most known features type. At moment only TrackerFeatureHAAR is implemented.

TrackerFeatureHAAR : TrackerFeature

TrackerFeature based on HAAR features, used by TrackerMIL and many others algorithms

class TrackerFeatureHAAR

TrackerFeatureHAAR class:

class CV_EXPORTS_W TrackerFeatureHAAR : TrackerFeature
{
 public:

  TrackerFeatureHAAR( const TrackerFeatureHAAR::Params &parameters = TrackerFeatureHAAR::Params() );
  ~TrackerFeatureHAAR();

  void selection( Mat& response, int npoints );
  bool extractSelected( const std::vector<int> selFeatures, const std::vector<Mat>& images, Mat& response );
  std::vector<std::pair<float, float> >& getMeanSigmaPairs();
  bool swapFeature( int source, int target );
  bool swapFeature( int id, CvHaarEvaluator::FeatureHaar& feature );
  CvHaarEvaluator::FeatureHaar& getFeatureAt( int id );
};

Note

HAAR features implementation is copied from apps/traincascade and modified according to MIL implementation

TrackerFeatureHAAR::Params

struct TrackerFeatureHAAR::Params

List of TrackerFeatureHAAR parameters:

struct CV_EXPORTS Params
{
 Params();
 int numFeatures; // # of rects
 Size rectSize;   // rect size
 bool isIntegral;  // true if input images are integral, false otherwise
};

TrackerFeatureHAAR::TrackerFeatureHAAR

Constructor

C++: TrackerFeatureHAAR::TrackerFeatureHAAR(const TrackerFeatureHAAR::Params& parameters=TrackerFeatureHAAR::Params() )
Parameters:

TrackerFeatureHAAR::selection

Identify most effective features

C++: void TrackerFeatureHAAR::selection(Mat& response, int npoints)
Parameters:
  • response – Collection of response for the specific TrackerFeature
  • npoints – Max number of features

Note

This method modifies the response parameter

TrackerFeatureHAAR::extractSelected

Compute the features only for the selected indices in the images collection

C++: bool TrackerFeatureHAAR::extractSelected(const std::vector<int> selFeatures, const std::vector<Mat>& images, Mat& response)
Parameters:
  • selFeatures – indices of selected features
  • images – The images
  • response – Collection of response for the specific TrackerFeature

TrackerFeatureHAAR::getMeanSigmaPairs

Get the list of mean/sigma. Return the list of mean/sigma

C++: std::vector<std::pair<float, float>>& TrackerFeatureHAAR::getMeanSigmaPairs()

TrackerFeatureHAAR::swapFeature

Swap the feature in position source with the feature in position target

C++: bool TrackerFeatureHAAR::swapFeature(int source, int target)
Parameters:
  • source – The source position
  • target – The target position

Swap the feature in position id with the feature input

C++: bool TrackerFeatureHAAR::swapFeature(int id, CvHaarEvaluator::FeatureHaar& feature)
Parameters:
  • id – The position
  • feature – The feature

TrackerFeatureHAAR::getFeatureAt

Get the feature in position id

C++: CvHaarEvaluator::FeatureHaar& TrackerFeatureHAAR::getFeatureAt(int id)
Parameters:
  • id – The position

TrackerFeatureHOG

TODO To be implemented

TrackerFeatureLBP

TODO To be implemented

TrackerFeatureFeature2d

TODO To be implemented