X-Git-Url: http://git.treefish.org/~alex/stickletrack.git/blobdiff_plain/ea9beb8a69f557f57d8943711389cc04fce69a7f..ab5ee4c78e1fa591a4d8d9af812f83a9e81ef6d7:/stickletrack.cpp diff --git a/stickletrack.cpp b/stickletrack.cpp index 0db07ce..da812df 100755 --- a/stickletrack.cpp +++ b/stickletrack.cpp @@ -62,6 +62,13 @@ void genBaseDir() { cout << "Using " << Props.basedir << " for data output." << endl; } +bool isWindowClosed (const char* name) { + if ( cvGetWindowHandle(name) == NULL ) + return true; + else + return false; +} + void beforeExit() { cout << "Exitting ..." << endl; @@ -356,7 +363,7 @@ int process(VideoCapture& capture) { char filename[200]; bool pleaseExit = false; - namedWindow("original", CV_WINDOW_KEEPRATIO); + namedWindow("stickletrack_original", CV_WINDOW_KEEPRATIO); Mat frame, origframe, combinedmask; @@ -442,7 +449,8 @@ int process(VideoCapture& capture) { gotoframe = framenum + 1; - imshow("original", origframe/255.0); + if ( ! isWindowClosed("stickletrack_original") ) + imshow("stickletrack_original", origframe/255.0); } drawTimes(tracking_getFrame()); @@ -451,7 +459,8 @@ int process(VideoCapture& capture) { circle( tracking_getFrame(), Point2f(tags[nearestTags[0]].x, tags[nearestTags[0]].y), Props.diagonal / 100.0, Scalar(0,0,255), -1, 8 ); } - tracking_showFrame(); + if ( tracking_showFrame() ) + pleaseExit = true; char key; @@ -508,8 +517,6 @@ int main(int ac, char** av) { cerr << "Failed to open a video device or video file!\n" << endl; return 1; } - - cout << "Exit with q if you want to save your data!!!" << endl; return process(capture); }