Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes

mrpt::vision::CGenericFeatureTracker Struct Reference


Detailed Description

A virtual interface for all feature trackers, implementing the part of feature tracking that is common to any specific tracker implementation.

This class provides a quite robust tracking of features, avoiding as many outliers as possible but not all of them: more robust tracking would require application-specific information and could be done in a number of very different approaches, so this class will not try to do any kind of RANSAC or any other advanced outlier rejection; instead, it should be done by the users or the classes that employ this class.

The basic usage of this class is as follows:

       CFeatureTracker_KL    tracker;  // Note: CFeatureTracker_KL is the most robust implementation for now.
       tracker.extra_params["add_new_features"] = 1;  // Enable detection of new features, not only tracking
       tracker.extra_params[...] = ...
       // ....
       CFeatureList     theFeats;  // The list of features
       mrpt::utils::CImage  previous_img, current_img;

       while (true) {
           current_img = ... // Grab new image.
           if ( previous_img_is_ok )
               tracker.trackFeatures(previous_img, current_img, theFeats);
           previous_img = current_img;
       }

Below follows the list of optional parameters for "extra_params" which can be set and will be understood by this base class for any specific tracker implementation. Note that all parameters are double's, but boolean flags are emulated by the values 0.0 (false) and 1.0 (true).

List of parameters:

Parameter name Default value Comments
add_new_features 0 If set to "1", the class will not only track existing features, but will also perform (after doing the actual tracking) an efficient search for new features with the FAST detector, and will add them to the passed "CFeatureList" if they fulfill a set of restrictions, as stablished by the other parameters (see add_new_feat_min_separation,add_new_feat_max_features,minimum_KLT_response_to_add).
add_new_feat_min_separation 15 If add_new_features==1, this is the minimum separation (in pixels) to any other (old, or new) feature for it being considered a candidate to be added.
add_new_feat_max_features 100 If add_new_features==1, FAST features are detected in each frame, and only the best add_new_feat_max_features keypoints (ordered by their KLT response) will be considered as eligible for addition to the set of tracked features.
add_new_feat_patch_size 11 If add_new_features==1, for each new added feature, this is the size of the patch to be extracted around the keypoint (set to 0 if patches are not required at all).
minimum_KLT_response_to_add 10 If add_new_features==1, this sets the minimum KLT response of candidate FAST features to be added in each frame, if they also fulfil the other restrictions (e.g. min.distance).
check_KLT_response_every 0 If >0, it will compute the KLT response at each feature point every N frames and those below minimum_KLT_response will be marked as "lost" in their "track_status" field.
minimum_KLT_response 5 See explanation of check_KLT_response_every.
KLT_response_half_win 4 When computing the KLT response of features (see minimum_KLT_response and minimum_KLT_response_to_add), the window centered at the point for its estimation will be of size (2*W+1)x(2*W+1), with W being this parameter value.
update_patches_every 0 If !=0, the patch associated to each feature will be updated with every N'th frame.

This class also offers a time profiler, disabled by default (see getProfiler and enableTimeLogger).

See also:
CFeatureTracker_KL, the example application "track-video-features".

Definition at line 135 of file tracking.h.

#include <mrpt/vision/tracking.h>

Inheritance diagram for mrpt::vision::CGenericFeatureTracker:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CGenericFeatureTracker ()
 Default ctor.
 CGenericFeatureTracker (mrpt::utils::TParametersDouble extraParams)
 Ctor with extra parameters.
virtual ~CGenericFeatureTracker ()
 Dtor.
void trackFeatures (const CImage &old_img, const CImage &new_img, vision::CFeatureList &inout_featureList)
 Perform feature tracking from "old_img" to "new_img", with a (possibly empty) list of previously tracked features "inout_featureList".
void trackFeaturesNewList (const CImage &old_img, const CImage &new_img, const vision::CFeatureList &in_featureList, vision::CFeatureList &out_featureList)
 A wrapper around the basic trackFeatures() method, but keeping the original list of features unmodified and returns the tracked ones in a new list.
const mrpt::utils::CTimeLoggergetProfiler () const
 Returns a read-only reference to the internal time logger.
mrpt::utils::CTimeLoggergetProfiler ()
 Returns a reference to the internal time logger.
