# HG changeset patch # User Nicolas Saunier # Date 1433426698 -7200 # Node ID 576d9ea4b41a610d436036508165163fd8dca8f5 # Parent ae07c7b4cf8745f4c99de48fc00e4dde065b0947 small update to deal with videos where the number of frames cannot be read diff -r ae07c7b4cf87 -r 576d9ea4b41a c/feature-based-tracking.cpp --- a/c/feature-based-tracking.cpp Sat May 30 23:30:21 2015 +0200 +++ b/c/feature-based-tracking.cpp Thu Jun 04 16:04:58 2015 +0200 @@ -21,6 +21,7 @@ #include #include #include +#include using namespace std; using namespace cv; @@ -101,6 +102,12 @@ Size videoSize = Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT)); unsigned int nFrames = capture.get(CV_CAP_PROP_FRAME_COUNT); + if (nFrames <= 0) { + cout << "Guessing that the number of frames could not be read: " << nFrames << endl; + nFrames = numeric_limits::max(); + cout << "Setting arbitrarily high number for testing: " << nFrames << endl; + } + cout << "Video " << params.videoFilename << ": width=" << videoSize.width << ", height=" << videoSize.height <<