X-Git-Url: http://git.treefish.org/~alex/stickletrack.git/blobdiff_plain/ab5ee4c78e1fa591a4d8d9af812f83a9e81ef6d7..9f9e04b576a579d96e339cb2339a71f4405af50b:/stickletrack.cpp diff --git a/stickletrack.cpp b/stickletrack.cpp index da812df..7022276 100755 --- a/stickletrack.cpp +++ b/stickletrack.cpp @@ -123,19 +123,19 @@ void drawTimes(Mat& mContours) { alles << framenum << " : " << fixed << (framenum)/(double)Props.fps << "s : +" << (double)moresleep/Props.fps << "ms"; string text = alles.str(); - int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX; + int fontFace = FONT_HERSHEY_DUPLEX; - double fontScale = Props.diagonal/1000.0; - int thickness = 3; + double fontScale = Props.width / 600.0; + int thickness = Props.width / 250.0; int baseline=0; Size textSize = getTextSize(text, fontFace, fontScale, thickness, &baseline); - Point textOrg(10, 10 + textSize.height); + Point textOrg(Props.width*0.01, Props.width*0.01 + textSize.height); rectangle(mContours, Point(0, 0), - Point(Props.width, 20+textSize.height), + Point(Props.width, Props.width*0.02 + textSize.height), Scalar(0,0,255), -1); putText(mContours, text, textOrg, fontFace, fontScale, @@ -373,6 +373,15 @@ int process(VideoCapture& capture) { Props.totframes = capture.get(CV_CAP_PROP_FRAME_COUNT); Props.diagonal = sqrt( pow(Props.width, 2) + pow(Props.height, 2) ); + if ( Props.width == 0 || Props.height == 0 || Props.fps == 0 || Props.totframes == 0 ) { + cerr << "Something got wrong while reading video-file info!" << endl; + cerr << "Width: " << Props.width << endl; + cerr << "Height: " << Props.height << endl; + cerr << "FPS: " << Props.fps << endl; + cerr << "Total frames: " << Props.totframes << endl; + exit(1); + } + Mat frameintime[BACKSECONDS*Props.fps]; tagintime = new vector*[BACKSECONDS*Props.fps]; @@ -397,9 +406,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);