Search code examples
pythoncameramappingprojectioncamera-calibration

I am facing this error when running the camera-projector calibration script


Traceback (most recent call last): File "calibration_ChArucoWithCircles.py", line 255, in distCoeffs=distCoeffs) cv2.error: OpenCV(4.5.3) :-1: error: (-5:Bad argument) in function 'estimatePoseCharucoBoard' Overload resolution failed:

  • Required argument 'rvec' (pos 6) not found
  • Required argument 'rvec' (pos 6) not found

Does anyone know how to solve this issue, thank you.

Here is the script which cause the error:

pose, rvec, tvec = aruco.estimatePoseCharucoBoard(
                charucoCorners=charuco_corners, 
                charucoIds=charuco_ids, 
                board=CHARUCO_BOARD, 
                cameraMatrix=cameraMatrix, 
                distCoeffs=distCoeffs)

Solution

  • Try adding two empty arrays at the end, one for the rotation matrix and one for the translation matrix:

    pose, rvec, tvec = aruco.estimatePoseCharucoBoard(
        charuco_corners, 
        charuco_ids, 
        CHARUCO_BOARD, 
        cameraMatrix, 
        distCoeffs,
        np.empty(1),
        np.empty(1)
    )
    

    Documentation

    The two np.empty(1) arrays are needed in the case of Pose estimation without calibration data as a first estimation for rvec and tvec.