Mercurial Hosting > traffic-intelligence
diff python/cvutils.py @ 924:a71455bd8367
work in progress on undistortion acceleration
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 07 Jul 2017 18:01:45 -0400 |
parents | 8f60ecfc2f06 |
children | dbd81710d515 |
line wrap: on
line diff
--- a/python/cvutils.py Wed Jul 05 23:01:24 2017 -0400 +++ b/python/cvutils.py Fri Jul 07 18:01:45 2017 -0400 @@ -122,10 +122,11 @@ def computeUndistortMaps(width, height, undistortedImageMultiplication, intrinsicCameraMatrix, distortionCoefficients): newImgSize = (int(round(width*undistortedImageMultiplication)), int(round(height*undistortedImageMultiplication))) - newCameraMatrix = deepcopy(intrinsicCameraMatrix) - newCameraMatrix[0,2] = newImgSize[0]/2. - newCameraMatrix[1,2] = newImgSize[1]/2. - return cv2.initUndistortRectifyMap(intrinsicCameraMatrix, array(distortionCoefficients), identity(3), newCameraMatrix, newImgSize, cv2.CV_32FC1) + #newCameraMatrix = deepcopy(intrinsicCameraMatrix) + #newCameraMatrix[0,2] = newImgSize[0]/2. + #newCameraMatrix[1,2] = newImgSize[1]/2. + newCameraMatrix = cv2.getDefaultNewCameraMatrix(intrinsicCameraMatrix, newImgSize, True) + return cv2.initUndistortRectifyMap(intrinsicCameraMatrix, array(distortionCoefficients), None, newCameraMatrix, newImgSize, cv2.CV_32FC1) def playVideo(filenames, windowNames = None, firstFrameNums = None, frameRate = -1, interactive = False, printFrames = True, text = None, rescale = 1., step = 1, colorBlind = False): '''Plays the video(s)'''