我正在尝试在 OpenCV 4.1.1 中使用 stereoRectifyUncalibrated。代码如下。
points1 = np.array([[2566, 542], [2567, 848], [2569, 947],
[3154, 452], [3158, 934],
[4061, 332], [4069, 576]])
points2 = np.array([[277, 471], [290, 774], [296, 868],
[794, 393], [816, 830],
[1472, 310], [1480, 510]
])
F, mask = cv2.findFundamentalMat(points1, points2)
ret, H1, H2 = cv2.stereoRectifyUncalibrated(points1, points2, F, imgSize=(4112, 1200))
它会产生如下错误。
error Traceback (most recent call last)
---> 11 ret, H1, H2 = cv2.stereoRectifyUncalibrated(points1, points2, F, imgSize=(4112, 1200))
error: OpenCV(4.1.1) /home/hao/workspace/opencv/modules/core/src/convert_c.cpp:112: error: (-215:Assertion failed) src.size == dst.size && src.channels() == dst.channels() in function 'cvConvertScale'
正如文档所说“points2 第二张图像中的对应点。支持与 findFundamentalMat 中相同的格式。” (https://docs.opencv.org/4.1.1/d9/d0c/group__calib3d.html#gaadc5b14471ddc004939471339294f052)。我不知道是怎么回事。提前致谢!