Skip to content

Commit 3c3e131

Browse files
authored
Merge pull request opencv#17977 from paroj:hervec
* calib3d: calibrateHandEye - allow using Rodrigues vectors for rotation * calib3d: calibrateHandEye - test rvec representation
1 parent a218cf3 commit 3c3e131

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

modules/calib3d/src/calibration_handeye.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,10 @@ void calibrateHandEye(InputArrayOfArrays R_gripper2base, InputArrayOfArrays t_gr
712712
{
713713
Mat m = Mat::eye(4, 4, CV_64FC1);
714714
Mat R = m(Rect(0, 0, 3, 3));
715-
R_gripper2base_[i].convertTo(R, CV_64F);
715+
if(R_gripper2base_[i].size() == Size(3, 3))
716+
R_gripper2base_[i].convertTo(R, CV_64F);
717+
else
718+
Rodrigues(R_gripper2base_[i], R);
716719

717720
Mat t = m(Rect(3, 0, 1, 3));
718721
t_gripper2base_[i].convertTo(t, CV_64F);
@@ -727,7 +730,10 @@ void calibrateHandEye(InputArrayOfArrays R_gripper2base, InputArrayOfArrays t_gr
727730
{
728731
Mat m = Mat::eye(4, 4, CV_64FC1);
729732
Mat R = m(Rect(0, 0, 3, 3));
730-
R_target2cam_[i].convertTo(R, CV_64F);
733+
if(R_target2cam_[i].size() == Size(3, 3))
734+
R_target2cam_[i].convertTo(R, CV_64F);
735+
else
736+
Rodrigues(R_target2cam_[i], R);
731737

732738
Mat t = m(Rect(3, 0, 1, 3));
733739
t_target2cam_[i].convertTo(t, CV_64F);

modules/calib3d/test/test_calibration_hand_eye.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ void CV_CalibrateHandEyeTest::simulateData(RNG& rng, int nPoses,
317317
t_gripper2base_noise.at<double>(2,0) += rng.gaussian(0.001);
318318
}
319319

320-
R_target2cam.push_back(T_target2cam(Rect(0, 0, 3, 3)));
320+
// test rvec represenation
321+
Mat rvec_target2cam;
322+
cv::Rodrigues(T_target2cam(Rect(0, 0, 3, 3)), rvec_target2cam);
323+
R_target2cam.push_back(rvec_target2cam);
321324
t_target2cam.push_back(T_target2cam(Rect(3, 0, 1, 3)));
322325
}
323326
}

0 commit comments

Comments
 (0)