mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 02:16:34 +08:00

Modified Copyrights Moved plantuml source files under doc disabled tests Added include of precomp.hpp
507 lines
16 KiB
ReStructuredText
507 lines
16 KiB
ReStructuredText
Common Interfaces of TrackerModel
|
|
=================================
|
|
|
|
.. highlight:: cpp
|
|
|
|
ConfidenceMap
|
|
-------------
|
|
|
|
Represents the model of the target at frame :math:`k` (all states and scores)
|
|
|
|
[AAM]_ The set of the pair :math:`\langle \hat{x}^{i}_{k}, C^{i}_{k} \rangle`
|
|
|
|
.. c:type:: ConfidenceMap
|
|
|
|
ConfidenceMap::
|
|
|
|
typedef std::vector<std::pair<Ptr<TrackerTargetState>, float> > ConfidenceMap;
|
|
|
|
.. seealso::
|
|
|
|
:ocv:class:`TrackerTargetState`
|
|
|
|
Trajectory
|
|
----------
|
|
|
|
Represents the estimate states for all frames
|
|
|
|
[AAM]_ :math:`x_{k}` is the trajectory of the target up to time :math:`k`
|
|
|
|
.. c:type:: Trajectory
|
|
|
|
Trajectory::
|
|
|
|
typedef std::vector<Ptr<TrackerTargetState> > Trajectory;
|
|
|
|
.. seealso::
|
|
|
|
:ocv:class:`TrackerTargetState`
|
|
|
|
TrackerTargetState
|
|
------------------
|
|
|
|
Abstract base class for TrackerTargetState that represents a possible state of the target.
|
|
|
|
[AAM]_ :math:`\hat{x}^{i}_{k}` all the states candidates.
|
|
|
|
Inherits this class with your Target state
|
|
|
|
.. ocv:class:: TrackerTargetState
|
|
|
|
TrackerTargetState class::
|
|
|
|
class CV_EXPORTS_W TrackerTargetState
|
|
{
|
|
public:
|
|
virtual ~TrackerTargetState(){};
|
|
|
|
Point2f getTargetPosition() const;
|
|
void setTargetPosition( const Point2f& position );
|
|
|
|
int getTargetWidth() const;
|
|
void setTargetWidth( int width );
|
|
|
|
int getTargetHeight() const;
|
|
void setTargetHeight( int height );
|
|
|
|
};
|
|
|
|
In own implementation you can add scale variation, width, height, orientation, etc.
|
|
|
|
|
|
TrackerStateEstimator
|
|
---------------------
|
|
|
|
Abstract base class for TrackerStateEstimator that estimates the most likely target state.
|
|
|
|
[AAM]_ State estimator
|
|
|
|
[AMVOT]_ Statistical modeling (Fig. 3), Table III (generative) - IV (discriminative) - V (hybrid)
|
|
|
|
.. ocv:class:: TrackerStateEstimator
|
|
|
|
TrackerStateEstimator class::
|
|
|
|
class CV_EXPORTS_W TrackerStateEstimator
|
|
{
|
|
public:
|
|
virtual ~TrackerStateEstimator();
|
|
|
|
static Ptr<TrackerStateEstimator> create( const String& trackeStateEstimatorType );
|
|
|
|
Ptr<TrackerTargetState> estimate( const std::vector<ConfidenceMap>& confidenceMaps );
|
|
void update( std::vector<ConfidenceMap>& confidenceMaps );
|
|
|
|
String getClassName() const;
|
|
|
|
};
|
|
|
|
TrackerStateEstimator::create
|
|
-----------------------------
|
|
|
|
Create TrackerStateEstimator by tracker state estimator type
|
|
|
|
.. ocv:function:: static Ptr<TrackerStateEstimator> TrackerStateEstimator::create( const String& trackeStateEstimatorType )
|
|
|
|
:param trackeStateEstimatorType: The TrackerStateEstimator name
|
|
|
|
The modes available now:
|
|
|
|
* ``"BOOSTING"`` -- Boosting-based discriminative appearance models. See [AMVOT]_ section 4.4
|
|
|
|
The modes available soon:
|
|
|
|
* ``"SVM"`` -- SVM-based discriminative appearance models. See [AMVOT]_ section 4.5
|
|
|
|
TrackerStateEstimator::estimate
|
|
-------------------------------
|
|
|
|
Estimate the most likely target state, return the estimated state
|
|
|
|
.. ocv:function:: Ptr<TrackerTargetState> TrackerStateEstimator::estimate( const std::vector<ConfidenceMap>& confidenceMaps )
|
|
|
|
:param confidenceMaps: The overall appearance model as a list of :c:type:`ConfidenceMap`
|
|
|
|
TrackerStateEstimator::update
|
|
-----------------------------
|
|
|
|
Update the ConfidenceMap with the scores
|
|
|
|
.. ocv:function:: void TrackerStateEstimator::update( std::vector<ConfidenceMap>& confidenceMaps )
|
|
|
|
:param confidenceMaps: The overall appearance model as a list of :c:type:`ConfidenceMap`
|
|
|
|
TrackerStateEstimator::getClassName
|
|
-----------------------------------
|
|
|
|
Get the name of the specific TrackerStateEstimator
|
|
|
|
.. ocv:function:: String TrackerStateEstimator::getClassName() const
|
|
|
|
TrackerModel
|
|
------------
|
|
|
|
Abstract class that represents the model of the target. It must be instantiated by specialized tracker
|
|
|
|
[AAM]_ Ak
|
|
|
|
Inherits this with your TrackerModel
|
|
|
|
.. ocv:class:: TrackerModel
|
|
|
|
TrackerModel class::
|
|
|
|
class CV_EXPORTS_W TrackerModel
|
|
{
|
|
public:
|
|
|
|
TrackerModel();
|
|
virtual ~TrackerModel();
|
|
|
|
void modelEstimation( const std::vector<Mat>& responses );
|
|
void modelUpdate();
|
|
bool runStateEstimator();
|
|
|
|
bool setTrackerStateEstimator( Ptr<TrackerStateEstimator> trackerStateEstimator );
|
|
void setLastTargetState( const Ptr<TrackerTargetState>& lastTargetState );
|
|
|
|
Ptr<TrackerTargetState> getLastTargetState() const;
|
|
const std::vector<ConfidenceMap>& getConfidenceMaps() const;
|
|
const ConfidenceMap& getLastConfidenceMap() const;
|
|
Ptr<TrackerStateEstimator> getTrackerStateEstimator() const;
|
|
};
|
|
|
|
TrackerModel::modelEstimation
|
|
-----------------------------
|
|
|
|
Estimate the most likely target location
|
|
|
|
[AAM]_ ME, Model Estimation table I
|
|
|
|
.. ocv:function:: void TrackerModel::modelEstimation( const std::vector<Mat>& responses )
|
|
|
|
:param responses: Features extracted from :ocv:class:`TrackerFeatureSet`
|
|
|
|
|
|
TrackerModel::modelUpdate
|
|
-------------------------
|
|
|
|
Update the model
|
|
|
|
[AAM]_ MU, Model Update table I
|
|
|
|
.. ocv:function:: void TrackerModel::modelUpdate()
|
|
|
|
|
|
TrackerModel::runStateEstimator
|
|
-------------------------------
|
|
|
|
Run the TrackerStateEstimator, return true if is possible to estimate a new state, false otherwise
|
|
|
|
.. ocv:function:: bool TrackerModel::runStateEstimator()
|
|
|
|
TrackerModel::setTrackerStateEstimator
|
|
--------------------------------------
|
|
|
|
Set TrackerEstimator, return true if the tracker state estimator is added, false otherwise
|
|
|
|
.. ocv:function:: bool TrackerModel::setTrackerStateEstimator( Ptr<TrackerStateEstimator> trackerStateEstimator )
|
|
|
|
:param trackerStateEstimator: The :ocv:class:`TrackerStateEstimator`
|
|
|
|
.. note:: You can add only one :ocv:class:`TrackerStateEstimator`
|
|
|
|
TrackerModel::setLastTargetState
|
|
--------------------------------
|
|
|
|
Set the current :ocv:class:`TrackerTargetState` in the :c:type:`Trajectory`
|
|
|
|
.. ocv:function:: void TrackerModel::setLastTargetState( const Ptr<TrackerTargetState>& lastTargetState )
|
|
|
|
:param lastTargetState: The current :ocv:class:`TrackerTargetState`
|
|
|
|
|
|
TrackerModel::getLastTargetState
|
|
--------------------------------
|
|
|
|
Get the last :ocv:class:`TrackerTargetState` from :c:type:`Trajectory`
|
|
|
|
.. ocv:function:: Ptr<TrackerTargetState> TrackerModel::getLastTargetState() const
|
|
|
|
|
|
TrackerModel::getConfidenceMaps
|
|
-------------------------------
|
|
|
|
Get the list of the :c:type:`ConfidenceMap`
|
|
|
|
.. ocv:function:: const std::vector<ConfidenceMap>& TrackerModel::getConfidenceMaps() const
|
|
|
|
TrackerModel::getLastConfidenceMap
|
|
----------------------------------
|
|
|
|
Get the last :c:type:`ConfidenceMap` for the current frame
|
|
|
|
.. ocv:function:: const ConfidenceMap& TrackerModel::getLastConfidenceMap() const
|
|
|
|
TrackerModel::getTrackerStateEstimator
|
|
--------------------------------------
|
|
|
|
Get the :ocv:class:`TrackerStateEstimator`
|
|
|
|
.. ocv:function:: Ptr<TrackerStateEstimator> TrackerModel::getTrackerStateEstimator() const
|
|
|
|
Specialized TrackerStateEstimator
|
|
=================================
|
|
|
|
In [AMVOT]_ Statistical modeling (Fig. 3), Table III (generative) - IV (discriminative) - V (hybrid) are described the most known statistical model.
|
|
|
|
At moment :ocv:class:`TrackerStateEstimatorMILBoosting` and :ocv:class:`TrackerStateEstimatorAdaBoosting` are implemented.
|
|
|
|
TrackerStateEstimatorMILBoosting : TrackerStateEstimator
|
|
--------------------------------------------------------
|
|
|
|
TrackerStateEstimator based on Boosting
|
|
|
|
.. ocv:class:: TrackerStateEstimatorMILBoosting
|
|
|
|
TrackerStateEstimatorMILBoosting class::
|
|
|
|
class CV_EXPORTS_W TrackerStateEstimatorMILBoosting : public TrackerStateEstimator
|
|
{
|
|
public:
|
|
class TrackerMILTargetState : public TrackerTargetState
|
|
{
|
|
...
|
|
};
|
|
TrackerStateEstimatorMILBoosting( int nFeatures = 250 );
|
|
~TrackerStateEstimatorMILBoosting();
|
|
|
|
void setCurrentConfidenceMap( ConfidenceMap& confidenceMap );
|
|
};
|
|
|
|
TrackerMILTargetState : TrackerTargetState
|
|
------------------------------------------
|
|
|
|
Implementation of the target state for TrackerMILTargetState
|
|
|
|
.. ocv:class:: TrackerMILTargetState
|
|
|
|
TrackerMILTargetState class::
|
|
|
|
class TrackerMILTargetState : public TrackerTargetState
|
|
{
|
|
public:
|
|
TrackerMILTargetState( const Point2f& position, int targetWidth, int targetHeight, bool foreground, const Mat& features );
|
|
~TrackerMILTargetState(){};
|
|
|
|
void setTargetFg( bool foreground );
|
|
void setFeatures( const Mat& features );
|
|
bool isTargetFg() const;
|
|
Mat getFeatures() const;
|
|
};
|
|
|
|
TrackerStateEstimatorMILBoosting::TrackerMILTargetState::setTargetFg
|
|
--------------------------------------------------------------------
|
|
|
|
Set label: true for target foreground, false for background
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorMILBoosting::TrackerMILTargetState::setTargetFg( bool foreground )
|
|
|
|
:param foreground: Label for background/foreground
|
|
|
|
TrackerStateEstimatorMILBoosting::TrackerMILTargetState::setFeatures
|
|
--------------------------------------------------------------------
|
|
|
|
Set the features extracted from :ocv:class:`TrackerFeatureSet`
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorMILBoosting::TrackerMILTargetState::setFeatures( const Mat& features )
|
|
|
|
:param features: The features extracted
|
|
|
|
TrackerStateEstimatorMILBoosting::TrackerMILTargetState::isTargetFg
|
|
-------------------------------------------------------------------
|
|
|
|
Get the label. Return true for target foreground, false for background
|
|
|
|
.. ocv:function:: bool TrackerStateEstimatorMILBoosting::TrackerMILTargetState::isTargetFg() const
|
|
|
|
TrackerStateEstimatorMILBoosting::TrackerMILTargetState::getFeatures
|
|
--------------------------------------------------------------------
|
|
|
|
Get the features extracted
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorMILBoosting::TrackerMILTargetState::setFeatures( const Mat& features )
|
|
|
|
TrackerStateEstimatorMILBoosting::TrackerStateEstimatorMILBoosting
|
|
------------------------------------------------------------------
|
|
|
|
Constructor
|
|
|
|
.. ocv:function:: TrackerStateEstimatorMILBoosting::TrackerStateEstimatorMILBoosting( int nFeatures=250 )
|
|
|
|
:param nFeatures: Number of features for each sample
|
|
|
|
TrackerStateEstimatorMILBoosting::setCurrentConfidenceMap
|
|
---------------------------------------------------------
|
|
|
|
Set the current confidenceMap
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorMILBoosting::setCurrentConfidenceMap( ConfidenceMap& confidenceMap )
|
|
|
|
:param confidenceMap: The current :c:type:`ConfidenceMap`
|
|
|
|
TrackerStateEstimatorAdaBoosting : TrackerStateEstimator
|
|
--------------------------------------------------------
|
|
|
|
TrackerStateEstimatorAdaBoosting based on ADA-Boosting
|
|
|
|
.. ocv:class:: TrackerStateEstimatorAdaBoosting
|
|
|
|
TrackerStateEstimatorAdaBoosting class::
|
|
|
|
class CV_EXPORTS_W TrackerStateEstimatorAdaBoosting : public TrackerStateEstimator
|
|
{
|
|
public:
|
|
class TrackerAdaBoostingTargetState : public TrackerTargetState
|
|
{
|
|
...
|
|
};
|
|
TrackerStateEstimatorAdaBoosting( int numClassifer, int initIterations, int nFeatures, Size patchSize, const Rect& ROI, const std::vector<std::pair<float, float> >& meanSigma );
|
|
~TrackerStateEstimatorAdaBoosting();
|
|
|
|
Rect getSampleROI() const;
|
|
void setSampleROI( const Rect& ROI );
|
|
void setCurrentConfidenceMap( ConfidenceMap& confidenceMap );
|
|
std::vector<int> computeSelectedWeakClassifier();
|
|
std::vector<int> computeReplacedClassifier();
|
|
std::vector<int> computeSwappedClassifier();
|
|
void setMeanSigmaPair( const std::vector<std::pair<float, float> >& meanSigmaPair );
|
|
};
|
|
|
|
TrackerAdaBoostingTargetState : TrackerTargetState
|
|
--------------------------------------------------
|
|
|
|
Implementation of the target state for TrackerAdaBoostingTargetState
|
|
|
|
.. ocv:class:: TrackerAdaBoostingTargetState
|
|
|
|
TrackerAdaBoostingTargetState class::
|
|
|
|
class TrackerAdaBoostingTargetState : public TrackerTargetState
|
|
{
|
|
public:
|
|
TrackerAdaBoostingTargetState( const Point2f& position, int width, int height, bool foreground, const Mat& responses );
|
|
~TrackerAdaBoostingTargetState(){};
|
|
|
|
void setTargetResponses( const Mat& responses );
|
|
void setTargetFg( bool foreground );
|
|
Mat getTargetResponses() const;
|
|
bool isTargetFg() const;
|
|
};
|
|
|
|
TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::setTargetFg
|
|
----------------------------------------------------------------------------
|
|
|
|
Set label: true for target foreground, false for background
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::setTargetFg( bool foreground )
|
|
|
|
:param foreground: Label for background/foreground
|
|
|
|
TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::setTargetResponses
|
|
-----------------------------------------------------------------------------------
|
|
|
|
Set the features extracted from :ocv:class:`TrackerFeatureSet`
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::setTargetResponses( const Mat& responses )
|
|
|
|
:param responses: The features extracted
|
|
|
|
TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::isTargetFg
|
|
---------------------------------------------------------------------------
|
|
|
|
Get the label. Return true for target foreground, false for background
|
|
|
|
.. ocv:function:: bool TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::isTargetFg() const
|
|
|
|
TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::getTargetResponses
|
|
-----------------------------------------------------------------------------------
|
|
|
|
Get the features extracted
|
|
|
|
.. ocv:function:: Mat TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState::getTargetResponses()
|
|
|
|
TrackerStateEstimatorAdaBoosting::TrackerStateEstimatorAdaBoosting
|
|
------------------------------------------------------------------
|
|
|
|
Constructor
|
|
|
|
.. ocv:function:: TrackerStateEstimatorAdaBoosting::TrackerStateEstimatorAdaBoosting( int numClassifer, int initIterations, int nFeatures, Size patchSize, const Rect& ROI, const std::vector<std::pair<float, float> >& meanSigma )
|
|
|
|
:param numClassifer: Number of base classifiers
|
|
|
|
:param initIterations: Number of iterations in the initialization
|
|
|
|
:param nFeatures: Number of features/weak classifiers
|
|
|
|
:param patchSize: tracking rect
|
|
|
|
:param ROI: initial ROI
|
|
|
|
:param meanSigma: pairs of mean/sigma
|
|
|
|
TrackerStateEstimatorAdaBoosting::setCurrentConfidenceMap
|
|
---------------------------------------------------------
|
|
|
|
Set the current confidenceMap
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorAdaBoosting::setCurrentConfidenceMap( ConfidenceMap& confidenceMap )
|
|
|
|
:param confidenceMap: The current :c:type:`ConfidenceMap`
|
|
|
|
TrackerStateEstimatorAdaBoosting::getSampleROI
|
|
----------------------------------------------
|
|
|
|
Get the sampling ROI
|
|
|
|
.. ocv:function:: Rect TrackerStateEstimatorAdaBoosting::getSampleROI() const
|
|
|
|
TrackerStateEstimatorAdaBoosting::setSampleROI
|
|
----------------------------------------------
|
|
|
|
Set the sampling ROI
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorAdaBoosting::setSampleROI( const Rect& ROI )
|
|
|
|
:param ROI: the sampling ROI
|
|
|
|
TrackerStateEstimatorAdaBoosting::computeSelectedWeakClassifier
|
|
---------------------------------------------------------------
|
|
|
|
Get the list of the selected weak classifiers for the classification step
|
|
|
|
.. ocv:function:: std::vector<int> TrackerStateEstimatorAdaBoosting::computeSelectedWeakClassifier()
|
|
|
|
TrackerStateEstimatorAdaBoosting::computeReplacedClassifier
|
|
-----------------------------------------------------------
|
|
|
|
Get the list of the weak classifiers that should be replaced
|
|
|
|
.. ocv:function:: std::vector<int> TrackerStateEstimatorAdaBoosting::computeReplacedClassifier()
|
|
|
|
TrackerStateEstimatorAdaBoosting::computeSwappedClassifier
|
|
----------------------------------------------------------
|
|
|
|
Get the list of the weak classifiers that replace those to be replaced
|
|
|
|
.. ocv:function:: std::vector<int> TrackerStateEstimatorAdaBoosting::computeSwappedClassifier()
|
|
|
|
TrackerStateEstimatorAdaBoosting::setMeanSigmaPair
|
|
--------------------------------------------------
|
|
|
|
Set the mean/sigma to instantiate possibly new classifiers
|
|
|
|
.. ocv:function:: void TrackerStateEstimatorAdaBoosting::setMeanSigmaPair( const std::vector<std::pair<float, float> >& meanSigmaPair )
|
|
|
|
:param meanSigmaPair: the mean/sigma pairs
|