changeset 534:d0419b1267dd

fixing size issue when testing frames in main loop
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 29 Jun 2014 14:37:30 -0400
parents e37f38274d4f
children 5ad2f51ae42f
files c/feature-based-tracking.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/c/feature-based-tracking.cpp	Sun Jun 29 14:27:18 2014 -0400
+++ b/c/feature-based-tracking.cpp	Sun Jun 29 14:37:30 2014 -0400
@@ -159,7 +159,7 @@
   capture->setFrameNumber(params.frame1);
   for (unsigned int frameNum = params.frame1; (frameNum < lastFrameNum) && !::interruptionKey(key); frameNum++) {
       bool success = capture->getNextFrame(frame);
-      if (!success || frame.empty() || frame.size() != videoSize) {
+      if (!success || frame.empty()) {
 	cout << "Empty frame " << frameNum << ", breaking (" << success << " " << frame.empty() << " [" << frame.size().width << "x" << frame.size().height << "])" << endl;
 	break;
       } else if (frameNum%50 ==0)
@@ -168,6 +168,11 @@
       if (params.undistort) {
 	remap(frame, undistortedFrame, map1, map2, interpolationMethod, BORDER_CONSTANT, 0.);
 	frame = undistortedFrame;
+
+	if (frame.size() != videoSize) {
+	  cout << "Different frame size " << frameNum << ", breaking ([" << frame.size().width << "x" << frame.size().height << "])" << endl;
+	break;
+	}
       }