From ffc3a58cb495dcc6c1078c711218ac1ed15571f8 Mon Sep 17 00:00:00 2001 From: Gary Bradski Date: Tue, 30 Nov 2010 00:19:34 +0000 Subject: [PATCH] added help docs --- samples/cpp/camshiftdemo.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/samples/cpp/camshiftdemo.cpp b/samples/cpp/camshiftdemo.cpp index 443392a..0e13fbd 100644 --- a/samples/cpp/camshiftdemo.cpp +++ b/samples/cpp/camshiftdemo.cpp @@ -8,6 +8,23 @@ using namespace cv; using namespace std; +void help() +{ + cout << "\nThis is a demo that shows mean shift based tracking\n" + << "You select a color objects such as your face and it tracks it.\n" + << "This reads from video camera (0 by default, or the camera number the user enters\n" + << "Call:\n" + << "\n./camshiftdemo [camera number]" + << "\n" << endl; + + 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" + "To initialize tracking, select the object with mouse\n" << endl; +} + Mat image; bool backprojMode = false; @@ -45,6 +62,8 @@ void onMouse( int event, int x, int y, int flags, void* param ) } } + + int main( int argc, char** argv ) { VideoCapture cap; @@ -61,16 +80,12 @@ int main( int argc, char** argv ) if( !cap.isOpened() ) { - cout << "Could not initialize capturing...\n"; + help(); + cout << "***Could not initialize capturing...***\n"; return 0; } - cout << "Hot 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" - "To initialize tracking, select the object with mouse\n"; + help(); namedWindow( "Histogram", 1 ); namedWindow( "CamShift Demo", 1 ); -- 2.7.4