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 () {
return enablecontours;
}
-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);
+void tracking_init( void (*mouseTracking)(int, int, int, int, void*) ) {
+ 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);
+
+ cvSetMouseCallback("stickletrack_tracking_screen", mouseTracking, 0);
mContours = Mat::zeros(Props.height, Props.width, CV_8UC3);
}