Mercurial Hosting > traffic-intelligence
diff python/cvutils.py @ 248:571ba5ed22e2
added utils for bus processing
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 18 Jul 2012 02:54:22 -0400 |
parents | e0988a8ace0c |
children | aba9711b3149 |
line wrap: on
line diff
--- a/python/cvutils.py Wed Jul 18 02:54:02 2012 -0400 +++ b/python/cvutils.py Wed Jul 18 02:54:22 2012 -0400 @@ -129,7 +129,7 @@ images.append(img) return images - def displayTrajectories(videoFilename, objects, homography = None, firstFrameNum = 0): + def displayTrajectories(videoFilename, objects, homography = None, firstFrameNum = 0, lastFrameNumArg = None): '''Displays the objects overlaid frame by frame over the video ''' capture = cv2.VideoCapture(videoFilename) if capture.isOpened(): @@ -137,7 +137,12 @@ ret = True frameNum = firstFrameNum capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNum) - while ret and key!= 113: # 'q' + if not lastFrameNumArg: + from sys import maxint + lastFrameNum = maxint + else: + lastFrameNum = lastFrameNumArg + while ret and key!= 113 and frameNum < lastFrameNum: # 'q' ret, img = capture.read() if ret: print('frame {0}'.format(frameNum))