rameau-fr / MC-Calib

A generic and robust calibration toolbox for multi-camera systems
MIT License
377 stars 54 forks source link

Hand-Eye Calibration Assertion Failure with Non-Overlapping 4-Camera Fisheye Setup #70

Closed EladDan closed 3 months ago

EladDan commented 3 months ago

System information (version)

Vision system

Sketch of the cameras (1-4) + boards (A-D) setup

Describe the issue / bug

During the calibration process, immediately after the "Non-overlapping calibration initiated" step, the following error occurs: OpenCV(4.2.0) ../modules/calib3d/src/calibration_handeye.cpp:705: error: (-215:Assertion failed) Rgripper2base.size() >= 3 in function 'calibrateHandEye'

Console Log

I would greatly appreciate any guidance on resolving this failure. Thank you for your ongoing support and development of MC-Calib.

rameau-fr commented 3 months ago

Thank you very much for using MC-Calib and for your feedback. You have identified a very interesting corner case, which, fortunately, was quite easy to debug. The error occurs when initializing the camera groups. Our graph-based strategy discovers that 2 cameras are related, but no direct poses are yet known, leading to initialization failure.

This can easily be resolved by adding the following piece of code:

// Check if enough common poses are available:
if (pose_abs_1.size() <= 3 || pose_abs_2.size() <= 3) { return; }

to line 1448 of McCalib.cpp. For reference, see the code on GitHub: McCalib.cpp Line 1448. Then, you should be able to complete your calibration successfully. I achieved a mean reprojection error of 0.174003px, which is quite good. (Do not forget to compile again before testing.) This is just a quick fix, but I will discuss it more with @BAILOOL to possibly come up with something more elegant.

I also have some additional comments:

Please let me know if everything works for you.

EladDan commented 3 months ago

I've successfully calibrated the system using the fix you suggested, and it worked perfectly! Thank you so much for your quick and effective solution.

Also, I greatly appreciate your additional comments and insights. The images we used were initially taken just to validate that the system could be calibrated in this configuration. Rest assured, we will implement your suggestions for a more diverse range of motions and better image coverage to improve our calibration accuracy.

Thanks again for your support and guidance.