Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/undistort-video.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 | c03d2c0a4c04 |
| children | acb4f6f6545d |
comparison
equal
deleted
inserted
replaced
| 997:4f3387a242a1 | 998:933670761a57 |
|---|---|
| 1 #! /usr/bin/env python | 1 #! /usr/bin/env python3 |
| 2 | 2 |
| 3 import sys, argparse | 3 import sys, argparse |
| 4 | 4 |
| 5 import numpy as np | 5 import numpy as np |
| 6 import cv2 | 6 import cv2 |
| 48 if capture.isOpened(): | 48 if capture.isOpened(): |
| 49 ret = True | 49 ret = True |
| 50 frameNum = args.firstFrameNum | 50 frameNum = args.firstFrameNum |
| 51 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, args.firstFrameNum) | 51 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, args.firstFrameNum) |
| 52 if args.lastFrameNum is None: | 52 if args.lastFrameNum is None: |
| 53 from sys import maxint | 53 lastFrameNum = float('inf') |
| 54 lastFrameNum = maxint | |
| 55 else: | 54 else: |
| 56 lastFrameNum = args.lastFrameNum | 55 lastFrameNum = args.lastFrameNum |
| 57 nZerosFilename = int(ceil(log10(lastFrameNum))) | 56 nZerosFilename = int(ceil(log10(lastFrameNum))) |
| 58 while ret and frameNum < lastFrameNum: | 57 while ret and frameNum < lastFrameNum: |
| 59 ret, img = capture.read() | 58 ret, img = capture.read() |
