Search code examples
pythonc++opencvcomputer-visionstereo-3d

Python - OpenCV module missing attribute CV_CALIB_FIX_INTRINSIC


I am using OpenCV for stereo calibration of cameras. I have already performed calibration of individual cameras. And according to this documentation, Specifying pre-calculated camera matrices and distortion coefficients requires one to pass the flag CV_CALIB_FIX_INTRINSIC

If the intrinsic parameters can be estimated with high accuracy for each of the cameras individually (for example, using calibrateCamera() ), you are recommended to do so and then pass CV_CALIB_FIX_INTRINSIC flag to the function along with the computed intrinsic parameters.

But how to pass the flags? The values I have tried:

flags="CV_CALIB_FIX_INTRINSIC"
flags=cv2.CV_CALIB_FIX_INTRINSIC
flags=CV_CALIB_FIX_INTRINSIC

I get the following errors (respectively):

TypeError: an integer is required (got type str)
Missing: module cv2 has no attribute CV_CALIB_FIX_INTRINSIC
NameError: name 'CV_CALIB_FIX_INTRINSIC' is not defined

Solution

  • The correct name is:

    cv2.CALIB_FIX_INTRINSIC