我正在使用OpenCV进行立体声校准。我已经执行了单个相机的校准。对于下面的代码片段:Python - OpenCV stereoCalibrate()太manu值来解压
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)
我得到的错误:
Traceback (most recent call last):
File "stereoCalibration.py", line 94, in <module>
flags=cv2.CALIB_FIX_INTRINSIC)
ValueError: too many values to unpack (expected 5)
但是我已经在左手侧的五个变量。根据documentation,flags=cv2.CALIB_FIX_INTRINSIC
时函数cv2.stereoCalibrate()
应返回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'并检查一些值吗?这样你可以确认。 –
@Anil_M感谢此工作。看起来这是返回9个值。但他的文件说了别的。 – harshatech2012
'@ harshatech2012',我加了我的回答作为回答,你介意接受吗?这样,问题就不会像未答复一样悬而未决。 –