Skip to main content
v2026.11,986 entries · CC-BY 4.0

Hand-Eye Calibration: Eye-in-Hand vs Eye-to-Hand, AX=XB and OpenCV

Hand-eye calibration solves the camera-to-robot transform with AX=XB. Eye-in-hand vs eye-to-hand, OpenCV solvers, MoveIt steps and pose counts.

Written and maintained by CASRAI Editorial Board

Published

On this page

Hand-eye calibration finds the fixed rigid transform between a camera (the “eye”) and a robot arm (the “hand”), so that what the camera measures can be expressed in the robot’s own coordinate frames. In research it is the step that lets a vision-guided arm, such as an automated sample handler or a robotic positioning stage, move to a point the camera has seen. It is solved from several robot poses and camera views of a calibration target, using the equation AX = XB.

What hand-eye calibration is used for in research

MathWorks defines hand-eye calibration as “the process of determining the relative position and orientation between a robot arm” and a camera. Horaud and Dornaika, in a 2023 arXiv overview, describe the same task as determining the spatial relationship between a sensor and the robot hand it is mounted on, which matters for mapping sensor measurements into the robot’s workspace and for precise sensor-guided motion.

That makes it a measurement-chain problem as much as a robotics one. A laboratory that uses a camera to guide an arm (for example for pick-and-place of labware, or positioning a probe) relies on one transform to connect pixels to millimetres of arm motion. If that transform is wrong, every downstream position is wrong by a systematic offset. For this reason hand-eye calibration sits naturally beside the other calibration and verification topics on this site, such as sensor calibration and metrological traceability and uncertainty quantification; the editorial point is that a calibration result is worth keeping as a record together with the poses and software version that produced it, and worth re-checking when the camera or tool is remounted.

Hand-eye calibration is not the same as camera calibration. Intrinsic calibration (focal length, lens distortion) describes the camera alone and must come first: both the MoveIt tutorial and MathWorks list good intrinsics as a prerequisite. Hand-eye calibration then solves only the placement of that camera relative to the robot.

Eye-in-hand versus eye-to-hand

There are two standard configurations. In eye-in-hand (also called a moving camera) the camera is mounted on the robot and moves with it, and the calibration target stays fixed in the workspace. In eye-to-hand (a stationary camera) the camera sits in the environment, separate from the arm, and the target is mounted on the gripper. MathWorks and OpenCV both use these definitions. The table below sets out what each configuration solves for, using OpenCV’s notation, where b is the robot base, g the gripper, c the camera and t the calibration target.

Question Eye-in-hand Eye-to-hand
Where the camera is On the gripper or end effector, moving with it Static, observing a target mounted on the end effector
What stays fixed in the world The calibration target The camera and the robot base
Unknown X that is solved Gripper-from-camera transform (g T c) Base-from-camera transform (b T c)
Robot pose that enters the equations Base-from-gripper (b T g) Gripper-from-base (g T b)
Target pose that enters the equations Camera-from-target (c T t), from pose estimation on each image Camera-from-target (c T t), from pose estimation on each image
Form of the equation Ai X = X Bi Ai X = X Bi

The point that top tutorials often leave implicit is the last row: both configurations reduce to the same AX = XB form. Only the meaning of the matrices changes, which is why one solver function can serve both.

What AX = XB means

MathWorks (following the Tsai and Lenz method) describes A as the robot gripper’s motion between two positions, B as the motion of the camera or calibration target, whichever moves with the gripper, and X as the unknown transform. OpenCV’s documentation states that the problem “is also known as solving the AX=XB equation” and writes out, for the eye-in-hand case, Ai = (b T g(2))-1 b T g(1) and Bi = c T t(2) (c T t(1))-1. Each pair of poses therefore yields one A and one B, which is why the quality and spread of your poses decide how well X is determined.

How to install or access OpenCV and MoveIt Calibration

Two free, widely used implementations are described here. Both are open source and documented by their own projects.

OpenCV

The hand-eye solver is the function calibrateHandEye in the calib3d module of OpenCV; the documentation text used for this page is from the 4.x branch of the OpenCV source. Install OpenCV from the project’s official channels at opencv.org and its GitHub repository, following the install instructions for your platform. The function is exported to Python as cv2.calibrateHandEye, and its signature in the header is:

calibrateHandEye(R_gripper2base, t_gripper2base, R_target2cam, t_target2cam, R_cam2gripper, t_cam2gripper, method = CALIB_HAND_EYE_TSAI)

MoveIt Calibration

MoveIt’s hand-eye tutorial uses the moveit_calibration package. Its install block, from the workspace src directory, is as follows:

  1. git clone [email protected]:moveit/moveit_calibration.git
  2. rosdep install -y --from-paths . --ignore-src --rosdistro melodic
  3. catkin build
  4. source devel/setup.sh

