changeset 681:acce61a1edc8 dev

merged bug fix with stable
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 05 Jun 2015 02:25:50 +0200
parents da1352b89d02 (current diff) 576d9ea4b41a (diff)
children fbe29be25501
files
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/c/feature-based-tracking.cpp	Fri Jun 05 02:25:30 2015 +0200
+++ b/c/feature-based-tracking.cpp	Fri Jun 05 02:25:50 2015 +0200
@@ -21,6 +21,7 @@
 #include <ctime>
 #include <cmath>
 #include <memory>
+#include <limits>
 
 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<int>::max();
+    cout << "Setting arbitrarily high number for testing: " << nFrames << endl;
+  }
+
   cout << "Video " << params.videoFilename <<
 	  ": width=" << videoSize.width <<
 	  ", height=" << videoSize.height <<