# HG changeset patch # User Nicolas Saunier # Date 1314660037 14400 # Node ID 7bf8084e720f2611d8a9e5ce2323873d7ac2d0b5 # Parent b32947b002da1e0defa8b272262022ab10574811 removed bug with loadMat and added diagnosis code for empty frames diff -r b32947b002da -r 7bf8084e720f c/feature-based-tracking.cpp --- a/c/feature-based-tracking.cpp Fri Aug 26 19:38:11 2011 -0400 +++ b/c/feature-based-tracking.cpp Mon Aug 29 19:20:37 2011 -0400 @@ -104,7 +104,7 @@ capture.open(params.videoFilename); if(capture.isOpened()) { videoSize = Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT)); - cout << "Video " << argv[1] << + cout << "Video " << params.videoFilename << ": width=" << videoSize.width << ", height=" << videoSize.height << ", nframes=" << capture.get(CV_CAP_PROP_FRAME_COUNT) << endl; @@ -141,8 +141,14 @@ for (int frameNum = params.frame1; ((frameNum-params.frame1 < params.nFrames) || (params.nFrames < 0)) && !::interruptionKey(key); frameNum++) { capture >> frame; cout << frameNum << " " << capture.get(CV_CAP_PROP_POS_FRAMES) << " " << prevPts.size() << endl; - while (frame.empty()) + int emptyFrameNum = 0; + while (frame.empty()) { + cerr << "empty frame " << emptyFrameNum << " " << capture.get(CV_CAP_PROP_POS_FRAMES)<< endl; capture >> frame;//break; + emptyFrameNum++; + if (emptyFrameNum>=3000) + exit(0); + } cvtColor(frame, currentFrameBW, CV_RGB2GRAY); diff -r b32947b002da -r 7bf8084e720f c/utils.cpp --- a/c/utils.cpp Fri Aug 26 19:38:11 2011 -0400 +++ b/c/utils.cpp Mon Aug 29 19:20:37 2011 -0400 @@ -10,18 +10,19 @@ vector > loadNumbers(const string& filename, const string& separator /* = " " */) { ifstream in(filename.c_str()); - ::openCheck(in, filename, "loadNumbers"); vector > result; - while (!in.eof()) { - string line = ::getlineComment(in); - vector tokens; - ::split(tokens, line, separator); - vector numbers; - BOOST_FOREACH(string s, tokens) - numbers.push_back(::toInt(s)); - if (!numbers.empty()) - result.push_back(numbers); + if (::openCheck(in, filename, "loadNumbers")) { + while (!in.eof()) { + string line = ::getlineComment(in); + vector tokens; + ::split(tokens, line, separator); + vector numbers; + BOOST_FOREACH(string s, tokens) + numbers.push_back(::toInt(s)); + if (!numbers.empty()) + result.push_back(numbers); + } } return result;