Pablo García Ruiz logo
Back to projects
2023Workshop

Tiny Introduction to Fiducial Markers

A hands-on, from-scratch introduction to fiducial marker detection and pose estimation

Ready-to-useOpen Source
Report cover page: Tiny introduction to fiducial markers

Overview

A self-contained workshop that introduces fiducial markers from scratch, for anyone starting out in computer vision or augmented reality. It walks through Aruco marker detection, homography computation, pose estimation, and rendering a live 3D object that tracks a marker in real time.

It's built as hands-on C++ exercises rather than slides alone: two progressively more complete applications, a printable marker set, and a full written report and slide deck to follow along with.

From a thresholded image to a 3D object standing on the marker Four stages left to right, each one working on the output of the one before. First, the camera image after thresholding: a black and white picture holding the marker and several other dark shapes. Second, the closed outlines found in that image, with the non-marker shapes rejected for not being four-sided convex quadrilaterals, and the marker's four corners marked. Third, those four corners define a homography, which maps the slanted quadrilateral back to a square so the grid of bits inside it can be sampled square-on and read as an identifier. Fourth, three of the corners are fed to a P3P pose solver and the fourth picks the right answer among its candidates, giving the marker's full position and orientation, which is what lets a cube be drawn standing on it. The pose recovered at the last stage matches the pose the image was generated from to within a millionth of a millimetre, so every stage here is computed rather than drawn. What a marker detector actually does, stage by stageEach panel is computed from the one before it, not drawn to look like it 1 2 3 4 6x6 bits read pose recovered to 6e-12 mm 1. thresholdone image, marker and clutter alike2. find quadsfour-sided and convex, or rejected3. rectifya homography, then read the bits4. solve poseP3P on three; the fourth breaks the tie 1. thresholdone image, marker and clutter alike 2. find quadsfour-sided and convex, or rejected 3. rectifya homography, then read the bits 4. solve poseP3P on three; the fourth breaks the tie Every stage consumes the one before it: the pose at stage 4 is recovered from the corners found at stage 2, and lands 6e-12 mm from thepose the image was made with.
The four steps the workshop builds, in order. Every panel is computed from the one before it; the pose at the end is recovered from the corners found at stage 2.

What's Inside

Report

Alongside the two C++ applications, the workshop includes a full written report that walks through the theory behind each exercise in the same order the code is built: how Aruco markers are detected and decoded, how a homography is computed from marker corners, how that homography leads to a full 6DoF pose estimate, and how the resulting pose drives a live 3D render.

It's written to be read alongside mainApp and mainAppOvis rather than as a stand-alone document, every section maps to a concrete step in the code, and is paired with a slide deck covering the same material for anyone presenting or teaching from the workshop. The pages themselves are shown up top.

Download

The full workshop (code, printable markers, report, and slides) is available on GitHub.

View on GitHub
C++OpenCVCMakeOGRE / Ovis

License

The repository's README notes an MIT License; a separate LICENSE file is not yet published in the repo.