changeset 839:2c7b4e6a32dd

steps working now
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 06 Jul 2016 18:05:03 -0400
parents 2918de3d40fc
children 15a82ebc62c4
files scripts/display-synced-trajectories.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/display-synced-trajectories.py	Wed Jul 06 12:30:08 2016 -0400
+++ b/scripts/display-synced-trajectories.py	Wed Jul 06 18:05:03 2016 -0400
@@ -66,7 +66,6 @@
 #    wait = int(round(1000./frameRate))
 #if interactive:
 wait = 0
-step = 1
 rescale = 1.
 captures = [cv2.VideoCapture(fn) for fn in filenames]
 if np.array([cap.isOpened() for cap in captures]).all():
@@ -110,10 +109,11 @@
             key = cv2.waitKey(wait)
             #if cvutils.saveKey(key):
             #    cv2.imwrite('image-{}.png'.format(frameNum), img)
-            nFramesShown += step
-            if step > 1:
-                for i in xrange(len(captures)):
-                    captures.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNums[i]+nFramesShown)
+        nFramesShown += args.step
+        if args.step > 1:
+            for i in xrange(len(captures)):
+                if firstFrameNums[i]+nFramesShown >= 0:
+                    captures[i].set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNums[i]+nFramesShown)
     cv2.destroyAllWindows()
 else:
     print('Video captures for {} failed'.format(filenames))