diff python/cvutils.py @ 478:d337bffd7283

Display of points in compute homography and step option to replay videos A bug seems to remain with respect to trajectory bounds, to check
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 27 Mar 2014 11:40:28 -0400
parents 59903d14d244
children f6415f012640
line wrap: on
line diff
--- a/python/cvutils.py	Tue Mar 25 19:43:47 2014 -0400
+++ b/python/cvutils.py	Thu Mar 27 11:40:28 2014 -0400
@@ -202,7 +202,7 @@
         return imgcrop, yCropMin, yCropMax, xCropMin, xCropMax
 
 
-    def displayTrajectories(videoFilename, objects, boundingBoxes = {}, homography = None, firstFrameNum = 0, lastFrameNumArg = None, printFrames = True, rescale = 1.):
+    def displayTrajectories(videoFilename, objects, boundingBoxes = {}, homography = None, firstFrameNum = 0, lastFrameNumArg = None, printFrames = True, rescale = 1., nFramesStep = 1):
         '''Displays the objects overlaid frame by frame over the video '''
         from moving import userTypeNames
 
@@ -246,7 +246,9 @@
                     key = cv2.waitKey()
                     if saveKey(key):
                         cv2.imwrite('image.png', img)
-                    frameNum += 1
+                    frameNum += nFramesStep
+                    if nFramesStep > 1:
+                        capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, frameNum)
             cv2.destroyAllWindows()
         else:
             print 'Cannot load file ' + videoFilename