From ae85e516c03d78a1befa5001c6918dfb42529511 Mon Sep 17 00:00:00 2001 From: LuukvandenBent <94459309+LuukvandenBent@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:12:29 +0200 Subject: [PATCH] Merge pull request #25423 from LuukvandenBent:CalibrateHandEyeDatatypeFix Calibrate hand eye datatype fix #25423 Fix for issue https://github.com/opencv/opencv/issues/25421. See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake --- modules/calib3d/src/calibration_handeye.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/calib3d/src/calibration_handeye.cpp b/modules/calib3d/src/calibration_handeye.cpp index 25fa5af053..ab20597c8b 100644 --- a/modules/calib3d/src/calibration_handeye.cpp +++ b/modules/calib3d/src/calibration_handeye.cpp @@ -722,7 +722,11 @@ void calibrateHandEye(InputArrayOfArrays R_gripper2base, InputArrayOfArrays t_gr if(R_gripper2base_[i].size() == Size(3, 3)) R_gripper2base_[i].convertTo(R, CV_64F); else - Rodrigues(R_gripper2base_[i], R); + { + cv::Mat R_temp; + Rodrigues(R_gripper2base_[i], R_temp); + R_temp.convertTo(R, CV_64F); + } Mat t = m(Rect(3, 0, 1, 3)); t_gripper2base_[i].convertTo(t, CV_64F); @@ -740,7 +744,11 @@ void calibrateHandEye(InputArrayOfArrays R_gripper2base, InputArrayOfArrays t_gr if(R_target2cam_[i].size() == Size(3, 3)) R_target2cam_[i].convertTo(R, CV_64F); else - Rodrigues(R_target2cam_[i], R); + { + cv::Mat R_temp; + Rodrigues(R_target2cam_[i], R_temp); + R_temp.convertTo(R, CV_64F); + } Mat t = m(Rect(3, 0, 1, 3)); t_target2cam_[i].convertTo(t, CV_64F); @@ -920,7 +928,9 @@ void calibrateRobotWorldHandEye(InputArrayOfArrays R_world2cam, InputArrayOfArra } else { - Rodrigues(rot, R); + cv::Mat R_temp; + Rodrigues(rot, R_temp); + R_temp.convertTo(R, CV_64F); R_base2gripper_.push_back(R); } Mat tvec = t_base2gripper_tmp[i]; @@ -938,7 +948,9 @@ void calibrateRobotWorldHandEye(InputArrayOfArrays R_world2cam, InputArrayOfArra } else { - Rodrigues(rot, R); + cv::Mat R_temp; + Rodrigues(rot, R_temp); + R_temp.convertTo(R, CV_64F); R_world2cam_.push_back(R); } Mat tvec = t_world2cam_tmp[i];