diff python/cvutils.py @ 625:9202628a4130

saving image when playing video
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 13 Feb 2015 09:10:29 -0500
parents b5525249eda1
children 977407c9f815
line wrap: on
line diff
--- a/python/cvutils.py	Fri Jan 09 00:14:13 2015 -0500
+++ b/python/cvutils.py	Fri Feb 13 09:10:29 2015 -0500
@@ -144,6 +144,8 @@
                        cv2.putText(img, text, (10,50), cv2.cv.CV_FONT_HERSHEY_PLAIN, 1, cvRed) 
                     cvImshow(windowName, img, rescale)
                     key = cv2.waitKey(wait)
+                    if saveKey(key):
+                        cv2.imwrite('image-{}.png'.format(frameNum), img)
             cv2.destroyAllWindows()
         else:
             print('Video capture for {} failed'.format(filename))