我正在使用OpenCV进行立体校准。我已经对单个摄像机进行了校准。对于以下代码段:
ret, rot, trans, ess, fund = cv2.stereoCalibrate(objectPoints=objpoints,
imagePoints1=imgpoints1,
imagePoints2=imgpoints2,
cameraMatrix1=mtx1,
distCoeffs1=dist1,
cameraMatrix2=mtx2,
distCoeffs2=dist2,
imageSize=gray1.shape[::-1],
flags=cv2.CALIB_FIX_INTRINSIC)
我得到了一个错误:
^{pr2}$但左边已经有五个变量了。根据这个documentation,函数cv2.stereoCalibrate()
应该在flags=cv2.CALIB_FIX_INTRINSIC
时返回5个值。在
Python: cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize[, R[, T[, E[, F[, flags[, criteria]]]]]]) → retval, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, R, T, E, F
以及
CV_CALIB_FIX_INTRINSIC Fix cameraMatrix? and distCoeffs? so that only R, T, E , and F matrices are estimated.
PS:我发现了这个answer,但它不适用于cv2
。在
如果您将返回值
cv2.stereoCalibrate()
分配给list
,并检查值的数量,您就可以知道它是否确实返回了5个值或其他值。这样就可以修复接收变量并相应地调整代码。在相关问题 更多 >
编程相关推荐