TL;DR:
A fiducial marker is a printed pattern with a known size and a code, designed so that a camera can find it and compute its position and orientation.
Distance follows from similar triangles:
Z = f × s / p, with focal length f in pixels, real side s, and apparent side p in pixels.Print the marker at the exact size you tell the software, because a size error becomes a distance error.
Tape a black and white square to a wall, point a camera at it, and a few lines of code can tell you how far the camera is from the wall, which way it is facing, and even which marker you are looking at. These squares, called fiducial markers, are one of the cheapest and most useful tools in a robotics lab.
What a fiducial marker is
A fiducial marker is a printed pattern designed to be easy for a computer to detect. A common type is a square with a thick black border and a grid of black and white cells inside that encodes an ID number. Well-known families are ArUco and AprilTag. The black border gives high contrast against its surroundings. The pattern inside identifies the marker and lets the software determine which corner is which, and so the marker's orientation.
How a camera gets a pose from it
The software finds the square's four corners in the image. Because the real marker is a known size and shape, a flat square, the way it appears distorted in the picture tells you where it is relative to the camera. Given the camera's calibration (focal length and lens distortion, see camera calibration), the four corner correspondences determine the full pose: three numbers for position and three for orientation. This is a standard computation known as the perspective-n-point (PnP) problem.
For intuition, take the simplest case: a marker facing the camera head-on, using the pinhole model. By similar triangles:
p / f = s / Z, so Z = f × s / p
where s is the real side length, p its width in pixels, f the focal length in pixels, and Z the distance from the camera along its optical axis.
Worked example: a printed marker giving a camera its pose
A marker is printed with a side s = 0.100 m. The camera has f = 600 pixels. In the image the marker's side measures p = 60 pixels, and its center is 80 pixels to the right of the image center.
Distance:
Z = 600 × 0.100 / 60 = 1.00 m.Sideways offset:
X = Z × (80 / 600) = 1.00 × 0.1333 = 0.133 mto the right.Bearing:
atan(80 / 600) = atan(0.1333) = 7.6°.Straight-line distance:
√(1.00² + 0.133²) = √1.0178 = 1.009 m.
Check by predicting the image: a 0.100 m marker at 1.00 m should span 600 × 0.100 / 1.00 = 60 pixels. ✓ At an offset of 0.133 m it should sit 600 × 0.133 / 1.00 = 80 pixels from the center. ✓
How sensitive is it? If the corner detection is off by one pixel, so p = 61, then Z = 600 × 0.100 / 61 = 0.984 m. That is 1.6 cm closer. A bigger marker or a closer view gives more pixels and a better estimate.
Now the effect of a print error. If the marker is printed 0.095 m wide but you told the software 0.100 m, then the software computes Z = 600 × 0.100 / 60 = 1.00 m, but the true distance is 600 × 0.095 / 60 = 0.95 m. A 5 mm print error turned into a 5 cm distance error. Measure the printed marker with a ruler and enter the real size.
The orientation comes from the shape of the quadrilateral. A marker seen at an angle looks like a trapezoid, and its sides foreshorten by the cosine of the tilt. The software solves for the tilt that explains the shape. Seen nearly head-on, the tilt direction becomes ambiguous, and the estimate can flip between two answers, so use markers seen at some angle or filter the result.
Uses in labs and robots
Localization. Put markers on the ceiling or walls at known places in the map. When the robot sees one, it computes its own pose in the map, a landmark fix of the kind described in localization.
Reference for experiments. A marker on a robot lets an overhead camera track its pose, giving a cheap ground truth to check odometry.
Docking and grasping. A marker on a charging dock or an object tells the robot where to approach, and an arm can use it to place its gripper.
Calibration. Boards of markers are used to calibrate cameras and to relate a camera to a robot arm.
Identification. The ID says which object or place the robot is looking at.
Where it goes wrong
Too small or too far. With few pixels across, the pose becomes noisy. Choose a size so the marker spans many pixels at the working distance.
Glare and blur. A glossy print reflects light and washes out cells. Use matte paper. Motion blur ruins the corners.
Poor calibration. If the camera calibration is off, the numbers are off.
Wrong size entered. As above.
Not flat. A curled or warped printout violates the flat-square assumption. Mount it on a rigid board.
Partial view. If a corner is hidden or leaves the frame, the marker is not detected.
Orientation ambiguity at head-on views.
Safety: Do not let a robot arm or vehicle move to a position computed from a marker without limits, since a misdetection can produce a wild target. Check that the pose is inside the expected workspace, limit speed and force, and keep an emergency stop in reach. Do not place markers where they could be mistaken for traffic or safety signs.
How real robots use them
Marker systems are common in research labs, classroom robots and warehouse trials because they need only a camera and a printer. They give a pose in a single frame without any learning. For richer 3D scenes the robot uses depth data instead, such as the point clouds a depth sensor produces. A cheaper but less robust way to identify a target is color, covered in color tracking to follow a ball.
Try it yourself
Print a marker at a size you can measure with a ruler, tape it flat to a board, and calibrate your camera using a standard procedure. Hold the board at 0.5 m, 1.0 m and 2.0 m from the camera, measured with a tape. Record the distance the software reports each time. Compare the errors, and see how they grow with distance. Then tilt the board and watch the orientation values change.
Frequently asked questions
Why use a square with a pattern, not a plain circle?
A square has four corners, which together fix position and orientation. The pattern inside makes each marker unique and shows which way is up.
How big should a marker be?
Big enough to cover many pixels at the farthest distance you work at. Larger markers give more accurate poses, so print them as large as practical.
