added minEigThreshold parameter to calcOpticalFlowPyrLK to filter out bad points earlier.

This commit is contained in:
Vadim Pisarevsky
2011-07-27 19:07:45 +00:00
parent 6b5ea5931d
commit eebe4860da
3 changed files with 56 additions and 11 deletions

View File

@@ -39,7 +39,7 @@ int main( int argc, char** argv )
{
VideoCapture cap;
TermCriteria termcrit(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03);
Size winSize(10,10);
Size subPixWinSize(10,10), winSize(31,31);
const int MAX_COUNT = 500;
bool needToInit = false;
@@ -81,7 +81,7 @@ int main( int argc, char** argv )
{
// automatic initialization
goodFeaturesToTrack(gray, points[1], MAX_COUNT, 0.01, 10, Mat(), 3, 0, 0.04);
cornerSubPix(gray, points[1], winSize, Size(-1,-1), termcrit);
cornerSubPix(gray, points[1], subPixWinSize, Size(-1,-1), termcrit);
addRemovePt = false;
}
else if( !points[0].empty() )
@@ -91,7 +91,7 @@ int main( int argc, char** argv )
if(prevGray.empty())
gray.copyTo(prevGray);
calcOpticalFlowPyrLK(prevGray, gray, points[0], points[1], status, err, winSize,
3, termcrit, 0);
3, termcrit, 0, 0, 0.001);
size_t i, k;
for( i = k = 0; i < points[1].size(); i++ )
{