Feature #3957
This commit is contained in:
committed by
Maksim Shabunin
parent
5cdf0e3e89
commit
297808e6b9
@@ -47,6 +47,15 @@ static void onMouse( int event, int x, int y, int, void* )
|
||||
}
|
||||
}
|
||||
|
||||
string hot_keys =
|
||||
"\n\nHot keys: \n"
|
||||
"\tESC - quit the program\n"
|
||||
"\tc - stop the tracking\n"
|
||||
"\tb - switch to/from backprojection view\n"
|
||||
"\th - show/hide object histogram\n"
|
||||
"\tp - pause video\n"
|
||||
"To initialize tracking, select the object with mouse\n";
|
||||
|
||||
static void help()
|
||||
{
|
||||
cout << "\nThis is a demo that shows mean-shift based tracking\n"
|
||||
@@ -54,33 +63,28 @@ static void help()
|
||||
"This reads from video camera (0 by default, or the camera number the user enters\n"
|
||||
"Usage: \n"
|
||||
" ./camshiftdemo [camera number]\n";
|
||||
|
||||
cout << "\n\nHot keys: \n"
|
||||
"\tESC - quit the program\n"
|
||||
"\tc - stop the tracking\n"
|
||||
"\tb - switch to/from backprojection view\n"
|
||||
"\th - show/hide object histogram\n"
|
||||
"\tp - pause video\n"
|
||||
"To initialize tracking, select the object with mouse\n";
|
||||
cout << hot_keys;
|
||||
}
|
||||
|
||||
const char* keys =
|
||||
{
|
||||
"{@camera_number| 0 | camera number}"
|
||||
"{help h | | show help message}{@camera_number| 0 | camera number}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
help();
|
||||
|
||||
VideoCapture cap;
|
||||
Rect trackWindow;
|
||||
int hsize = 16;
|
||||
float hranges[] = {0,180};
|
||||
const float* phranges = hranges;
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
if (parser.has("help"))
|
||||
{
|
||||
help();
|
||||
return 0;
|
||||
}
|
||||
int camNum = parser.get<int>(0);
|
||||
|
||||
cap.open(camNum);
|
||||
|
||||
if( !cap.isOpened() )
|
||||
@@ -91,7 +95,7 @@ int main( int argc, const char** argv )
|
||||
parser.printMessage();
|
||||
return -1;
|
||||
}
|
||||
|
||||
cout << hot_keys;
|
||||
namedWindow( "Histogram", 0 );
|
||||
namedWindow( "CamShift Demo", 0 );
|
||||
setMouseCallback( "CamShift Demo", onMouse, 0 );
|
||||
|
||||
Reference in New Issue
Block a user