MRPT
1.9.9
|
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:
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 <td align="center"
| 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 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).
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.
desired_num_features_adapt
(img_width*img_height)/512
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.
desired_num_features
100
If add_new_features==1, the target number of the patch associated to each feature will be updated with every N'th frame.
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 <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.
update_patches_every
0
If !=0, the patch associated to each feature will be updated with every N'th frame.
remove_lost_features
0
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).
Definition at line 141 of file tracking.h.
#include <mrpt/vision/tracking.h>
Classes | |
struct | TExtraOutputInfo |
Public Member Functions | |
CGenericFeatureTracker () | |
Default ctor. More... | |
CGenericFeatureTracker (mrpt::system::TParametersDouble extraParams) | |
Ctor with extra parameters. More... | |
virtual | ~CGenericFeatureTracker ()=default |
Dtor. More... | |
void | trackFeatures (const mrpt::img::CImage &old_img, const mrpt::img::CImage &new_img, TKeyPointList &inout_featureList) |
Perform feature tracking from "old_img" to "new_img", with a (possibly empty) list of previously tracked features "inout_featureList". More... | |
void | trackFeatures (const mrpt::img::CImage &old_img, const mrpt::img::CImage &new_img, TKeyPointfList &inout_featureList) |
overload with subpixel precision More... | |
const mrpt::system::CTimeLogger & | getProfiler () const |
Returns a read-only reference to the internal time logger. More... | |
mrpt::system::CTimeLogger & | getProfiler () |
Returns a reference to the internal time logger. More... | |
void | enableTimeLogger (bool enable=true) |
Returns a read-only reference to the internal time logger. More... | |
int | getDetectorAdaptiveThreshold () const |
Returns the current adaptive threshold used by the FAST(ER) detector to find out new features in empty areas. More... | |
Public Attributes | |
mrpt::system::TParametersDouble | extra_params |
Optional list of extra parameters to the algorithm. More... | |
TExtraOutputInfo | last_execution_extra_info |
Updated with each call to trackFeatures() More... | |
Protected Member Functions | |
virtual void | trackFeatures_impl (const mrpt::img::CImage &old_img, const mrpt::img::CImage &new_img, TKeyPointfList &inout_featureList) |
The tracking method implementation, to be implemented in children classes. More... | |
virtual void | trackFeatures_impl (const mrpt::img::CImage &old_img, const mrpt::img::CImage &new_img, TKeyPointList &inout_featureList)=0 |
The tracking method implementation, to be implemented in children classes. More... | |
void | updateAdaptiveNewFeatsThreshold (const size_t nNewlyDetectedFeats, const size_t desired_num_features) |
Adapts the threshold m_detector_adaptive_thres according to the real and desired number of features just detected. More... | |
Protected Attributes | |
mrpt::system::CTimeLogger | m_timlog |
the internal time logger, disabled by default. More... | |
mrpt::vision::TKeyPointList | m_newly_detected_feats |
This field is clared by trackFeatures() before calling trackFeatures_impl(), and can be filled out with newly defected FAST(ER) features in the latter. More... | |
Private Member Functions | |
template<typename FEATLIST > | |
void | internal_trackFeatures (const mrpt::img::CImage &old_img, const mrpt::img::CImage &new_img, FEATLIST &inout_featureList) |
Perform feature tracking from "old_img" to "new_img", with a (possibly empty) list of previously tracked features "featureList". More... | |
Private Attributes | |
size_t | m_update_patches_counter {0} |
for use when "update_patches_every">=1 More... | |
size_t | m_check_KLT_counter {0} |
For use when "check_KLT_response_every">=1. More... | |
int | m_detector_adaptive_thres {10} |
For use in "add_new_features" == true. More... | |
|
inline |
Default ctor.
Definition at line 147 of file tracking.h.
|
inline |
Ctor with extra parameters.
Definition at line 149 of file tracking.h.
|
virtualdefault |
Dtor.
|
inline |
Returns a read-only reference to the internal time logger.
Definition at line 190 of file tracking.h.
References mrpt::system::CTimeLogger::enable(), and m_timlog.
|
inline |
Returns the current adaptive threshold used by the FAST(ER) detector to find out new features in empty areas.
Definition at line 197 of file tracking.h.
References m_detector_adaptive_thres.
|
inline |
Returns a read-only reference to the internal time logger.
Definition at line 183 of file tracking.h.
References m_timlog.
|
inline |
Returns a reference to the internal time logger.
Definition at line 188 of file tracking.h.
References m_timlog.
|
private |
Perform feature tracking from "old_img" to "new_img", with a (possibly empty) list of previously tracked features "featureList".
This is a list of parameters (in "extraParams") accepted by ALL implementations of feature tracker (see each derived class for more specific parameters).
Definition at line 444 of file tracking.cpp.
References mrpt::vision::CFeatureExtraction::detectFeatures(), mrpt::img::FAST_REF_OR_CONVERT_TO_GRAY, mrpt::vision::CFeatureExtraction::TOptions::FASTOptions, mrpt::vision::featFAST, mrpt::vision::CFeatureExtraction::TOptions::featsType, mrpt::img::CImage::getHeight(), mrpt::img::CImage::getWidth(), mrpt::img::CImage::KLT_response(), mrpt::vision::CFeatureExtraction::options, mrpt::vision::CFeatureList::size(), mrpt::square(), mrpt::vision::CFeatureExtraction::TOptions::TFASTOptions::threshold, mrpt::vision::detail::trackFeatures_addNewFeats(), mrpt::vision::detail::trackFeatures_checkResponses(), mrpt::vision::detail::trackFeatures_deleteOOB(), and mrpt::vision::detail::trackFeatures_updatePatch().
void CGenericFeatureTracker::trackFeatures | ( | const mrpt::img::CImage & | old_img, |
const mrpt::img::CImage & | new_img, | ||
TKeyPointList & | 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).
Convert old and new images to grayscale, if they're in color.
Definition at line 647 of file tracking.cpp.
void CGenericFeatureTracker::trackFeatures | ( | const mrpt::img::CImage & | old_img, |
const mrpt::img::CImage & | new_img, | ||
TKeyPointfList & | inout_featureList | ||
) |
overload with subpixel precision
Definition at line 653 of file tracking.cpp.
|
protectedvirtual |
The tracking method implementation, to be implemented in children classes.
Reimplemented in mrpt::vision::CFeatureTracker_KL.
|
protectedpure virtual |
The tracking method implementation, to be implemented in children classes.
Implemented in mrpt::vision::CFeatureTracker_KL.
|
protected |
Adapts the threshold m_detector_adaptive_thres according to the real and desired number of features just detected.
Definition at line 659 of file tracking.cpp.
mrpt::system::TParametersDouble mrpt::vision::CGenericFeatureTracker::extra_params |
Optional list of extra parameters to the algorithm.
Definition at line 144 of file tracking.h.
TExtraOutputInfo mrpt::vision::CGenericFeatureTracker::last_execution_extra_info |
Updated with each call to trackFeatures()
Definition at line 212 of file tracking.h.
|
private |
For use when "check_KLT_response_every">=1.
Definition at line 247 of file tracking.h.
|
private |
For use in "add_new_features" == true.
Definition at line 249 of file tracking.h.
Referenced by getDetectorAdaptiveThreshold().
|
protected |
This field is clared by trackFeatures() before calling trackFeatures_impl(), and can be filled out with newly defected FAST(ER) features in the latter.
If it's not the case, feats will be computed anyway if the user enabled the "add_new_features" option.
Definition at line 236 of file tracking.h.
|
protected |
the internal time logger, disabled by default.
Definition at line 228 of file tracking.h.
Referenced by enableTimeLogger(), and getProfiler().
|
private |
for use when "update_patches_every">=1
Definition at line 245 of file tracking.h.
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020 |