32 TrackerFeatures::TrackerFeatures(
int _max_features, 
int _min_features, 
double _quality_level, 
double _min_distance, 
int _pyr_levels, 
int _win_size) :
    33         x_res(0), y_res(0), frame_count(0), quality_level(0), min_distance(0), min_features(0), max_features(0), status(0),
    34         img_eig(0), img_tmp(0), 
gray(0), prev_gray(0), pyramid(0), prev_pyramid(0), mask(0), next_id(0), win_size(0), pyr_levels(0),
    35         prev_features(0), features(0), prev_feature_count(0), feature_count(0), prev_ids(0), ids(0)
    40         ChangeSettings(_max_features, _min_features, _quality_level, _min_distance);
    73                 memcpy(ids_new, 
ids, 
sizeof(
int)*common_features);
    80                 CvPoint2D32f *features_new = 
new CvPoint2D32f[
max_features];
    81                 memcpy(features_new, 
features, 
sizeof(CvPoint2D32f)*common_features);
   126                 for (
int ii=0; ii<i; ii++) {
   129                         if (dx < 0) dx = -dx; 
if (dy < 0) dy = -dy;
   130                         if ((dx < dist) && (dy < dist)) {
   137         return removed_count;
   141         if ((
x_res != img->width) || (
y_res != img->height)) {
   150                 img_eig = cvCreateImage(cvGetSize(img), IPL_DEPTH_32F, 1);
   151                 img_tmp = cvCreateImage(cvGetSize(img), IPL_DEPTH_32F, 1);
   152                 gray = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
   153                 prev_gray = cvCreateImage(cvGetSize(img),IPL_DEPTH_8U, 1);
   154                 pyramid = cvCreateImage(cvSize(img->width+8,img->height/3), IPL_DEPTH_8U, 1);
   155                 prev_pyramid = cvCreateImage(cvSize(img->width+8,img->height/3), IPL_DEPTH_8U, 1);
   156                 mask = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1);
   170         if (img->nChannels == 1) {
   173                 cvCvtColor(img, 
gray, CV_RGB2GRAY);
   180                 memcpy(
ids, 
prev_ids, 
sizeof(
int)*prev_feature_count);
   186                         cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03), 0);
   204         return TrackHid(img, new_features_mask);
   217         cvSet(
mask, cvScalar(255));
   222                                         cvScalar(0), CV_FILLED);
   228         if (
gray == NULL) 
return 0;
   231                 if (new_features_mask == NULL) {
   232                         cvSet(
mask, cvScalar(255));
   237                                                         cvScalar(0), CV_FILLED);
   241                                                                 &(
features[feature_count]), &new_feature_count,
   246                                                                 &(
features[feature_count]), &new_feature_count,
   250                 if (new_feature_count >= 1) {
   251                         for (
int i=feature_count; i<feature_count+new_feature_count; i++) {
   255                         feature_count += new_feature_count;
 
double TrackHid(IplImage *img, IplImage *mask=NULL, bool add_features=true)
Reset track features on specified mask area. 
CvPoint2D32f * features
Track result: current features 
double Track(IplImage *img)
Track features. 
int prev_feature_count
Track result: count of previous features 
TFSIMD_FORCE_INLINE const tfScalar & y() const 
int * prev_ids
Track result: ID:s for previous features 
int Purge()
Purge features that are considerably closer than the defined min_distance. 
CvPoint2D32f * prev_features
Track result: previous features 
int AddFeatures(IplImage *mask=NULL)
add features to the previously tracked frame if there are less than min_features 
This file implements a feature tracker. 
bool DelFeature(int index)
Stop tracking the identified feature (with index for features array) 
bool DelFeatureId(int id)
Stop tracking the identified feature (with feature id) 
TFSIMD_FORCE_INLINE const tfScalar & x() const 
int feature_count
Track result: count of current features 
void ChangeSettings(int _max_features=100, int _min_features=90, double _quality_level=0.01, double _min_distance=10)
Change settings while running. 
~TrackerFeatures()
Destructor. 
int * ids
Track result: ID:s for current features 
IplImage * NewFeatureMask()
Create and get the pointer to new_features_mask.