我在使用(-215:Assertion failed)
Python 3函数时得到initUndistortRectifyMap
。请让我知道为什么出现以下错误:
map1,map2 = cv2.initUndistortRectifyMap(cam_m, dist_c, None, None, (2316,3088), cv2.CV_32FC1)
cv2.error: OpenCV(4.1.0) /tmp/opencv-20190505-12101-14vk1fh/opencv-4.1.0/modules/calib3d/src/undistort.cpp:232: error: (-215:Assertion failed) A.size() == Size(3,3) && A.size() == R.size() in function 'initUndistortRectifyMap'
我看过以下帖子,但仍然无法解决此问题。
https://answers.opencv.org/question/68575/initundistortrectifymap-assert-error/
下面是我的源代码,其中cam_m
在图像中有两个特定点:
cam_m=np.array([[293.278, -817.067, 918.225],[507.324, -573.223, 831.045]])
dist_c=np.array([3.3037193933075820e-01, -2.0144603430574297e+00, 0, 0, 3.6424949872867396e+00])
map1,map2 = cv2.initUndistortRectifyMap(cam_m, dist_c, None, None, (2316,3088), cv2.CV_32FC1)
imageRectified = cv2.remap(image, imageRectified,map1, map2, INTER_LINEAR, BORDER_CONSTANT, 0);