python 双目标定遇到TypeError: an integer is required (got type NoneType)

python 双目标定遇到错误

        ret, K1, D1, K2, D2, R, T, E, F = cv2.stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1,
                                                              distCoeffs1, cameraMatrix2, distCoeffs2, imageSize,
                                                              R=R, T=T, E=E, F=F, flags=flags)

错误类型:

Traceback (most recent call last):
  File "D:/VS2019/Camera-Calibration-Reconstruct/stereo_camera_calibration.py", line 241, in <module>
    args.height)
  File "D:/VS2019/Camera-Calibration-Reconstruct/stereo_camera_calibration.py", line 121, in stereo_calibrate
    self.image_size)
  File "D:/VS2019/Camera-Calibration-Reconstruct/stereo_camera_calibration.py", line 55, in stereoCalibrate
    R=R, T=T, E=E, F=F, flags=flags)
TypeError: an integer is required (got type NoneType)

这个函数传入的某一个参数是None,不是预期的整型值。这里面只有flags应该是int型的,往前查一下flags没有正确赋值

出现这个错误,说明你有参数的值是None了
仔细检查你传入的参数,先都print出来看看到底哪个是none
再往前找,看为什么会是none
另,变量名字不要和关键字一样,很容易把关键字给覆盖了