Mercurial Hosting > traffic-intelligence
diff python/cvutils.py @ 931:8148991b1dab
bug correcting
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 13 Jul 2017 00:52:53 -0400 |
parents | 7db0f2853bfd |
children | 66f382852e61 |
line wrap: on
line diff
--- a/python/cvutils.py Thu Jul 13 00:31:54 2017 -0400 +++ b/python/cvutils.py Thu Jul 13 00:52:53 2017 -0400 @@ -540,18 +540,18 @@ reducedPoints = projected projected, jacobian = cv2.projectPoints(reducedPoints.T, (0.,0.,0.), (0.,0.,0.), intrinsicCameraMatrix, distortionCoefficients) # in: 3xN, out: 2x1xN projected = projected.reshape(-1,2).T - return projected[:2,:] + return projected[:2,:] -def project(homography, p, intrinsicCameraMatrix = None, distortionCoefficients = None): +def project(homography, p, intrinsicCameraMatrix = None, distortionCoefficients = None, newCameraMatrix = None): '''Returns the coordinates of the projection of the point p with coordinates p[0], p[1] through homography''' - return projectArray(homography, array([[p[0]],[p[1]]]), intrinsicCameraMatrix, distortionCoefficients) + return projectArray(homography, array([[p[0]],[p[1]]]), intrinsicCameraMatrix, distortionCoefficients, newCameraMatrix) -def projectTrajectory(homography, trajectory, intrinsicCameraMatrix = None, distortionCoefficients = None): +def projectTrajectory(homography, trajectory, intrinsicCameraMatrix = None, distortionCoefficients = None, newCameraMatrix = None): '''Projects a series of points in the format [[x1, x2, ...], [y1, y2, ...]]''' - return projectArray(homography, array(trajectory), intrinsicCameraMatrix, distortionCoefficients) + return projectArray(homography, array(trajectory), intrinsicCameraMatrix, distortionCoefficients, newCameraMatrix) def invertHomography(homography): '''Returns an inverted homography