AprilTags - which packages to use and how to generate / where to buy

For context, AprilTags are a fiducial system that can be used both for IDs (similar to a QR code) and determining relative positions (i.e., they were specifically designed to maintain accuracy with this task).

Ideal specifications:

  • something close to a one-click order
  • adhesive backing, which is removable (OK if it takes a bit of effort)
  • three sizes (i.e., “small, medium, large”) (can also base it loosely off of Hiwonder’s defaults)
  • rigid
  • chemical compatibility becomes a consideration. I think I had looked into this a fair bit, but I’m having trouble finding where I put those notes. Maybe better if this is done through a lamination rather than trying to get it printed directly on

In terms of choosing a tag family:

For the vast majority of applications, the tagStandard41h12 family will be the correct choice. You can find the images for the tags in the apriltag-imgs repo. Scale up the images in your favorite editor and print them out.

Some heuristics for when to choose other tag families:

  1. If you need more tags, use tagStandard52h13
  2. If you need to maximize the use of space on a small circular object, use tagCircle49h12 (or tagCircle21h7).
  3. If you want to make a recursive tag use tagCustom48h12.
  4. If you want compatibility with the ArUcO detector use tag36h11

If none of these fit your needs, generate your own custom tag family here.

It seems apriltag-imgs/tagStandard41h12 at master · AprilRobotics/apriltag-imgs · GitHub has ~1115 images (2 at the start were other files). However, it wouldn’t be so bad to print other tag sets in that repo. For example, apriltag-imgs/tagCircle49h12 at master · AprilRobotics/apriltag-imgs · GitHub and apriltag-imgs/tagCustom48h12 at master · AprilRobotics/apriltag-imgs · GitHub (note: these are on the order of ~50000 files, but I could only print the first 1000 for example).

In terms of scaling to different sizes, the image repository also says:

Alternately, you can use the supplied native Python 3 script tag_to_svg.py to create a SVG (Scalable Vector Graphics) Version of a tag. For example:

python3 tag_to_svg.py tagStandard52h13/tag52_13_00007.png tag52_13_00007.svg --size=20mm

Some vendors based on Google Search

Likewise, in terms of AprilTag software, there is the official one which requires some manual installation:

Or a non-official, but pip-installable version: pupil-apriltags 1.0.4.post9.dev1+gfff8536 (which could be a reasonable version)

It would be awesome to have a pip-installable version attached with the main repo, though.

EDIT: GitHub - duckietown/lib-dt-apriltags: Python bindings to the Apriltags library provides Python bindings for the official repo (and is even mentioned in the official repo README), but it’s pinned to a 2021 version of apriltags and hasn’t been updated since 2023.

Also worth noting perhaps that there are some more recent implementations of AprilTags (I think on the official repo) that are annular (i.e., could be put around a vial) flexible (but not explicitly in the sense of “curved”). See Any examples of annular / curved surface AprilTags? · Issue #380 · AprilRobotics/apriltag · GitHub

It would probably help to compile a list of some adhesive label printing services that have decent chemical compatibility. As an aside, I bought a label printer that comes with a Python API with the intention of setting up an inventory system that auto-prints AprilTags as new items are added

A few other resources:

Nice use-case of AprilTags in the context of laboratory automation:

Ideas and some references around the use of AprilTags are also described in Section 4.2.1 of an article I wrote with Stanley Lo:

I’m using the apriltag package at PyPI – free and easy install with pip. I use these as the underlying tags for our lab’s RPLtags:

  • apriltags are the base component, lets us leverage optimized detection of individual stamps
  • tag ID identification and inferred distance are robustly computed by the apriltag package
  • unfortunately, pose estimation with four corner detections has ambiguity in orientation that sometimes rears its ugly head due to noise
  • many applications get around this by taking multiple frames in mobile video streams and ignoring ambiguous results
  • however, we want single frame pose estimation that is robust, hence RPLtags
  • layout of multiple apriltags into single RPLtag gives that robustness due to more than 4 points and known relative (in most of our templates: co-planar) constraints
  • RPLtags are registered in local database with layout info and multi-tag IDs
  • net benifit: robust pose estimation and huge ID space (great for future factory fun)

Regarding tag family choice, I tend toward tag36h11 because it is well-suited to a wide range of use cases with different cameras. It is less demanding of higher resolution detection than the denser families, and so can be seen more robustly at greater distance for a given resolution, or made smaller in physical size for use in constrained laboratory instrumentation labeling. It has a large enough code space for most applications of RPLtags, where our typical RPLtag template would include three apriltags in a fixed layout. By themselves, the tag36h11 family provides many hundreds of codes. In combinations of three the code space becomes hundreds of millions.

Hard at work now packaging RPLtags for general use and distribution to anybody who might find it useful!

1 Like