The tutorial page lists melodic (a ROS 1 distribution) in the rosdep line, so replace it with the distribution you actually run. Before starting, the tutorial expects a working MoveIt configuration for your arm (the Getting Started and Setup Assistant tutorials) and a camera that publishes images together with a sensor_msgs/CameraInfo topic carrying accurate intrinsic calibration.

How to run hand-eye calibration step by step

The workflow below follows MoveIt’s eye-in-hand tutorial, because it is the one worked, tool-level procedure in the sources. The same data requirements apply to any tool: pairs of robot pose and target pose, recorded at many different arm positions.

  1. Launch the demo. The tutorial starts RViz from the MoveIt demo launch file, for example roslaunch panda_moveit_config demo.launch.
  2. Load the panel. Choose Panels, then Add New Panel and select “HandEyeCalibration”.
  3. Create and print the target (Target tab). The default target is an ArUco board with 3 markers in X and 4 in Y, marker size 200 px, marker separation 20 px, marker border 1 bit, and dictionary DICT_5X5_250. Click “Create Target”, then “Save Target”, and print it. Keep the parameters you printed with, because the detector needs them to match. Lay the printed target flat, measure the marker width and the separation in metres, and enter those values.
  4. Select the camera topics. Choose the “Image Topic” and “CameraInfo Topic”, and place the target near the robot where the camera can see it.
  5. Set the context (Context tab). Set “Sensor configuration” to Eye-in-hand. Set the sensor frame (the camera optical frame), the object frame (default handeye_target), the end-effector frame and the robot base frame. An initial guess for the camera pose is not required.
  6. Choose the solver (Calibrate tab). The “AX=XB Solver” dropdown defaults to Daniilidis, which the tutorial says suits most cases. Set the “Planning Group” to your arm group.
  7. Take samples. When the target axis appears in the detection image (topic /handeye_calibration/target_detection), click “Take sample” under “Manual calibration”. Move the arm using the MotionPlanning panel, a teach pendant or free drive, and take another sample.
  8. Vary the rotations. Change the orientation between poses, using at least two different rotation axes.

For a scripted pipeline with OpenCV, the same recorded data feeds calibrateHandEye. For every pose you supply the gripper-to-base rotation and translation from the robot’s kinematics, and the target-to-camera rotation and translation from pose estimation on the image (2D-3D correspondences). OpenCV accepts the rotations as 3×3 matrices or as 3×1 rotation vectors and the translations as 3×1 vectors.

How many poses are needed

The two sources state different thresholds because they answer different questions, and the table in the data section below puts them side by side. OpenCV’s mathematical minimum is two motions with non-parallel rotation axes, which means “at least 3 different poses”, and it “strongly” recommends many more. MoveIt’s tutorial computes the first result automatically once five samples exist and says accuracy typically plateaus after about 12 to 15 samples. MathWorks adds a practical caution: the end effector should rotate about at least two different axes, and a SCARA robot that rotates mainly about one axis may give inaccurate or non-unique results. Treat 3 as the theoretical floor, not a target.

How to read the output

With OpenCV, the output is the pair R_cam2gripper (a 3×3 rotation) and t_cam2gripper (a 3×1 translation): the transform that takes a point in the camera frame to the gripper frame, written g T c in the documentation. That is the eye-in-hand result. For an eye-to-hand setup, OpenCV states that the camera-to-base transform can be estimated by inputting the suitable transformations; in the documented equations the robot input becomes gripper-from-base and the solved X is the base-from-camera transform. Use the same frame conventions for the robot poses and the target poses throughout, because swapping a transform with its inverse is the commonest source of an apparently plausible but wrong result.

In MoveIt the calibrated pose appears on the Context tab and the published TF is updated as samples are added. “Save camera pose” exports a launch file with a static transform publisher for the camera. “Save joint states”, in the Settings section, stores the recorded arm poses so the same poses can be replayed for a later recalibration. The number of recorded states is shown beside the progress bar at the bottom of the panel.

Checking the result

MathWorks recommends checking accuracy by visualising the robot base, the gripper, the camera and the calibration board together in one 3-D space; if the picture is not geometrically consistent, the transform is not right. An editorial addition from calibration-verification practice: keep a few poses out of the solve and use them afterwards to see whether the transform predicts the target positions you measure there. That is a verification step of the kind used elsewhere in the lab-calibration literature, not a procedure published by OpenCV or MoveIt, and it is what turns “the solver ran” into evidence that the calibration holds.

Choosing among OpenCV’s five solvers

