Mercurial Hosting > traffic-intelligence
diff python/cvutils.py @ 967:373e8ef6ee25
modified function to access video property
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 05 Dec 2017 16:15:44 -0500 |
parents | 4f32d82ca390 |
children | 5d788d2e8ffc |
line wrap: on
line diff
--- a/python/cvutils.py Tue Dec 05 16:11:49 2017 -0500 +++ b/python/cvutils.py Tue Dec 05 16:15:44 2017 -0500 @@ -190,6 +190,7 @@ cv2.cv.CV_CAP_PROP_RECTIFICATION: "rectification", cv2.cv.CV_CAP_PROP_SATURATION: "saturation"} capture = cv2.VideoCapture(filename) + videoProperties = {} if capture.isOpened(): for cvprop in [#cv2.cv.CV_CAP_PROP_BRIGHTNESS #cv2.cv.CV_CAP_PROP_CONTRAST @@ -213,9 +214,10 @@ prop = capture.get(cvprop) if cvprop == cv2.cv.CV_CAP_PROP_FOURCC and prop > 0: prop = int2FOURCC(int(prop)) - print('Video {}: {}'.format(cvPropertyNames[cvprop], prop)) + videoProperties[cvPropertyNames[cvprop]] = prop else: print('Video capture for {} failed'.format(filename)) + return videoProperties def getImagesFromVideo(videoFilename, firstFrameNum = 0, lastFrameNum = 1, step = 1, saveImage = False, outputPrefix = 'image'): '''Returns nFrames images from the video sequence'''