mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
Merge pull request #801 from kirill-kornyakov:lkdemo-fix
This commit is contained in:
commit
b696d49d5a
@ -12,9 +12,8 @@ static void help()
|
||||
{
|
||||
// print a welcome message, and the OpenCV version
|
||||
cout << "\nThis is a demo of Lukas-Kanade optical flow lkdemo(),\n"
|
||||
"Using OpenCV version %s\n" << CV_VERSION << "\n"
|
||||
<< endl;
|
||||
|
||||
"Using OpenCV version " << CV_VERSION << endl;
|
||||
cout << "\nIt uses camera by default, but you can provide a path to video as an argument.\n";
|
||||
cout << "\nHot keys: \n"
|
||||
"\tESC - quit the program\n"
|
||||
"\tr - auto-initialize tracking\n"
|
||||
@ -30,15 +29,17 @@ static void onMouse( int event, int x, int y, int /*flags*/, void* /*param*/ )
|
||||
{
|
||||
if( event == CV_EVENT_LBUTTONDOWN )
|
||||
{
|
||||
point = Point2f((float)x,(float)y);
|
||||
point = Point2f((float)x, (float)y);
|
||||
addRemovePt = true;
|
||||
}
|
||||
}
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
help();
|
||||
|
||||
VideoCapture cap;
|
||||
TermCriteria termcrit(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03);
|
||||
TermCriteria termcrit(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 20, 0.03);
|
||||
Size subPixWinSize(10,10), winSize(31,31);
|
||||
|
||||
const int MAX_COUNT = 500;
|
||||
@ -56,8 +57,6 @@ int main( int argc, char** argv )
|
||||
return 0;
|
||||
}
|
||||
|
||||
help();
|
||||
|
||||
namedWindow( "LK Demo", 1 );
|
||||
setMouseCallback( "LK Demo", onMouse, 0 );
|
||||
|
||||
@ -134,17 +133,16 @@ int main( int argc, char** argv )
|
||||
needToInit = true;
|
||||
break;
|
||||
case 'c':
|
||||
points[0].clear();
|
||||
points[1].clear();
|
||||
break;
|
||||
case 'n':
|
||||
nightMode = !nightMode;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
std::swap(points[1], points[0]);
|
||||
swap(prevGray, gray);
|
||||
cv::swap(prevGray, gray);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user