Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/undistort-video.py @ 950:c03d2c0a4c04
corrected bugs
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 21 Jul 2017 18:18:02 -0400 |
| parents | dbd81710d515 |
| children | 933670761a57 |
comparison
equal
deleted
inserted
replaced
| 949:d6c1c05d11f5 | 950:c03d2c0a4c04 |
|---|---|
| 38 mkdir(destinationDirname) | 38 mkdir(destinationDirname) |
| 39 | 39 |
| 40 capture = cv2.VideoCapture(args.videoFilename) | 40 capture = cv2.VideoCapture(args.videoFilename) |
| 41 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) | 41 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) |
| 42 height = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)) | 42 height = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)) |
| 43 [map1, map2] = cvutils.computeUndistortMaps(width, height, args.undistortedImageMultiplication, intrinsicCameraMatrix, args.distortionCoefficients) | 43 [map1, map2], newCameraMatrix = cvutils.computeUndistortMaps(width, height, args.undistortedImageMultiplication, intrinsicCameraMatrix, args.distortionCoefficients) |
| 44 if args.maskFilename is not None: | 44 if args.maskFilename is not None: |
| 45 mask = cv2.imread(args.maskFilename) | 45 mask = cv2.imread(args.maskFilename) |
| 46 undistortedMask = cv2.remap(mask, map1, map2, interpolation=cv2.INTER_LINEAR)/255 | 46 undistortedMask = cv2.remap(mask, map1, map2, interpolation=cv2.INTER_LINEAR)/255 |
| 47 | 47 |
| 48 if capture.isOpened(): | 48 if capture.isOpened(): |
