X-Git-Url: http://git.treefish.org/~alex/stickletrack.git/blobdiff_plain/c22f55516cf5df96e2a97056f42c66f71b774d9a..ab5ee4c78e1fa591a4d8d9af812f83a9e81ef6d7:/stickletrack.cpp diff --git a/stickletrack.cpp b/stickletrack.cpp index e90f030..da812df 100755 --- a/stickletrack.cpp +++ b/stickletrack.cpp @@ -53,15 +53,22 @@ void genBaseDir() { #if defined(_WIN32) Props.basedir = getenv("HOMEDRIVE"); Props.basedir += getenv("HOMEPATH"); - Props.basedir += "\.stickletrack"; #else Props.basedir = getenv("HOME"); - Props.basedir += "/.stickletrack"; #endif + Props.basedir += "/.stickletrack"; + 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); }