Hello,
I'm trying to color points that have been tracked by calcOpticalFlowPyrLK based on how long they have been tracked to mark some "stable" points. So e.g. points that have been tracked in 3 less than 10 consecutive pictures shall be marked in blue while points that have been tracked in more than 10 consecutive pictures shall be marked in green. But I'm stucking on how to count this (intensity shall be my counter). I have tried this:
calcOpticalFlowPyrLK(img_1, img_2, points1, points2, status, err, winSize, 3, termcrit, 0, 0.001);
int indexCorrection = 0;
for (int i = 0; i<status.size(); i++)
{
Point2f pt = points2.at(i - indexCorrection);
if ( status.at( i ) == 0 ) {
points1.erase( points1.begin() + (i - indexCorrection) );
points2.erase( points2.begin() + (i - indexCorrection) );
intensity.erase( intensity.begin() + (i - indexCorrection) );
indexCorrection++;
}
else
intensity.at( i - indexCorrection )++;
}
Bit I still see points that are marked in green although these are noisy points that appear and disappear really fast (and I have chosen a really high threshold), Do you have any ideas or know a better solution for this problem?