# HG changeset patch # User Nicolas Saunier # Date 1340254646 14400 # Node ID 51acf43e421af9d4236634b106e010dd9ae9da90 # Parent 5e2983b05d4e889006412bd943208b0c9f573137 modified the function to read and save images from a movie diff -r 5e2983b05d4e -r 51acf43e421a python/cvutils.py --- a/python/cvutils.py Fri Jun 08 18:44:27 2012 -0400 +++ b/python/cvutils.py Thu Jun 21 00:57:26 2012 -0400 @@ -103,18 +103,25 @@ cv2.imshow('frame', img) key = cv2.waitKey(5) - def getImagesFromVideo(filename, nImages = 1): + def getImagesFromVideo(filename, nImages = 1, saveImage = False): '''Returns nImages images from the video sequence''' images = [] capture = cv2.VideoCapture(filename) if capture.isOpened(): ret = False - while len(images)0: - images.append(img) + numImg +=1 + if saveImage: + cv2.imwrite('image{0:04d}.png'.format(numImg), img) + else: + images.append(img) return images def displayTrajectories(videoFilename, objects, homography = None):