diff trafficintelligence/tests/cvutils.txt @ 1287:76f5693b530c

updated tests for numpy 2
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sat, 20 Jul 2024 20:35:21 -0400
parents aafbc0bab925
children
line wrap: on
line diff
--- a/trafficintelligence/tests/cvutils.txt	Wed Jul 17 12:28:01 2024 -0400
+++ b/trafficintelligence/tests/cvutils.txt	Sat Jul 20 20:35:21 2024 -0400
@@ -10,7 +10,7 @@
 >>> [map1, map2], tmp = cvutils.computeUndistortMaps(width, height, multiplicationFactor, intrinsicCameraMatrix, distortionCoefficients)
 >>> undistorted = cv2.remap(img, map1, map2, interpolation=cv2.INTER_LINEAR)
 >>> (undistorted.shape == array([int(round(height*multiplicationFactor)), int(round(width*multiplicationFactor)), 3])).all()
-True
+np.True_
 >>> imgPoints = array([[[150.,170.],[220.,340.],[340.,440.],[401.,521.]]])
 >>> newCameraMatrix = cv2.getDefaultNewCameraMatrix(intrinsicCameraMatrix, (int(round(width*multiplicationFactor)), int(round(height*multiplicationFactor))), True)
 >>> undistortedPoints = cv2.undistortPoints(imgPoints, intrinsicCameraMatrix, distortionCoefficients, P = newCameraMatrix).reshape(-1, 2) # undistort and project as if seen by new camera
@@ -20,28 +20,28 @@
 >>> reducedPoints = dot(invNewCameraMatrix, tmp.T).T
 >>> origPoints = cv2.projectPoints(reducedPoints, (0.,0.,0.), (0.,0.,0.), intrinsicCameraMatrix, distortionCoefficients)[0].reshape(-1,2)
 >>> (round(origPoints[1:,:]) == imgPoints[0][1:,:]).all()
-True
+np.True_
 >>> (absolute(origPoints[0,:]-imgPoints[0][0,:])).max() < 6.
-True
+np.True_
 >>> reducedPoints2 = cvutils.newCameraProject(undistortedPoints.T, invNewCameraMatrix)
 >>> (reducedPoints == reducedPoints).all()
-True
+np.True_
 
 >>> undistortedPoints2 = cv2.undistortPoints(imgPoints, intrinsicCameraMatrix, distortionCoefficients).reshape(-1, 2) # undistort and project as if seen by new camera
 >>> undistortedPoints2 = cvutils.newCameraProject(undistortedPoints2.T, newCameraMatrix)
 >>> (undistortedPoints == undistortedPoints2.T).all()
-True
+np.True_
 
 >>> undistortedPoints = cv2.undistortPoints(imgPoints, intrinsicCameraMatrix, distortionCoefficients).reshape(-1, 2) # undistort to ideal points
 >>> origPoints = cvutils.worldToImageProject(undistortedPoints.T, intrinsicCameraMatrix, distortionCoefficients).T
 >>> (round(origPoints[1:,:]) == imgPoints[0][1:,:]).all()
-True
+np.True_
 >>> (absolute(origPoints[0,:]-imgPoints[0][0,:])).max() < 6.
-True
+np.True_
 
 >>> undistortedPoints = cvutils.imageToWorldProject(imgPoints[0].T, intrinsicCameraMatrix, distortionCoefficients)
 >>> origPoints = cvutils.worldToImageProject(undistortedPoints, intrinsicCameraMatrix, distortionCoefficients).T
 >>> (round(origPoints[1:,:]) == imgPoints[0][1:,:]).all()
-True
+np.True_
 >>> (absolute(origPoints[0,:]-imgPoints[0][0,:])).max() < 6.
-True
+np.True_