Mercurial Hosting > traffic-intelligence
diff scripts/polytracktopdtv.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 | 3058e00887bc |
children | cc5cb04b04b0 |
line wrap: on
line diff
--- a/scripts/polytracktopdtv.py Fri May 25 18:15:18 2018 -0400 +++ b/scripts/polytracktopdtv.py Sun May 27 23:22:48 2018 -0400 @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from pdtv import TsaiCamera, ZipVideo, SyncedVideos, TrackSet, Track, State import sys, os, datetime, argparse @@ -68,7 +68,6 @@ frameList = cvutils.getImagesFromVideo(videoFile, firstFrameNum = currentIdx, nFrames = inc) while len(frameList) == inc and inc > 0: - for f in frameList: cv2.imwrite(os.path.join(framePath,time.strftime("%Y%m%d-%H%M%S.%f")[:-3]+'.jpg'), f) time += datetime.timedelta(microseconds=deltaTimestamp*1000) @@ -80,7 +79,7 @@ inc = delta if inc: frameList = cvutils.getImagesFromVideo(videoFile, firstFrameNum = currentIdx, nFrames = inc) - print('Extracting frame ' + str(currentIdx)) + print('Extracting frame {}'.format(currentIdx)) return len(frameList) > 0 @@ -115,7 +114,7 @@ if videoFile is not None: fps = cvutils.getFPS(videoFile) - print('Video should run at ' + str(fps) + ' fps') + print('Video should run at {} fps'.format(fps)) deltaTimestamp = 1000.0/float(fps); if videoFolderExist == False: if os.path.exists(videoFolderPath):