X-Git-Url: http://git.treefish.org/~alex/stickletrack.git/blobdiff_plain/65dda843f459c7608c516342a903bcb9700e099f..ab5ee4c78e1fa591a4d8d9af812f83a9e81ef6d7:/tracking.cpp diff --git a/tracking.cpp b/tracking.cpp index 4e401f8..88c9512 100644 --- a/tracking.cpp +++ b/tracking.cpp @@ -52,8 +52,13 @@ Mat& tracking_getFrame() { return mContours; } -void tracking_showFrame() { - imshow("contours_picture", mContours); +int tracking_showFrame() { + if ( ! isWindowClosed("stickletrack_tracking_screen") ) { + imshow("stickletrack_tracking_screen", mContours); + return 0; + } + else + return 1; } bool tracking_isEnabled () { @@ -61,21 +66,21 @@ bool tracking_isEnabled () { } void tracking_init() { - namedWindow("contours", CV_WINDOW_KEEPRATIO); - namedWindow("contours_picture", CV_WINDOW_KEEPRATIO); - - createTrackbar("Enable", "contours", &enablecontours, 1, NULL, 0); - createTrackbar("Manyfish", "contours", &Prefs.manyfish, 10, NULL, 0); - createTrackbar("min area", "contours", &Prefs.contours_minarea, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("max area", "contours", &Prefs.contours_maxarea, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("min circum", "contours", &Prefs.contours_mincircum, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("max circum", "contours", &Prefs.contours_maxcircum, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("min shortaxis", "contours", &Prefs.contours_minshortaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("max shortaxis", "contours", &Prefs.contours_maxshortaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("min longaxis", "contours", &Prefs.contours_minlongaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("max longaxis", "contours", &Prefs.contours_maxlongaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("max speed", "contours", &Prefs.contours_maxspeed, 100, &trackbarCallbackUpdateNormPrefs, 0); - createTrackbar("max rotation speed", "contours", &Prefs.contours_maxrot, 100, &trackbarCallbackUpdateNormPrefs, 0); + namedWindow("stickletrack_tracking_prefs", CV_WINDOW_KEEPRATIO); + namedWindow("stickletrack_tracking_screen", CV_WINDOW_KEEPRATIO); + + createTrackbar("Enable", "stickletrack_tracking_prefs", &enablecontours, 1, NULL, 0); + createTrackbar("Manyfish", "stickletrack_tracking_prefs", &Prefs.manyfish, 10, NULL, 0); + createTrackbar("min area", "stickletrack_tracking_prefs", &Prefs.contours_minarea, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("max area", "stickletrack_tracking_prefs", &Prefs.contours_maxarea, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("min circum", "stickletrack_tracking_prefs", &Prefs.contours_mincircum, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("max circum", "stickletrack_tracking_prefs", &Prefs.contours_maxcircum, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("min shortaxis", "stickletrack_tracking_prefs", &Prefs.contours_minshortaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("max shortaxis", "stickletrack_tracking_prefs", &Prefs.contours_maxshortaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("min longaxis", "stickletrack_tracking_prefs", &Prefs.contours_minlongaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("max longaxis", "stickletrack_tracking_prefs", &Prefs.contours_maxlongaxis, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("max speed", "stickletrack_tracking_prefs", &Prefs.contours_maxspeed, 100, &trackbarCallbackUpdateNormPrefs, 0); + createTrackbar("max rotation speed", "stickletrack_tracking_prefs", &Prefs.contours_maxrot, 100, &trackbarCallbackUpdateNormPrefs, 0); mContours = Mat::zeros(Props.height, Props.width, CV_8UC3); }