Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/undistort-video.py @ 770:0f6b0f63eb07 dev
corrected for OpenCV 3
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 21 Jan 2016 23:44:51 -0500 |
| parents | d72e4bcc1e36 |
| children | 52aa03260f03 |
comparison
equal
deleted
inserted
replaced
| 769:dfdb2a3722cc | 770:0f6b0f63eb07 |
|---|---|
| 38 destinationDirname = args.destinationDirname | 38 destinationDirname = args.destinationDirname |
| 39 if not path.exists(destinationDirname): | 39 if not path.exists(destinationDirname): |
| 40 mkdir(destinationDirname) | 40 mkdir(destinationDirname) |
| 41 | 41 |
| 42 capture = cv2.VideoCapture(args.videoFilename) | 42 capture = cv2.VideoCapture(args.videoFilename) |
| 43 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) | 43 width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) |
| 44 height = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)) | 44 height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) |
| 45 [map1, map2] = cvutils.computeUndistortMaps(width, height, args.undistortedImageMultiplication, intrinsicCameraMatrix, args.distortionCoefficients) | 45 [map1, map2] = cvutils.computeUndistortMaps(width, height, args.undistortedImageMultiplication, intrinsicCameraMatrix, args.distortionCoefficients) |
| 46 if capture.isOpened(): | 46 if capture.isOpened(): |
| 47 ret = True | 47 ret = True |
| 48 frameNum = args.firstFrameNum | 48 frameNum = args.firstFrameNum |
| 49 capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, args.firstFrameNum) | 49 capture.set(cv2.CAP_PROP_POS_FRAMES, args.firstFrameNum) |
| 50 if args.lastFrameNum is None: | 50 if args.lastFrameNum is None: |
| 51 from sys import maxint | 51 from sys import maxint |
| 52 lastFrameNum = maxint | 52 lastFrameNum = maxint |
| 53 else: | 53 else: |
| 54 lastFrameNum = args.lastFrameNum | 54 lastFrameNum = args.lastFrameNum |
