|
|
|
@ -1,43 +1,6 @@ |
|
|
|
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
|
|
|
//
|
|
|
|
|
// By downloading, copying, installing or using the software you agree to this license.
|
|
|
|
|
// If you do not agree to this license, do not download, install,
|
|
|
|
|
// copy or use the software.
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// License Agreement
|
|
|
|
|
// For Open Source Computer Vision Library
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
|
|
|
|
// Third party copyrights are property of their respective owners.
|
|
|
|
|
//
|
|
|
|
|
// Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
|
// are permitted provided that the following conditions are met:
|
|
|
|
|
//
|
|
|
|
|
// * Redistribution's of source code must retain the above copyright notice,
|
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
|
//
|
|
|
|
|
// * Redistribution's in binary form must reproduce the above copyright notice,
|
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
|
//
|
|
|
|
|
// * The name of the copyright holders may not be used to endorse or promote products
|
|
|
|
|
// derived from this software without specific prior written permission.
|
|
|
|
|
//
|
|
|
|
|
// This software is provided by the copyright holders and contributors "as is" and
|
|
|
|
|
// any express or implied warranties, including, but not limited to, the implied
|
|
|
|
|
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
|
|
|
|
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
|
|
|
|
// indirect, incidental, special, exemplary, or consequential damages
|
|
|
|
|
// (including, but not limited to, procurement of substitute goods or services;
|
|
|
|
|
// loss of use, data, or profits; or business interruption) however caused
|
|
|
|
|
// and on any theory of liability, whether in contract, strict liability,
|
|
|
|
|
// or tort (including negligence or otherwise) arising in any way out of
|
|
|
|
|
// the use of this software, even if advised of the possibility of such damage.
|
|
|
|
|
//
|
|
|
|
|
//M*/
|
|
|
|
|
// This file is part of OpenCV project.
|
|
|
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
|
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
|
|
|
|
|
|
|
|
#ifndef OPENCV_TRACKING_DETAIL_HPP |
|
|
|
|
#define OPENCV_TRACKING_DETAIL_HPP |
|
|
|
@ -52,11 +15,10 @@ |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include "opencv2/core.hpp" |
|
|
|
|
#include "opencv2/video/detail/tracking.private.hpp" |
|
|
|
|
|
|
|
|
|
#include "feature.hpp" // CvHaarEvaluator |
|
|
|
|
#include "onlineBoosting.hpp" // StrongClassifierDirectSelection |
|
|
|
|
#include "onlineMIL.hpp" // ClfMilBoost |
|
|
|
|
|
|
|
|
|
namespace cv { |
|
|
|
|
namespace detail { |
|
|
|
@ -77,13 +39,13 @@ These algorithms start from a bounding box of the target and with their internal |
|
|
|
|
avoid the drift during the tracking. These long-term trackers are able to evaluate online the |
|
|
|
|
quality of the location of the target in the new frame, without ground truth. |
|
|
|
|
|
|
|
|
|
There are three main components: the TrackerSampler, the TrackerFeatureSet and the TrackerModel. The |
|
|
|
|
There are three main components: the TrackerContribSampler, the TrackerContribFeatureSet and the TrackerModel. The |
|
|
|
|
first component is the object that computes the patches over the frame based on the last target |
|
|
|
|
location. The TrackerFeatureSet is the class that manages the Features, is possible plug many kind |
|
|
|
|
location. The TrackerContribFeatureSet is the class that manages the Features, is possible plug many kind |
|
|
|
|
of these (HAAR, HOG, LBP, Feature2D, etc). The last component is the internal representation of the |
|
|
|
|
target, it is the appearance model. It stores all state candidates and compute the trajectory (the |
|
|
|
|
most likely target states). The class TrackerTargetState represents a possible state of the target. |
|
|
|
|
The TrackerSampler and the TrackerFeatureSet are the visual representation of the target, instead |
|
|
|
|
The TrackerContribSampler and the TrackerContribFeatureSet are the visual representation of the target, instead |
|
|
|
|
the TrackerModel is the statistical model. |
|
|
|
|
|
|
|
|
|
A recent benchmark between these algorithms can be found in @cite OOT |
|
|
|
@ -131,25 +93,25 @@ trackerMIL, trackerBoosting) -- we shall refer to this choice as to "classname" |
|
|
|
|
That function can (and probably will) return a pointer to some derived class of "classname", |
|
|
|
|
which will probably have a real constructor. |
|
|
|
|
|
|
|
|
|
Every tracker has three component TrackerSampler, TrackerFeatureSet and TrackerModel. The first two |
|
|
|
|
Every tracker has three component TrackerContribSampler, TrackerContribFeatureSet and TrackerModel. The first two |
|
|
|
|
are instantiated from Tracker base class, instead the last component is abstract, so you must |
|
|
|
|
implement your TrackerModel. |
|
|
|
|
|
|
|
|
|
### TrackerSampler |
|
|
|
|
### TrackerContribSampler |
|
|
|
|
|
|
|
|
|
TrackerSampler is already instantiated, but you should define the sampling algorithm and add the |
|
|
|
|
classes (or single class) to TrackerSampler. You can choose one of the ready implementation as |
|
|
|
|
TrackerSamplerCSC or you can implement your sampling method, in this case the class must inherit |
|
|
|
|
TrackerSamplerAlgorithm. Fill the samplingImpl method that writes the result in "sample" output |
|
|
|
|
TrackerContribSampler is already instantiated, but you should define the sampling algorithm and add the |
|
|
|
|
classes (or single class) to TrackerContribSampler. You can choose one of the ready implementation as |
|
|
|
|
TrackerContribSamplerCSC or you can implement your sampling method, in this case the class must inherit |
|
|
|
|
TrackerContribSamplerAlgorithm. Fill the samplingImpl method that writes the result in "sample" output |
|
|
|
|
argument. |
|
|
|
|
|
|
|
|
|
Example of creating specialized TrackerSamplerAlgorithm TrackerSamplerCSC : : |
|
|
|
|
Example of creating specialized TrackerContribSamplerAlgorithm TrackerContribSamplerCSC : : |
|
|
|
|
@code |
|
|
|
|
class CV_EXPORTS_W TrackerSamplerCSC : public TrackerSamplerAlgorithm |
|
|
|
|
class CV_EXPORTS_W TrackerContribSamplerCSC : public TrackerContribSamplerAlgorithm |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
TrackerSamplerCSC( const TrackerSamplerCSC::Params ¶meters = TrackerSamplerCSC::Params() ); |
|
|
|
|
~TrackerSamplerCSC(); |
|
|
|
|
TrackerContribSamplerCSC( const TrackerContribSamplerCSC::Params ¶meters = TrackerContribSamplerCSC::Params() ); |
|
|
|
|
~TrackerContribSamplerCSC(); |
|
|
|
|
... |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
@ -159,10 +121,10 @@ Example of creating specialized TrackerSamplerAlgorithm TrackerSamplerCSC : : |
|
|
|
|
}; |
|
|
|
|
@endcode |
|
|
|
|
|
|
|
|
|
Example of adding TrackerSamplerAlgorithm to TrackerSampler : : |
|
|
|
|
Example of adding TrackerContribSamplerAlgorithm to TrackerContribSampler : : |
|
|
|
|
@code |
|
|
|
|
//sampler is the TrackerSampler
|
|
|
|
|
Ptr<TrackerSamplerAlgorithm> CSCSampler = new TrackerSamplerCSC( CSCparameters ); |
|
|
|
|
//sampler is the TrackerContribSampler
|
|
|
|
|
Ptr<TrackerContribSamplerAlgorithm> CSCSampler = new TrackerContribSamplerCSC( CSCparameters ); |
|
|
|
|
if( !sampler->addTrackerSamplerAlgorithm( CSCSampler ) ) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
@ -170,23 +132,23 @@ Example of adding TrackerSamplerAlgorithm to TrackerSampler : : |
|
|
|
|
//sampler->addTrackerSamplerAlgorithm( "CSC" );
|
|
|
|
|
@endcode |
|
|
|
|
@sa |
|
|
|
|
TrackerSamplerCSC, TrackerSamplerAlgorithm |
|
|
|
|
TrackerContribSamplerCSC, TrackerContribSamplerAlgorithm |
|
|
|
|
|
|
|
|
|
### TrackerFeatureSet |
|
|
|
|
### TrackerContribFeatureSet |
|
|
|
|
|
|
|
|
|
TrackerFeatureSet is already instantiated (as first) , but you should define what kinds of features |
|
|
|
|
TrackerContribFeatureSet is already instantiated (as first) , but you should define what kinds of features |
|
|
|
|
you'll use in your tracker. You can use multiple feature types, so you can add a ready |
|
|
|
|
implementation as TrackerFeatureHAAR in your TrackerFeatureSet or develop your own implementation. |
|
|
|
|
implementation as TrackerContribFeatureHAAR in your TrackerContribFeatureSet or develop your own implementation. |
|
|
|
|
In this case, in the computeImpl method put the code that extract the features and in the selection |
|
|
|
|
method optionally put the code for the refinement and selection of the features. |
|
|
|
|
|
|
|
|
|
Example of creating specialized TrackerFeature TrackerFeatureHAAR : : |
|
|
|
|
Example of creating specialized TrackerFeature TrackerContribFeatureHAAR : : |
|
|
|
|
@code |
|
|
|
|
class CV_EXPORTS_W TrackerFeatureHAAR : public TrackerFeature |
|
|
|
|
class CV_EXPORTS_W TrackerContribFeatureHAAR : public TrackerFeature |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
TrackerFeatureHAAR( const TrackerFeatureHAAR::Params ¶meters = TrackerFeatureHAAR::Params() ); |
|
|
|
|
~TrackerFeatureHAAR(); |
|
|
|
|
TrackerContribFeatureHAAR( const TrackerContribFeatureHAAR::Params ¶meters = TrackerContribFeatureHAAR::Params() ); |
|
|
|
|
~TrackerContribFeatureHAAR(); |
|
|
|
|
void selection( Mat& response, int npoints ); |
|
|
|
|
... |
|
|
|
|
|
|
|
|
@ -196,14 +158,14 @@ Example of creating specialized TrackerFeature TrackerFeatureHAAR : : |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
@endcode |
|
|
|
|
Example of adding TrackerFeature to TrackerFeatureSet : : |
|
|
|
|
Example of adding TrackerFeature to TrackerContribFeatureSet : : |
|
|
|
|
@code |
|
|
|
|
//featureSet is the TrackerFeatureSet
|
|
|
|
|
Ptr<TrackerFeature> trackerFeature = new TrackerFeatureHAAR( HAARparameters ); |
|
|
|
|
//featureSet is the TrackerContribFeatureSet
|
|
|
|
|
Ptr<TrackerFeature> trackerFeature = new TrackerContribFeatureHAAR( HAARparameters ); |
|
|
|
|
featureSet->addTrackerFeature( trackerFeature ); |
|
|
|
|
@endcode |
|
|
|
|
@sa |
|
|
|
|
TrackerFeatureHAAR, TrackerFeatureSet |
|
|
|
|
TrackerContribFeatureHAAR, TrackerContribFeatureSet |
|
|
|
|
|
|
|
|
|
### TrackerModel |
|
|
|
|
|
|
|
|
@ -298,23 +260,17 @@ Example of creating specialized TrackerTargetState TrackerMILTargetState : : |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************ TrackerFeature Base Classes ************************************/ |
|
|
|
|
/************************************ TrackerContribFeature Base Classes ************************************/ |
|
|
|
|
|
|
|
|
|
/** @brief Abstract base class for TrackerFeature that represents the feature.
|
|
|
|
|
/** @brief Abstract base class for TrackerContribFeature that represents the feature.
|
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerFeature |
|
|
|
|
class CV_EXPORTS TrackerContribFeature : public TrackerFeature |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
virtual ~TrackerFeature(); |
|
|
|
|
virtual ~TrackerContribFeature(); |
|
|
|
|
|
|
|
|
|
/** @brief Compute the features in the images collection
|
|
|
|
|
@param images The images |
|
|
|
|
@param response The output response |
|
|
|
|
*/ |
|
|
|
|
void compute( const std::vector<Mat>& images, Mat& response ); |
|
|
|
|
|
|
|
|
|
/** @brief Create TrackerFeature by tracker feature type
|
|
|
|
|
@param trackerFeatureType The TrackerFeature name |
|
|
|
|
/** @brief Create TrackerContribFeature by tracker feature type
|
|
|
|
|
@param trackerFeatureType The TrackerContribFeature name |
|
|
|
|
|
|
|
|
|
The modes available now: |
|
|
|
|
|
|
|
|
@ -325,25 +281,22 @@ class CV_EXPORTS TrackerFeature |
|
|
|
|
- "HOG" -- Histogram of Oriented Gradients features |
|
|
|
|
- "LBP" -- Local Binary Pattern features |
|
|
|
|
- "FEATURE2D" -- All types of Feature2D |
|
|
|
|
*/ |
|
|
|
|
static Ptr<TrackerFeature> create( const String& trackerFeatureType ); |
|
|
|
|
*/ |
|
|
|
|
static Ptr<TrackerContribFeature> create( const String& trackerFeatureType ); |
|
|
|
|
|
|
|
|
|
/** @brief Identify most effective features
|
|
|
|
|
@param response Collection of response for the specific TrackerFeature |
|
|
|
|
@param response Collection of response for the specific TrackerContribFeature |
|
|
|
|
@param npoints Max number of features |
|
|
|
|
|
|
|
|
|
@note This method modifies the response parameter |
|
|
|
|
*/ |
|
|
|
|
virtual void selection( Mat& response, int npoints ) = 0; |
|
|
|
|
|
|
|
|
|
/** @brief Get the name of the specific TrackerFeature
|
|
|
|
|
/** @brief Get the name of the specific TrackerContribFeature
|
|
|
|
|
*/ |
|
|
|
|
String getClassName() const; |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
virtual bool computeImpl( const std::vector<Mat>& images, Mat& response ) = 0; |
|
|
|
|
|
|
|
|
|
String className; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -353,19 +306,19 @@ class CV_EXPORTS TrackerFeature |
|
|
|
|
See table I and section III C @cite AMVOT Appearance modelling -\> Visual representation (Table II, |
|
|
|
|
section 3.1 - 3.2) |
|
|
|
|
|
|
|
|
|
TrackerFeatureSet is an aggregation of TrackerFeature |
|
|
|
|
TrackerContribFeatureSet is an aggregation of TrackerContribFeature |
|
|
|
|
|
|
|
|
|
@sa |
|
|
|
|
TrackerFeature |
|
|
|
|
TrackerContribFeature |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerFeatureSet |
|
|
|
|
class CV_EXPORTS TrackerContribFeatureSet |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
TrackerFeatureSet(); |
|
|
|
|
TrackerContribFeatureSet(); |
|
|
|
|
|
|
|
|
|
~TrackerFeatureSet(); |
|
|
|
|
~TrackerContribFeatureSet(); |
|
|
|
|
|
|
|
|
|
/** @brief Extract features from the images collection
|
|
|
|
|
@param images The input images |
|
|
|
@ -380,8 +333,8 @@ class CV_EXPORTS TrackerFeatureSet |
|
|
|
|
*/ |
|
|
|
|
void removeOutliers(); |
|
|
|
|
|
|
|
|
|
/** @brief Add TrackerFeature in the collection. Return true if TrackerFeature is added, false otherwise
|
|
|
|
|
@param trackerFeatureType The TrackerFeature name |
|
|
|
|
/** @brief Add TrackerContribFeature in the collection. Return true if TrackerContribFeature is added, false otherwise
|
|
|
|
|
@param trackerFeatureType The TrackerContribFeature name |
|
|
|
|
|
|
|
|
|
The modes available now: |
|
|
|
|
|
|
|
|
@ -393,32 +346,32 @@ class CV_EXPORTS TrackerFeatureSet |
|
|
|
|
- "LBP" -- Local Binary Pattern features |
|
|
|
|
- "FEATURE2D" -- All types of Feature2D |
|
|
|
|
|
|
|
|
|
Example TrackerFeatureSet::addTrackerFeature : : |
|
|
|
|
Example TrackerContribFeatureSet::addTrackerFeature : : |
|
|
|
|
@code |
|
|
|
|
//sample usage:
|
|
|
|
|
|
|
|
|
|
Ptr<TrackerFeature> trackerFeature = new TrackerFeatureHAAR( HAARparameters ); |
|
|
|
|
Ptr<TrackerContribFeature> trackerFeature = ...; |
|
|
|
|
featureSet->addTrackerFeature( trackerFeature ); |
|
|
|
|
|
|
|
|
|
//or add CSC sampler with default parameters
|
|
|
|
|
//featureSet->addTrackerFeature( "HAAR" );
|
|
|
|
|
@endcode |
|
|
|
|
@note If you use the second method, you must initialize the TrackerFeature |
|
|
|
|
@note If you use the second method, you must initialize the TrackerContribFeature |
|
|
|
|
*/ |
|
|
|
|
bool addTrackerFeature( String trackerFeatureType ); |
|
|
|
|
|
|
|
|
|
/** @overload
|
|
|
|
|
@param feature The TrackerFeature class
|
|
|
|
|
@param feature The TrackerContribFeature class
|
|
|
|
|
*/ |
|
|
|
|
bool addTrackerFeature( Ptr<TrackerFeature>& feature ); |
|
|
|
|
bool addTrackerFeature( Ptr<TrackerContribFeature>& feature ); |
|
|
|
|
|
|
|
|
|
/** @brief Get the TrackerFeature collection (TrackerFeature name, TrackerFeature pointer)
|
|
|
|
|
/** @brief Get the TrackerContribFeature collection (TrackerContribFeature name, TrackerContribFeature pointer)
|
|
|
|
|
*/ |
|
|
|
|
const std::vector<std::pair<String, Ptr<TrackerFeature> > >& getTrackerFeature() const; |
|
|
|
|
const std::vector<std::pair<String, Ptr<TrackerContribFeature> > >& getTrackerFeature() const; |
|
|
|
|
|
|
|
|
|
/** @brief Get the responses
|
|
|
|
|
|
|
|
|
|
@note Be sure to call extraction before getResponses Example TrackerFeatureSet::getResponses : : |
|
|
|
|
@note Be sure to call extraction before getResponses Example TrackerContribFeatureSet::getResponses : : |
|
|
|
|
*/ |
|
|
|
|
const std::vector<Mat>& getResponses() const; |
|
|
|
|
|
|
|
|
@ -427,25 +380,26 @@ class CV_EXPORTS TrackerFeatureSet |
|
|
|
|
void clearResponses(); |
|
|
|
|
bool blockAddTrackerFeature; |
|
|
|
|
|
|
|
|
|
std::vector<std::pair<String, Ptr<TrackerFeature> > > features; //list of features
|
|
|
|
|
std::vector<std::pair<String, Ptr<TrackerContribFeature> > > features; //list of features
|
|
|
|
|
std::vector<Mat> responses; //list of response after compute
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/************************************ TrackerSampler Base Classes ************************************/ |
|
|
|
|
|
|
|
|
|
/** @brief Abstract base class for TrackerSamplerAlgorithm that represents the algorithm for the specific
|
|
|
|
|
/************************************ TrackerContribSampler Base Classes ************************************/ |
|
|
|
|
|
|
|
|
|
/** @brief Abstract base class for TrackerContribSamplerAlgorithm that represents the algorithm for the specific
|
|
|
|
|
sampler. |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerSamplerAlgorithm |
|
|
|
|
class CV_EXPORTS TrackerContribSamplerAlgorithm : public TrackerSamplerAlgorithm |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
/**
|
|
|
|
|
* \brief Destructor |
|
|
|
|
*/ |
|
|
|
|
virtual ~TrackerSamplerAlgorithm(); |
|
|
|
|
virtual ~TrackerContribSamplerAlgorithm(); |
|
|
|
|
|
|
|
|
|
/** @brief Create TrackerSamplerAlgorithm by tracker sampler type.
|
|
|
|
|
/** @brief Create TrackerContribSamplerAlgorithm by tracker sampler type.
|
|
|
|
|
@param trackerSamplerType The trackerSamplerType name |
|
|
|
|
|
|
|
|
|
The modes available now: |
|
|
|
@ -453,7 +407,7 @@ class CV_EXPORTS TrackerSamplerAlgorithm |
|
|
|
|
- "CSC" -- Current State Center |
|
|
|
|
- "CS" -- Current State |
|
|
|
|
*/ |
|
|
|
|
static Ptr<TrackerSamplerAlgorithm> create( const String& trackerSamplerType ); |
|
|
|
|
static Ptr<TrackerContribSamplerAlgorithm> create( const String& trackerSamplerType ); |
|
|
|
|
|
|
|
|
|
/** @brief Computes the regions starting from a position in an image.
|
|
|
|
|
|
|
|
|
@ -464,9 +418,9 @@ class CV_EXPORTS TrackerSamplerAlgorithm |
|
|
|
|
|
|
|
|
|
@param sample The computed samples @cite AAM Fig. 1 variable Sk |
|
|
|
|
*/ |
|
|
|
|
bool sampling( const Mat& image, Rect boundingBox, std::vector<Mat>& sample ); |
|
|
|
|
virtual bool sampling(const Mat& image, const Rect& boundingBox, std::vector<Mat>& sample) CV_OVERRIDE; |
|
|
|
|
|
|
|
|
|
/** @brief Get the name of the specific TrackerSamplerAlgorithm
|
|
|
|
|
/** @brief Get the name of the specific TrackerContribSamplerAlgorithm
|
|
|
|
|
*/ |
|
|
|
|
String getClassName() const; |
|
|
|
|
|
|
|
|
@ -485,23 +439,23 @@ class CV_EXPORTS TrackerSamplerAlgorithm |
|
|
|
|
|
|
|
|
|
@cite AAM Sampling e Labeling. See table I and section III B |
|
|
|
|
|
|
|
|
|
TrackerSampler is an aggregation of TrackerSamplerAlgorithm |
|
|
|
|
TrackerContribSampler is an aggregation of TrackerContribSamplerAlgorithm |
|
|
|
|
@sa |
|
|
|
|
TrackerSamplerAlgorithm |
|
|
|
|
TrackerContribSamplerAlgorithm |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerSampler |
|
|
|
|
class CV_EXPORTS TrackerContribSampler |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Constructor |
|
|
|
|
*/ |
|
|
|
|
TrackerSampler(); |
|
|
|
|
TrackerContribSampler(); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Destructor |
|
|
|
|
*/ |
|
|
|
|
~TrackerSampler(); |
|
|
|
|
~TrackerContribSampler(); |
|
|
|
|
|
|
|
|
|
/** @brief Computes the regions starting from a position in an image
|
|
|
|
|
@param image The current frame |
|
|
|
@ -509,26 +463,26 @@ class CV_EXPORTS TrackerSampler |
|
|
|
|
*/ |
|
|
|
|
void sampling( const Mat& image, Rect boundingBox ); |
|
|
|
|
|
|
|
|
|
/** @brief Return the collection of the TrackerSamplerAlgorithm
|
|
|
|
|
/** @brief Return the collection of the TrackerContribSamplerAlgorithm
|
|
|
|
|
*/ |
|
|
|
|
const std::vector<std::pair<String, Ptr<TrackerSamplerAlgorithm> > >& getSamplers() const; |
|
|
|
|
const std::vector<std::pair<String, Ptr<TrackerContribSamplerAlgorithm> > >& getSamplers() const; |
|
|
|
|
|
|
|
|
|
/** @brief Return the samples from all TrackerSamplerAlgorithm, @cite AAM Fig. 1 variable Sk
|
|
|
|
|
/** @brief Return the samples from all TrackerContribSamplerAlgorithm, @cite AAM Fig. 1 variable Sk
|
|
|
|
|
*/ |
|
|
|
|
const std::vector<Mat>& getSamples() const; |
|
|
|
|
|
|
|
|
|
/** @brief Add TrackerSamplerAlgorithm in the collection. Return true if sampler is added, false otherwise
|
|
|
|
|
@param trackerSamplerAlgorithmType The TrackerSamplerAlgorithm name |
|
|
|
|
/** @brief Add TrackerContribSamplerAlgorithm in the collection. Return true if sampler is added, false otherwise
|
|
|
|
|
@param trackerSamplerAlgorithmType The TrackerContribSamplerAlgorithm name |
|
|
|
|
|
|
|
|
|
The modes available now: |
|
|
|
|
- "CSC" -- Current State Center |
|
|
|
|
- "CS" -- Current State |
|
|
|
|
- "PF" -- Particle Filtering |
|
|
|
|
|
|
|
|
|
Example TrackerSamplerAlgorithm::addTrackerSamplerAlgorithm : : |
|
|
|
|
Example TrackerContribSamplerAlgorithm::addTrackerContribSamplerAlgorithm : : |
|
|
|
|
@code |
|
|
|
|
TrackerSamplerCSC::Params CSCparameters; |
|
|
|
|
Ptr<TrackerSamplerAlgorithm> CSCSampler = new TrackerSamplerCSC( CSCparameters ); |
|
|
|
|
TrackerContribSamplerCSC::Params CSCparameters; |
|
|
|
|
Ptr<TrackerContribSamplerAlgorithm> CSCSampler = new TrackerContribSamplerCSC( CSCparameters ); |
|
|
|
|
|
|
|
|
|
if( !sampler->addTrackerSamplerAlgorithm( CSCSampler ) ) |
|
|
|
|
return false; |
|
|
|
@ -536,300 +490,23 @@ class CV_EXPORTS TrackerSampler |
|
|
|
|
//or add CSC sampler with default parameters
|
|
|
|
|
//sampler->addTrackerSamplerAlgorithm( "CSC" );
|
|
|
|
|
@endcode |
|
|
|
|
@note If you use the second method, you must initialize the TrackerSamplerAlgorithm |
|
|
|
|
@note If you use the second method, you must initialize the TrackerContribSamplerAlgorithm |
|
|
|
|
*/ |
|
|
|
|
bool addTrackerSamplerAlgorithm( String trackerSamplerAlgorithmType ); |
|
|
|
|
|
|
|
|
|
/** @overload
|
|
|
|
|
@param sampler The TrackerSamplerAlgorithm |
|
|
|
|
@param sampler The TrackerContribSamplerAlgorithm |
|
|
|
|
*/ |
|
|
|
|
bool addTrackerSamplerAlgorithm( Ptr<TrackerSamplerAlgorithm>& sampler ); |
|
|
|
|
bool addTrackerSamplerAlgorithm( Ptr<TrackerContribSamplerAlgorithm>& sampler ); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
std::vector<std::pair<String, Ptr<TrackerSamplerAlgorithm> > > samplers; |
|
|
|
|
std::vector<std::pair<String, Ptr<TrackerContribSamplerAlgorithm> > > samplers; |
|
|
|
|
std::vector<Mat> samples; |
|
|
|
|
bool blockAddTrackerSampler; |
|
|
|
|
|
|
|
|
|
void clearSamples(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/************************************ TrackerModel Base Classes ************************************/ |
|
|
|
|
|
|
|
|
|
/** @brief Abstract base class for TrackerTargetState that represents a possible state of the target.
|
|
|
|
|
|
|
|
|
|
See @cite AAM \f$\hat{x}^{i}_{k}\f$ all the states candidates. |
|
|
|
|
|
|
|
|
|
Inherits this class with your Target state, In own implementation you can add scale variation, |
|
|
|
|
width, height, orientation, etc. |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerTargetState |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
virtual ~TrackerTargetState() |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
; |
|
|
|
|
/**
|
|
|
|
|
* \brief Get the position |
|
|
|
|
* \return The position |
|
|
|
|
*/ |
|
|
|
|
Point2f getTargetPosition() const; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Set the position |
|
|
|
|
* \param position The position |
|
|
|
|
*/ |
|
|
|
|
void setTargetPosition( const Point2f& position ); |
|
|
|
|
/**
|
|
|
|
|
* \brief Get the width of the target |
|
|
|
|
* \return The width of the target |
|
|
|
|
*/ |
|
|
|
|
int getTargetWidth() const; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Set the width of the target |
|
|
|
|
* \param width The width of the target |
|
|
|
|
*/ |
|
|
|
|
void setTargetWidth( int width ); |
|
|
|
|
/**
|
|
|
|
|
* \brief Get the height of the target |
|
|
|
|
* \return The height of the target |
|
|
|
|
*/ |
|
|
|
|
int getTargetHeight() const; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Set the height of the target |
|
|
|
|
* \param height The height of the target |
|
|
|
|
*/ |
|
|
|
|
void setTargetHeight( int height ); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
Point2f targetPosition; |
|
|
|
|
int targetWidth; |
|
|
|
|
int targetHeight; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief Represents the model of the target at frame \f$k\f$ (all states and scores)
|
|
|
|
|
|
|
|
|
|
See @cite AAM The set of the pair \f$\langle \hat{x}^{i}_{k}, C^{i}_{k} \rangle\f$ |
|
|
|
|
@sa TrackerTargetState |
|
|
|
|
*/ |
|
|
|
|
typedef std::vector<std::pair<Ptr<TrackerTargetState>, float> > ConfidenceMap; |
|
|
|
|
|
|
|
|
|
/** @brief Represents the estimate states for all frames
|
|
|
|
|
|
|
|
|
|
@cite AAM \f$x_{k}\f$ is the trajectory of the target up to time \f$k\f$ |
|
|
|
|
|
|
|
|
|
@sa TrackerTargetState |
|
|
|
|
*/ |
|
|
|
|
typedef std::vector<Ptr<TrackerTargetState> > Trajectory; |
|
|
|
|
|
|
|
|
|
/** @brief Abstract base class for TrackerStateEstimator that estimates the most likely target state.
|
|
|
|
|
|
|
|
|
|
See @cite AAM State estimator |
|
|
|
|
|
|
|
|
|
See @cite AMVOT Statistical modeling (Fig. 3), Table III (generative) - IV (discriminative) - V (hybrid) |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerStateEstimator |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
virtual ~TrackerStateEstimator(); |
|
|
|
|
|
|
|
|
|
/** @brief Estimate the most likely target state, return the estimated state
|
|
|
|
|
@param confidenceMaps The overall appearance model as a list of :cConfidenceMap |
|
|
|
|
*/ |
|
|
|
|
Ptr<TrackerTargetState> estimate( const std::vector<ConfidenceMap>& confidenceMaps ); |
|
|
|
|
|
|
|
|
|
/** @brief Update the ConfidenceMap with the scores
|
|
|
|
|
@param confidenceMaps The overall appearance model as a list of :cConfidenceMap |
|
|
|
|
*/ |
|
|
|
|
void update( std::vector<ConfidenceMap>& confidenceMaps ); |
|
|
|
|
|
|
|
|
|
/** @brief Create TrackerStateEstimator by tracker state estimator type
|
|
|
|
|
@param trackeStateEstimatorType The TrackerStateEstimator name |
|
|
|
|
|
|
|
|
|
The modes available now: |
|
|
|
|
|
|
|
|
|
- "BOOSTING" -- Boosting-based discriminative appearance models. See @cite AMVOT section 4.4 |
|
|
|
|
|
|
|
|
|
The modes available soon: |
|
|
|
|
|
|
|
|
|
- "SVM" -- SVM-based discriminative appearance models. See @cite AMVOT section 4.5 |
|
|
|
|
*/ |
|
|
|
|
static Ptr<TrackerStateEstimator> create( const String& trackeStateEstimatorType ); |
|
|
|
|
|
|
|
|
|
/** @brief Get the name of the specific TrackerStateEstimator
|
|
|
|
|
*/ |
|
|
|
|
String getClassName() const; |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
virtual Ptr<TrackerTargetState> estimateImpl( const std::vector<ConfidenceMap>& confidenceMaps ) = 0; |
|
|
|
|
virtual void updateImpl( std::vector<ConfidenceMap>& confidenceMaps ) = 0; |
|
|
|
|
String className; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief Abstract class that represents the model of the target. It must be instantiated by specialized
|
|
|
|
|
tracker |
|
|
|
|
|
|
|
|
|
See @cite AAM Ak |
|
|
|
|
|
|
|
|
|
Inherits this with your TrackerModel |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerModel |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Constructor |
|
|
|
|
*/ |
|
|
|
|
TrackerModel(); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Destructor |
|
|
|
|
*/ |
|
|
|
|
virtual ~TrackerModel(); |
|
|
|
|
|
|
|
|
|
/** @brief Set TrackerEstimator, return true if the tracker state estimator is added, false otherwise
|
|
|
|
|
@param trackerStateEstimator The TrackerStateEstimator |
|
|
|
|
@note You can add only one TrackerStateEstimator |
|
|
|
|
*/ |
|
|
|
|
bool setTrackerStateEstimator( Ptr<TrackerStateEstimator> trackerStateEstimator ); |
|
|
|
|
|
|
|
|
|
/** @brief Estimate the most likely target location
|
|
|
|
|
|
|
|
|
|
@cite AAM ME, Model Estimation table I |
|
|
|
|
@param responses Features extracted from TrackerFeatureSet |
|
|
|
|
*/ |
|
|
|
|
void modelEstimation( const std::vector<Mat>& responses ); |
|
|
|
|
|
|
|
|
|
/** @brief Update the model
|
|
|
|
|
|
|
|
|
|
@cite AAM MU, Model Update table I |
|
|
|
|
*/ |
|
|
|
|
void modelUpdate(); |
|
|
|
|
|
|
|
|
|
/** @brief Run the TrackerStateEstimator, return true if is possible to estimate a new state, false otherwise
|
|
|
|
|
*/ |
|
|
|
|
bool runStateEstimator(); |
|
|
|
|
|
|
|
|
|
/** @brief Set the current TrackerTargetState in the Trajectory
|
|
|
|
|
@param lastTargetState The current TrackerTargetState |
|
|
|
|
*/ |
|
|
|
|
void setLastTargetState( const Ptr<TrackerTargetState>& lastTargetState ); |
|
|
|
|
|
|
|
|
|
/** @brief Get the last TrackerTargetState from Trajectory
|
|
|
|
|
*/ |
|
|
|
|
Ptr<TrackerTargetState> getLastTargetState() const; |
|
|
|
|
|
|
|
|
|
/** @brief Get the list of the ConfidenceMap
|
|
|
|
|
*/ |
|
|
|
|
const std::vector<ConfidenceMap>& getConfidenceMaps() const; |
|
|
|
|
|
|
|
|
|
/** @brief Get the last ConfidenceMap for the current frame
|
|
|
|
|
*/ |
|
|
|
|
const ConfidenceMap& getLastConfidenceMap() const; |
|
|
|
|
|
|
|
|
|
/** @brief Get the TrackerStateEstimator
|
|
|
|
|
*/ |
|
|
|
|
Ptr<TrackerStateEstimator> getTrackerStateEstimator() const; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
|
|
void clearCurrentConfidenceMap(); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
std::vector<ConfidenceMap> confidenceMaps; |
|
|
|
|
Ptr<TrackerStateEstimator> stateEstimator; |
|
|
|
|
ConfidenceMap currentConfidenceMap; |
|
|
|
|
Trajectory trajectory; |
|
|
|
|
int maxCMLength; |
|
|
|
|
|
|
|
|
|
virtual void modelEstimationImpl( const std::vector<Mat>& responses ) = 0; |
|
|
|
|
virtual void modelUpdateImpl() = 0; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************ Specific TrackerStateEstimator Classes ************************************/ |
|
|
|
|
|
|
|
|
|
/** @brief TrackerStateEstimator based on Boosting
|
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerStateEstimatorMILBoosting : public TrackerStateEstimator |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implementation of the target state for TrackerStateEstimatorMILBoosting |
|
|
|
|
*/ |
|
|
|
|
class TrackerMILTargetState : public TrackerTargetState |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
/**
|
|
|
|
|
* \brief Constructor |
|
|
|
|
* \param position Top left corner of the bounding box |
|
|
|
|
* \param width Width of the bounding box |
|
|
|
|
* \param height Height of the bounding box |
|
|
|
|
* \param foreground label for target or background |
|
|
|
|
* \param features features extracted |
|
|
|
|
*/ |
|
|
|
|
TrackerMILTargetState( const Point2f& position, int width, int height, bool foreground, const Mat& features ); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Destructor |
|
|
|
|
*/ |
|
|
|
|
~TrackerMILTargetState() |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
/** @brief Set label: true for target foreground, false for background
|
|
|
|
|
@param foreground Label for background/foreground |
|
|
|
|
*/ |
|
|
|
|
void setTargetFg( bool foreground ); |
|
|
|
|
/** @brief Set the features extracted from TrackerFeatureSet
|
|
|
|
|
@param features The features extracted |
|
|
|
|
*/ |
|
|
|
|
void setFeatures( const Mat& features ); |
|
|
|
|
/** @brief Get the label. Return true for target foreground, false for background
|
|
|
|
|
*/ |
|
|
|
|
bool isTargetFg() const; |
|
|
|
|
/** @brief Get the features extracted
|
|
|
|
|
*/ |
|
|
|
|
Mat getFeatures() const; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
bool isTarget; |
|
|
|
|
Mat targetFeatures; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief Constructor
|
|
|
|
|
@param nFeatures Number of features for each sample |
|
|
|
|
*/ |
|
|
|
|
TrackerStateEstimatorMILBoosting( int nFeatures = 250 ); |
|
|
|
|
~TrackerStateEstimatorMILBoosting(); |
|
|
|
|
|
|
|
|
|
/** @brief Set the current confidenceMap
|
|
|
|
|
@param confidenceMap The current :cConfidenceMap |
|
|
|
|
*/ |
|
|
|
|
void setCurrentConfidenceMap( ConfidenceMap& confidenceMap ); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
Ptr<TrackerTargetState> estimateImpl( const std::vector<ConfidenceMap>& confidenceMaps ) CV_OVERRIDE; |
|
|
|
|
void updateImpl( std::vector<ConfidenceMap>& confidenceMaps ) CV_OVERRIDE; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
uint max_idx( const std::vector<float> &v ); |
|
|
|
|
void prepareData( const ConfidenceMap& confidenceMap, Mat& positive, Mat& negative ); |
|
|
|
|
|
|
|
|
|
ClfMilBoost boostMILModel; |
|
|
|
|
bool trained; |
|
|
|
|
int numFeatures; |
|
|
|
|
|
|
|
|
|
ConfidenceMap currentConfidenceMap; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief TrackerStateEstimatorAdaBoosting based on ADA-Boosting
|
|
|
|
|
*/ |
|
|
|
@ -838,7 +515,7 @@ class CV_EXPORTS TrackerStateEstimatorAdaBoosting : public TrackerStateEstimator |
|
|
|
|
public: |
|
|
|
|
/** @brief Implementation of the target state for TrackerAdaBoostingTargetState
|
|
|
|
|
*/ |
|
|
|
|
class TrackerAdaBoostingTargetState : public TrackerTargetState |
|
|
|
|
class CV_EXPORTS TrackerAdaBoostingTargetState : public TrackerTargetState |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
@ -860,7 +537,7 @@ class CV_EXPORTS TrackerStateEstimatorAdaBoosting : public TrackerStateEstimator |
|
|
|
|
} |
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
/** @brief Set the features extracted from TrackerFeatureSet
|
|
|
|
|
/** @brief Set the features extracted from TrackerContribFeatureSet
|
|
|
|
|
@param responses The features extracted |
|
|
|
|
*/ |
|
|
|
|
void setTargetResponses( const Mat& responses ); |
|
|
|
@ -940,6 +617,7 @@ class CV_EXPORTS TrackerStateEstimatorAdaBoosting : public TrackerStateEstimator |
|
|
|
|
ConfidenceMap currentConfidenceMap; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief TrackerStateEstimator based on SVM |
|
|
|
|
*/ |
|
|
|
@ -954,11 +632,13 @@ class CV_EXPORTS TrackerStateEstimatorSVM : public TrackerStateEstimator |
|
|
|
|
void updateImpl( std::vector<ConfidenceMap>& confidenceMaps ) CV_OVERRIDE; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************ Specific TrackerSamplerAlgorithm Classes ************************************/ |
|
|
|
|
|
|
|
|
|
/** @brief TrackerSampler based on CSC (current state centered), used by MIL algorithm TrackerMIL
|
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerSamplerCSC : public TrackerSamplerAlgorithm |
|
|
|
|
class CV_EXPORTS TrackerContribSamplerCSC : public TrackerContribSamplerAlgorithm |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
enum
|
|
|
|
@ -982,11 +662,11 @@ class CV_EXPORTS TrackerSamplerCSC : public TrackerSamplerAlgorithm |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief Constructor
|
|
|
|
|
@param parameters TrackerSamplerCSC parameters TrackerSamplerCSC::Params |
|
|
|
|
@param parameters TrackerContribSamplerCSC parameters TrackerContribSamplerCSC::Params |
|
|
|
|
*/ |
|
|
|
|
TrackerSamplerCSC( const TrackerSamplerCSC::Params ¶meters = TrackerSamplerCSC::Params() ); |
|
|
|
|
TrackerContribSamplerCSC( const TrackerContribSamplerCSC::Params ¶meters = TrackerContribSamplerCSC::Params() ); |
|
|
|
|
|
|
|
|
|
/** @brief Set the sampling mode of TrackerSamplerCSC
|
|
|
|
|
/** @brief Set the sampling mode of TrackerContribSamplerCSC
|
|
|
|
|
@param samplingMode The sampling mode |
|
|
|
|
|
|
|
|
|
The modes are: |
|
|
|
@ -999,11 +679,11 @@ class CV_EXPORTS TrackerSamplerCSC : public TrackerSamplerAlgorithm |
|
|
|
|
*/ |
|
|
|
|
void setMode( int samplingMode ); |
|
|
|
|
|
|
|
|
|
~TrackerSamplerCSC(); |
|
|
|
|
~TrackerContribSamplerCSC(); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
|
|
|
|
|
bool samplingImpl( const Mat& image, Rect boundingBox, std::vector<Mat>& sample ) CV_OVERRIDE; |
|
|
|
|
bool samplingImpl(const Mat& image, Rect boundingBox, std::vector<Mat>& sample) CV_OVERRIDE; |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
|
@ -1014,9 +694,10 @@ class CV_EXPORTS TrackerSamplerCSC : public TrackerSamplerAlgorithm |
|
|
|
|
std::vector<Mat> sampleImage( const Mat& img, int x, int y, int w, int h, float inrad, float outrad = 0, int maxnum = 1000000 ); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief TrackerSampler based on CS (current state), used by algorithm TrackerBoosting
|
|
|
|
|
|
|
|
|
|
/** @brief TrackerContribSampler based on CS (current state), used by algorithm TrackerBoosting
|
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerSamplerCS : public TrackerSamplerAlgorithm |
|
|
|
|
class CV_EXPORTS TrackerSamplerCS : public TrackerContribSamplerAlgorithm |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
enum
|
|
|
|
@ -1083,7 +764,7 @@ It should be noted, that the definition of "similarity" between two rectangles i |
|
|
|
|
their histograms. As experiments show, tracker is *not* very succesfull if target is assumed to |
|
|
|
|
strongly change its dimensions. |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerSamplerPF : public TrackerSamplerAlgorithm |
|
|
|
|
class CV_EXPORTS TrackerSamplerPF : public TrackerContribSamplerAlgorithm |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
/** @brief This structure contains all the parameters that can be varied during the course of sampling
|
|
|
|
@ -1113,12 +794,14 @@ private: |
|
|
|
|
Ptr<MinProblemSolver::Function> _function; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/************************************ Specific TrackerFeature Classes ************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************ Specific TrackerContribFeature Classes ************************************/ |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief TrackerFeature based on Feature2D |
|
|
|
|
* \brief TrackerContribFeature based on Feature2D |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerFeatureFeature2d : public TrackerFeature |
|
|
|
|
class CV_EXPORTS TrackerFeatureFeature2d : public TrackerContribFeature |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
|
|
|
|
@ -1143,9 +826,9 @@ class CV_EXPORTS TrackerFeatureFeature2d : public TrackerFeature |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief TrackerFeature based on HOG |
|
|
|
|
* \brief TrackerContribFeature based on HOG |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerFeatureHOG : public TrackerFeature |
|
|
|
|
class CV_EXPORTS TrackerFeatureHOG : public TrackerContribFeature |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
|
|
|
|
@ -1161,10 +844,10 @@ class CV_EXPORTS TrackerFeatureHOG : public TrackerFeature |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief TrackerFeature based on HAAR features, used by TrackerMIL and many others algorithms
|
|
|
|
|
/** @brief TrackerContribFeature based on HAAR features, used by TrackerMIL and many others algorithms
|
|
|
|
|
@note HAAR features implementation is copied from apps/traincascade and modified according to MIL |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerFeatureHAAR : public TrackerFeature |
|
|
|
|
class CV_EXPORTS TrackerContribFeatureHAAR : public TrackerContribFeature |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
struct CV_EXPORTS Params |
|
|
|
@ -1176,21 +859,21 @@ class CV_EXPORTS TrackerFeatureHAAR : public TrackerFeature |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** @brief Constructor
|
|
|
|
|
@param parameters TrackerFeatureHAAR parameters TrackerFeatureHAAR::Params |
|
|
|
|
@param parameters TrackerContribFeatureHAAR parameters TrackerContribFeatureHAAR::Params |
|
|
|
|
*/ |
|
|
|
|
TrackerFeatureHAAR( const TrackerFeatureHAAR::Params ¶meters = TrackerFeatureHAAR::Params() ); |
|
|
|
|
TrackerContribFeatureHAAR( const TrackerContribFeatureHAAR::Params ¶meters = TrackerContribFeatureHAAR::Params() ); |
|
|
|
|
|
|
|
|
|
~TrackerFeatureHAAR() CV_OVERRIDE; |
|
|
|
|
~TrackerContribFeatureHAAR() CV_OVERRIDE; |
|
|
|
|
|
|
|
|
|
/** @brief Compute the features only for the selected indices in the images collection
|
|
|
|
|
@param selFeatures indices of selected features |
|
|
|
|
@param images The images |
|
|
|
|
@param response Collection of response for the specific TrackerFeature |
|
|
|
|
@param response Collection of response for the specific TrackerContribFeature |
|
|
|
|
*/ |
|
|
|
|
bool extractSelected( const std::vector<int> selFeatures, const std::vector<Mat>& images, Mat& response ); |
|
|
|
|
|
|
|
|
|
/** @brief Identify most effective features
|
|
|
|
|
@param response Collection of response for the specific TrackerFeature |
|
|
|
|
@param response Collection of response for the specific TrackerContribFeature |
|
|
|
|
@param npoints Max number of features |
|
|
|
|
|
|
|
|
|
@note This method modifies the response parameter |
|
|
|
@ -1224,9 +907,9 @@ class CV_EXPORTS TrackerFeatureHAAR : public TrackerFeature |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief TrackerFeature based on LBP |
|
|
|
|
* \brief TrackerContribFeature based on LBP |
|
|
|
|
*/ |
|
|
|
|
class CV_EXPORTS TrackerFeatureLBP : public TrackerFeature |
|
|
|
|
class CV_EXPORTS TrackerFeatureLBP : public TrackerContribFeature |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|