CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Add Hand-Eye calibration methods #13880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1b62b94
to
49f0ec0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contribution!
modules/calib3d/src/calibration.cpp
Outdated
Mat tinv = -Rt * t; | ||
Mat Tinv = Mat::eye(4, 4, T.type()); | ||
Rt.copyTo(Tinv(Rect(0, 0, 3, 3))); | ||
tinv.copyTo(Tinv(Rect(3, 0, 1, 3))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using of Matx44d
for well known mat sizes (including input/output parameters).
20058ea
to
a204121
Compare
I have added some well-known hand-eye calibration methods:
I have also moved the code to a new file Many thanks to Mili Shah for providing a clean Matlab implementation for these algorithms.
For now, I did not used
Also, I have found a weird thing, probably a missing operator:
Some functions that I had to defined but are worth or could be available in OpenCV:
|
f45f920
to
7c73a79
Compare
@catree Could you please fill an issue about Matx multiplication with your code? I will try to look on it later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
Please take a look on comments below.
CV_EXPORTS_W void calibrateHandEye( InputArrayOfArrays R_gripper2base, InputArrayOfArrays t_gripper2base, | ||
InputArrayOfArrays R_target2cam, InputArrayOfArrays t_target2cam, | ||
OutputArray R_cam2gripper, OutputArray t_cam2gripper, | ||
int method=CALIB_HAND_EYE_TSAI ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using enum HandEyeCalibrationMethod here (but need to check that bindings work properly).
Mat Pcg_norm = Pcg_.t() * Pcg_; | ||
//Obtained non-unit quaternion is scaled back to unit value that | ||
//designates camera-gripper rotation | ||
Mat Pcg = 2 * Pcg_ / sqrt(1 + Pcg_norm.at<double>(0,0)); //eq 14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
int idx = 0; | ||
for (size_t i = 0; i < Hg.size(); i++) | ||
{ | ||
for (size_t j = i+1; j < Hg.size(); j++, idx++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like idx
is not used here.
int idx = 0; | ||
for (size_t i = 0; i < Hg.size(); i++) | ||
{ | ||
for (size_t j = i+1; j < Hg.size(); j++, idx++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idx - used?
int newSize[] = {3, 3}; | ||
R = R.reshape(1, 2, newSize); | ||
//Eq 15 | ||
R = pow(sign_double(determinant(R)) / abs(determinant(R)), 1.0/3.0) * R; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
determinant(R)
It is better to "cache" this value in local variable.
Thanks for the review. |
8235bcf
to
ea9869b
Compare
ea9869b
to
bbf39b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! Thank you 👍
@catree Can I put the params which from "solvePnp->Rodrigues" into "calibrateHandEye" directly? And I get the "rx ry rz" euler angles from my robot, which kinds of method can help me to get the rotation matrix which exactly match "calibrateHandEye"? |
For For The best would be to check if you can get directly either the rotation matrix or quaternion. With quaternion, the only pitfall is to be sure to get the correct "qx, qy,qz, qw" values. |
@catree 感谢如此快的回复,从solvePnp到Rodrigues输出的旋转矩阵转成欧拉角,采用哪种旋向?Z-Y-X还是X-Y-Z?然后calibrateHandEye采用的是统一的Z-Y-X还是X-Y-Z旋向?还是只考虑旋转矩阵,没考虑由欧拉角转换得到的旋转矩阵这种情况?然后就是对于标定的结果,有没有一种误差的评定方法?谢谢:D |
@msnh2012 Please write in English.
This is the representation of the Axis-Angle rotation formalism, also called rotation vector and also called Rodrigues vector: You should read a texbook on this subject, for instance. There are plenty of useful ressources on the net if you want more information. |
@catree Thanks! Can u give an example of hand-eye calibration for us? That will be very nice . |
@catree Thanks! 👍 |
Is it necessary to include more hand-eye calibration methods? It seems that most of these analytical methods do not work well for real-world tasks. |
@zarathustr Feel free to contribute in OpenCV (BSD-3 license) if you have better methods. |
This pullrequest changes
Add Hand-Eye calibration from Tsai method. This allows estimating the rigid transformation between a camera mounted on a robot gripper:
See also:
The current interface is:
calibrateHandEye
with a method parameter to choose different calibration methods? This can be a more general question also (e.g.calibrateCamera
,calibrateCameraRO
,fitEllipse
,fitEllipseAMS
,fitEllipseDirect
, ...).HandEyeCalibration()