Mercurial Hosting > traffic-intelligence
changeset 679:576d9ea4b41a
small update to deal with videos where the number of frames cannot be read
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 04 Jun 2015 16:04:58 +0200 |
parents | ae07c7b4cf87 |
children | acce61a1edc8 8dd738fc7375 |
files | c/feature-based-tracking.cpp |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 <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 <<