changeset 799:0662c87a61c9 dev

minor modification
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 30 May 2016 23:01:53 -0400
parents 5b99b676265e
children 2cade72d75ad
files python/cvutils.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/python/cvutils.py	Mon May 30 22:49:24 2016 -0400
+++ b/python/cvutils.py	Mon May 30 23:01:53 2016 -0400
@@ -230,13 +230,13 @@
             ret = False
             capture.set(cv2.CAP_PROP_POS_FRAMES, firstFrameNum)
             frameNum = firstFrameNum
-            while frameNum<=lastFrameNum:
+            while frameNum<=lastFrameNum and frameNum<rawCount:
                 ret, img = capture.read()
                 i = 0
                 while not ret and i<10:
                     ret, img = capture.read()
                     i += 1
-                if img.size>0:
+                if img is not None and img.size>0:
                     if saveImage:
                         frameNumStr = format(frameNum, '0{}d'.format(nDigits))
                         cv2.imwrite(outputPrefix+frameNumStr+'.png', img)