void KLTSelectGoodFeatures(
KLT_TrackingContext tc,
KLT_PixelType *img,
int ncols,
int nrows,
KLT_FeatureList fl);
Pixels throughout the image are then measured as to their "goodness", which is a measure of their trackability. Generally each pixel within the image's interior is considered, where the interior is defined by tc->borderx and tc->bordery (i.e., setting these parameters to zero causes the interior to equal the whole image). The parameter tc->nSkippedPixels can be used to speed up the process in the following way: its default value is zero, in which case every pixel within the interior is considered; if it is set to one, then every other pixel within the interior is considered; setting it to two causes every third pixel to be considered; and similarly for higher values. Since neighboring pixels generally have similar goodness values, then skipping every other one will probably not noticeably decrease performance.
The goodness of each pixel is measured as the minimum eigenvalue of the 2 by 2 gradient matrix computed from the tc->window_width by tc->window_height window around the pixel. After all the pixels have been considered, they are sorted in descending order according to goodness. Then, one by one the top fl->nFeatures features (or pixels) are selected, ensuring that each new feature is at least tc->mindist pixels away from all the other features.