2017-03-17 213 views
0

我正在使用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) 

但是我已经在左手侧的五个变量。根据documentationflags=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

+0

你可以将'cv2.stereoCalibrate()'的返回值赋给一个'list'并检查一些值吗?这样你可以确认。 –

+0

@Anil_M感谢此工作。看起来这是返回9个值。但他的文件说了别的。 – harshatech2012

+0

'@ harshatech2012',我加了我的回答作为回答,你介意接受吗?这样,问题就不会像未答复一样悬而未决。 –

回答

0

如果您将cv2.stereoCalibrate()的返回值指定为list并检查值的数量,您可以知道它是否确实返回5个值或其他值。这样你就可以修复你的接收变量并相应地调整你的代码。

相关问题