Mercurial Hosting > traffic-intelligence
diff scripts/display-synced-trajectories.py @ 998:933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sun, 27 May 2018 23:22:48 -0400 |
parents | 668a85c963c3 |
children | cc5cb04b04b0 |
line wrap: on
line diff
--- a/scripts/display-synced-trajectories.py Fri May 25 18:15:18 2018 -0400 +++ b/scripts/display-synced-trajectories.py Sun May 27 23:22:48 2018 -0400 @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import sys, argparse, os.path from datetime import datetime, timedelta @@ -57,7 +57,7 @@ sys.exit() if windowNames is None: - windowNames = ['frame{}'.format(i) for i in xrange(len(filenames))] + windowNames = ['frame{}'.format(i) for i in range(len(filenames))] #wait = 5 #if rescale == 1.: for windowName in windowNames: @@ -72,13 +72,13 @@ key = -1 ret = True nFramesShown = 0 - for i in xrange(len(captures)): + for i in range(len(captures)): if firstFrameNums[i] > 0: captures[i].set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNums[i]) while ret and not cvutils.quitKey(key): rets = [] images = [] - for i in xrange(len(captures)): + for i in range(len(captures)): if firstFrameNums[i]+nFramesShown>=0: ret, img = captures[i].read() if ret and args.undistort: @@ -91,7 +91,7 @@ if np.array(rets).any(): #if printFrames: print('frame shown {0}'.format(nFramesShown)) - for i in xrange(len(filenames)): + for i in range(len(filenames)): if rets[i]:#firstFrameNums[i]+nFramesShown>=0: for obj in objects: if obj.existsAtInstant(mergedFirstFrameNum+nFramesShown): @@ -111,7 +111,7 @@ # cv2.imwrite('image-{}.png'.format(frameNum), img) nFramesShown += args.step if args.step > 1: - for i in xrange(len(captures)): + for i in range(len(captures)): if firstFrameNums[i]+nFramesShown >= 0: captures[i].set(cv2.cv.CV_CAP_PROP_POS_FRAMES, firstFrameNums[i]+nFramesShown) cv2.destroyAllWindows()