OpenCV implements five solution methods, selected with the method argument. Three estimate rotation first and then translation (separable solutions): Tsai (the default), Park and Horaud. Two estimate rotation and translation simultaneously: Andreff and Daniilidis. The data table below lists each constant with its original paper as cited in the OpenCV header. Horaud and Dornaika’s 2023 overview reports that, in a stability comparison against the classical linear Tsai and Lenz method, the joint nonlinear method appears the most robust to noise and measurement error; that is a finding about their own comparison, so run more than one method on your data and compare the results rather than assuming one is best.

Troubleshooting hand-eye calibration

  • Result changes a lot between runs. MoveIt’s tutorial notes that poor results usually come from too few samples or from rotations about only one axis. Add samples and vary the rotation axes. MathWorks gives the same warning for robots whose motion is mostly about one axis.
  • The target is not detected. Confirm the printed target parameters match what you entered in the MoveIt panel, and confirm the target axis is drawn in the detection image before you click “Take sample”.
  • Unstable pose estimates. The MoveIt tutorial says the target must be flat to be reliably localised by the camera, so mount a printed board on a rigid flat backing.
  • Camera intrinsics changed. Both the MoveIt tutorial and MathWorks require intrinsic calibration first, and MathWorks says to keep the camera focus constant during calibration. If you refocus or change lenses, redo the intrinsic calibration before the hand-eye calibration.
  • A plausible-looking but wrong transform. Re-check which direction each transform runs (gripper-to-base versus base-to-gripper, target-to-camera versus camera-to-target), because OpenCV’s inputs are specifically gripper-to-base and target-to-camera.

Free alternatives to hand-eye calibration tools

The two tools above are free and open source. The table lists what each source says about its own scope; it makes no recommendation.

Tool What the documentation says it does Configurations covered
OpenCV calibrateHandEye Solves AX = XB from lists of gripper-to-base and target-to-camera transforms using five methods Eye-in-hand directly; eye-to-hand by supplying the suitable transformations
OpenCV calibrateRobotWorldHandEye Estimates robot-world and hand-eye transforms (world-from-base and camera-from-gripper) with the Shah and Li methods Robot-world/hand-eye problem with a camera on the end effector
MoveIt Calibration (moveit_calibration) panel RViz panel with a built-in ArUco target, sample capture and a selectable AX=XB solver (Daniilidis by default) The tutorial covers eye-in-hand; eye-to-hand is described as the camera fixed in the robot base frame

If you are simulating before moving real hardware, Webots and robosuite are robot simulation environments covered elsewhere on this site. Whatever you use, follow the robot safety standards and safeguards that apply to your cell when the arm moves through the poses a calibration needs, since calibration poses are often unusual orientations that the arm does not take in normal operation.

Sources

Data: Hand-eye calibration solvers in OpenCV calibrateHandEye and pose-count guidance

Compares the five hand-eye calibration methods implemented in OpenCV calibrateHandEye (enum value, solution approach, original paper as cited in the header), compiled from the OpenCV calib3d header on the 4.x branch, and sets beside them the pose and sample-count guidance published by OpenCV and the MoveIt tutorial.

Period covered: 2026.

Hand-eye calibration solvers in OpenCV calibrateHandEye and pose-count guidance
Method or guidance itemOpenCV constant or sourceEnum value or countApproach or statementOriginal paper or source text
Tsai (default)CALIB_HAND_EYE_TSAI0Separable: rotation estimated first, then translationTsai and Lenz 1989: A New Technique for Fully Autonomous and Efficient 3D Robotics Hand/Eye Calibration
ParkCALIB_HAND_EYE_PARK1Separable: rotation estimated first, then translationPark and Martin 1994: Robot Sensor Calibration: Solving AX = XB on the Euclidean Group
HoraudCALIB_HAND_EYE_HORAUD2Separable: rotation estimated first, then translationHoraud and Dornaika 1995: Hand-Eye Calibration
AndreffCALIB_HAND_EYE_ANDREFF3Simultaneous: rotation and translation estimated togetherAndreff, Horaud and Espiau 1999: On-line Hand-Eye Calibration
DaniilidisCALIB_HAND_EYE_DANIILIDIS4Simultaneous: rotation and translation estimated togetherDaniilidis 1998: Hand-Eye Calibration Using Dual Quaternions
Minimum poses (OpenCV)OpenCV calib3d header3At least 2 motions with non-parallel rotation axes, so at least 3 poses; many more strongly recommendedOpenCV calibrateHandEye documentation
First automatic result (MoveIt)MoveIt hand-eye tutorial5Calibration is computed automatically once five samples exist and updates with each new sampleMoveIt Hand-Eye Calibration tutorial
Typical accuracy plateau (MoveIt)MoveIt hand-eye tutorial12 to 15Accuracy typically plateaus after about 12 to 15 samplesMoveIt Hand-Eye Calibration tutorial

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about Hand-Eye Calibration: Eye-in-Hand vs Eye-to-Hand, AX=XB and OpenCV

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →