#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;
char filename[200];
bool pleaseExit = false;
- namedWindow("original", CV_WINDOW_KEEPRATIO);
+ namedWindow("stickletrack_original", CV_WINDOW_KEEPRATIO);
Mat frame, origframe, combinedmask;
gotoframe = framenum + 1;
- imshow("original", origframe/255.0);
+ if ( ! isWindowClosed("stickletrack_original") )
+ imshow("stickletrack_original", origframe/255.0);
}
drawTimes(tracking_getFrame());
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;
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);
}