void enableTimeLogger (bool enable=true)
 Returns a read-only reference to the internal time logger.

Public Attributes

mrpt::utils::TParametersDouble extra_params
 Optional list of extra parameters to the algorithm.

Protected Member Functions

virtual void trackFeatures_impl (const CImage &old_img, const CImage &new_img, vision::CFeatureList &inout_featureList)=0
 The tracking method implementation, to be implemented in children classes.

Protected Attributes

mrpt::utils::CTimeLogger m_timlog
 the internal time logger, disabled by default.

Private Attributes

size_t m_update_patches_counter
 for use when "update_patches_every">=1
size_t m_check_KLT_counter
 For use when "check_KLT_response_every">=1.
int m_detector_adaptive_thres
 For use in "add_new_features" == true.

Constructor & Destructor Documentation

mrpt::vision::CGenericFeatureTracker::CGenericFeatureTracker (  ) [inline]

Default ctor.

Definition at line 141 of file tracking.h.

mrpt::vision::CGenericFeatureTracker::CGenericFeatureTracker ( mrpt::utils::TParametersDouble  extraParams ) [inline]

Ctor with extra parameters.

Definition at line 144 of file tracking.h.

virtual mrpt::vision::CGenericFeatureTracker::~CGenericFeatureTracker (  ) [inline, virtual]

Dtor.

Definition at line 147 of file tracking.h.


Member Function Documentation

void mrpt::vision::CGenericFeatureTracker::enableTimeLogger ( bool  enable = true ) [inline]

Returns a read-only reference to the internal time logger.

Definition at line 184 of file tracking.h.

const mrpt::utils::CTimeLogger& mrpt::vision::CGenericFeatureTracker::getProfiler (  ) const [inline]

Returns a read-only reference to the internal time logger.

Definition at line 179 of file tracking.h.

mrpt::utils::CTimeLogger& mrpt::vision::CGenericFeatureTracker::getProfiler (  ) [inline]

Returns a reference to the internal time logger.

Definition at line 181 of file tracking.h.

void mrpt::vision::CGenericFeatureTracker::trackFeatures ( const CImage old_img,
const CImage new_img,
vision::CFeatureList inout_featureList 
)

Perform feature tracking from "old_img" to "new_img", with a (possibly empty) list of previously tracked features "inout_featureList".

This is a list of parameters (in "extraParams") accepted by ALL implementations of feature tracker (see each derived class for more specific parameters).

  • "add_new_features" (Default=0). If set to "1", new features will be also added to the existing ones in areas of the image poor of features. This method does:

Convert old and new images to grayscale, if they're in color.

  • Call the pure virtual "trackFeatures_impl" method.
  • Implement the optional detection of new features if "add_new_features"!=0.
virtual void mrpt::vision::CGenericFeatureTracker::trackFeatures_impl ( const CImage old_img,
const CImage new_img,
vision::CFeatureList inout_featureList 
) [protected, pure virtual]

The tracking method implementation, to be implemented in children classes.

Implemented in mrpt::vision::CFeatureTracker_KL, mrpt::vision::CFeatureTracker_FAST, and mrpt::vision::CFeatureTracker_PatchMatch.

void mrpt::vision::CGenericFeatureTracker::trackFeaturesNewList ( const CImage old_img,
const CImage new_img,
const vision::CFeatureList in_featureList,
vision::CFeatureList out_featureList 
) [inline]

A wrapper around the basic trackFeatures() method, but keeping the original list of features unmodified and returns the tracked ones in a new list.

Definition at line 164 of file tracking.h.

References mrpt::vision::CFeatureList::begin(), and mrpt::vision::CFeatureList::end().


Member Data Documentation

Optional list of extra parameters to the algorithm.

Definition at line 138 of file tracking.h.

For use when "check_KLT_response_every">=1.

Definition at line 197 of file tracking.h.

For use in "add_new_features" == true.

Reimplemented in mrpt::vision::CFeatureTracker_FAST.

Definition at line 198 of file tracking.h.

the internal time logger, disabled by default.

Definition at line 193 of file tracking.h.

for use when "update_patches_every">=1

Definition at line 196 of file tracking.h.




Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:46:17 UTC 2011