# HG changeset patch # User Nicolas Saunier # Date 1499921573 14400 # Node ID 8148991b1dab2b5109f3e7d84122279486ddd775 # Parent 7db0f2853bfd39d96efac9826320faa223fdc015 bug correcting diff -r 7db0f2853bfd -r 8148991b1dab python/cvutils.py --- 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