From 7d30f3a8657e24e100a6264e54c0927475570d2d Mon Sep 17 00:00:00 2001 From: Alex Schmidt Date: Wed, 9 Oct 2013 12:01:02 +0200 Subject: [PATCH 1/1] fixed tracking screen mouse-callback. --- stickletrack.cpp | 4 +--- tracking.cpp | 4 +++- tracking.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stickletrack.cpp b/stickletrack.cpp index da812df..e872ebd 100755 --- a/stickletrack.cpp +++ b/stickletrack.cpp @@ -397,9 +397,7 @@ int process(VideoCapture& capture) { openTanjaLog(); masking_init(); - tracking_init(); - - cvSetMouseCallback("contours_picture", mouseTracking, 0); + tracking_init(&mouseTracking); capture.set(CV_CAP_PROP_POS_FRAMES, 0); diff --git a/tracking.cpp b/tracking.cpp index 88c9512..9a185df 100644 --- a/tracking.cpp +++ b/tracking.cpp @@ -65,7 +65,7 @@ bool tracking_isEnabled () { return enablecontours; } -void tracking_init() { +void tracking_init( void (*mouseTracking)(int, int, int, int, void*) ) { namedWindow("stickletrack_tracking_prefs", CV_WINDOW_KEEPRATIO); namedWindow("stickletrack_tracking_screen", CV_WINDOW_KEEPRATIO); @@ -82,6 +82,8 @@ void tracking_init() { 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); } diff --git a/tracking.h b/tracking.h index 7911da0..b8c522c 100644 --- a/tracking.h +++ b/tracking.h @@ -19,7 +19,7 @@ struct tag { Point2f head, tail; }; -void tracking_init(); +void tracking_init( void (*mouseTracking)(int, int, int, int, void*) ); void tracking_locateTags(vector& tags, Mat combinedmask_contour); Mat& tracking_getFrame(); int tracking_showFrame(); -- 2.39.5