Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Different output from Python and C++ in CalibrateHandEye()

Hi,

We have tried to translate a C++ project into Python. The problem is that we get different outputs from the calibrateHandEye() function in the two versions. Even though the input is the same of course.

The code of interest is this part (C++ version)

Mat rotationCamera2Gripper, translationCamera2Gripper;

calibrateHandEye(rotationGripper2Base, translationGripper2Base, rvecsRod, tvecs,
                 rotationCamera2Gripper, translationCamera2Gripper, CALIB_HAND_EYE_TSAI);

Mat rotVecCam2Gripper;
Rodrigues(rotationCamera2Gripper, rotVecCam2Gripper);

std::cout << "Rot: " << std::endl << rotVecCam2Gripper << std::endl;
std::cout << "Trans: " << std::endl << translationCamera2Gripper << std::endl;

and in Python:

rotationCamera2Gripper, translationCamera2Gripper = cv.calibrateHandEye(
                    rotationGripper2Base, 
                    translationGripper2Base,
                    rvecsRod, 
                    tvecs, 
                    method=cv.CALIB_HAND_EYE_TSAI)


rotVecCam2Gripper, _ = cv.Rodrigues(rotationCamera2Gripper)

print("Rot:")
print(rotVecCam2Gripper)
print("Trans: ")
print(translationCamera2Gripper)

The main difference is between the translation vectors. Output from C++:

image description

Output from Python:

image description

We end up in a situation where everything before calibrateHandEye seem to be the same, but the output is different. Any hint to what could be the problem is appreciated :)