.. _handeyecalibration: Hand-Eye Calibration ==================== The algorithm performs a hand-eye calibration between the two input tracking sequences. Input ----- Two tracking sequences with the same number of samples. It's expected that the corresponding samples are matching. Output ------ Two tracking sequences: - Cam-to-Calib with applied registration of Calib-to-Base (Eye-In-Hand case)/ Calib-to-Cam with applied registration of Cam-to-Base (Eye-On-Base case); - Hand-to-Base with applied calibration of Cam-to-Hand (Eye-In-Hand case)/ Calib-to-Hand (Eye-On-Base case). The transformation matrices are printed in the log output - Cam-to-Hand (Eye-In-Hand case) or Calib-to-Hand (Eye-On-Base case); - Calib-to-Base (Eye-In-Hand case) or Cam-to-Base (Eye-On-Base case). Description ----------- The hand-eye calibration is used to find the relation between the coordinate system of the moving object (for example camera, or eye) and a coordinate system of a hand (for example a robot arm) which are moving rigidly together. See the following image for clarification of the coordinate systems. .. image:: HandEye1.png The input tracking sequences should represent :sup:`hand` T :sub:`base` and :sup:`moving` T :sub:`fixed` or their inverse. The algorithm will evaluate :sup:`moving` T :sub:`hand` and :sup:`fixed` T :sub:`base` There are two common scenarios in a hand-eye calibration problem, so called ``Eye In Hand`` and ``Eye On Base``. The particular scenario can be chosen via **Calibration Type**. See the following image for an illustration of these two scenarios. .. image:: HandEye2.png In case of ``Eye In Hand``, the *moving* coordinate system is the coordinate system of the camera, and the *fixed* coordinate system is the coordinate system of the calibration board. In case of ``Eye On Base`` it's vice versa. The algorithm requires to specify the type of transformation provided in each tracking sequence. This is done through the comboboxes **Stream1** and **Stream2**. The possible options are: * ``CamToCalib`` (:sup:`moving` T :sub:`fixed` in Eye-In-Hand case and :sup:`fixed` T :sub:`moving` in Eye-On-Base case), * ``CalibToCam`` (:sup:`fixed` T :sub:`moving` in Eye-In-Hand case and :sup:`moving` T :sub:`fixed` in Eye-On-Base case), * ``HandToBase`` (:sup:`hand` T :sub:`base`), * ``BaseToHand`` (:sup:`base` T :sub:`hand`). The computation algorithm can be specified through **Method**. The options are: * ``Tsai Lenz`` - refer to `paper `_ * ``Global MLSL`` - an `optimization `_ minimizing the pose difference between the left handside and right handside of the following equation: :sup:`moving` T :sub:`hand` * :sup:`fixed` T :sub:`moving` = :sup:`base` T :sub:`hand` * :sup:`fixed` T :sub:`base` **Reset matrices** indicates if matrices of the input tracking sequences should be reset to Identity before starting the computation. **Min rel. angle for sample selection** and **Min rel. translation for sample selection** specify the minimum angle/translation between a current tracking sample and a previously selected sample for the current sample to be selected for the computation. **Min rel. angle for pair selection** specifies the minimum angle between two tracking samples for the current pair of samples to be selected for the computation. A pair is a set of correspondences *i* and *j*: {:sup:`fixed` T :sub:`moving` (i), :sup:`hand` T :sub:`base` (i)} and {:sup:`fixed` T :sub:`moving` (j), :sup:`hand` T :sub:`base` (j)} **Pose inlier threshold** specifies the maximum pair error for the pair to be considered as an inlier. The error is computed from the difference of the left handside and the right handside of the following equation: :sup:`hand(i)` T :sub:`hand(j)` * :sup:`moving` T :sub:`hand` = :sup:`moving` T :sub:`hand` * :sup:`moving(i)` T :sub:`moving(j)` **Use RANSAC** specifies if a RANSAC scheme should be used for the computation. If used, three random pairs of poses will be selected for the calibration, this will be repeated a number of iterations and the best result will be selected. **RANSAC iterations** specifies the number of RANSAC itrations to be performed. **Apply non-linear refinement** indicates if the result should be attempted to be improved by executing a non-linear refinement minimizing the pose difference between the left handside and the right handside of the following equation: :sup:`moving` T :sub:`hand` * :sup:`fixed` T :sub:`moving` = :sup:`base` T :sub:`hand` * :sup:`fixed` T :sub:`base` The output of the algorithm will be two tracking sequences: - Cam-to-Calib with applied registration of Calib-to-Base (Eye-In-Hand case)/ Calib-to-Cam with applied registration of Cam-to-Base (Eye-On-Base case): :sup:`fixed` T :sub:`base` * :sup:`moving` T :sub:`fixed` - Hand-to-Base with applied calibration of Cam-to-Hand (Eye-In-Hand case)/ Calib-to-Hand (Eye-On-Base case): :sup:`hand` T :sub:`base` * :sup:`moving` T :sub:`hand` When the calibration and the registration are applied, the two tracking sequences should match as close as possible. The transformation matrices are also printed in the log output: - Cam-to-Hand (Eye-In-Hand case) or Calib-to-Hand (Eye-On-Base case): :sup:`moving` T :sub:`hand` - Calib-to-Base (Eye-In-Hand case) or Cam-to-Base (Eye-On-Base case): :sup:`fixed` T :sub:`base`