struct mrpt::vision::CGenericFeatureTracker


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[...] = ...
      // ....
      TKeyPointList theFeats;  // The list of features
      mrpt::img::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:



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 feature list 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).



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.



If add_new_features ==1, the threshold of the FAST(ER) feature detector is dynamically adapted such as the number of raw FAST keypoints is around this number. This number should be much higher than the real desired numbre of features, since this one includes many features concentrated in space which are later discarded for the minimum distance.



If add_new_features ==1, the target number of the patch associated to each feature will be updated with every N’th frame.



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).



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).



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.



See explanation of check_KLT_response_every.

KLT_response_half_win <td align=”center” 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.



If !=0, the patch associated to each feature will be updated with every N’th frame.



If !=0, out-of-bound features or those lost while tracking, will be automatically removed from the list of features. Otherwise, the user will have to manually remove them by checking the track_status field.

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

See also:

CFeatureTracker_KL, the example application “track-video-features”.

#include <mrpt/vision/tracking.h>

struct CGenericFeatureTracker
    // structs

    struct TExtraOutputInfo;

    // construction

    CGenericFeatureTracker(const mrpt::containers::yaml& extraParams);

// direct descendants

struct CFeatureTracker_KL;



Default ctor.

CGenericFeatureTracker(const mrpt::containers::yaml& extraParams)

Ctor with extra parameters.