Skip to main content

Apriltag Camera Calibration Board Generator

GitHub Latest Version image image PyPI - Downloads

Why? There didn't really seem to be an easy way to do this IMHO.

This library is able to produce both generation 2 and 3 apriltags all via python ( no C/C++ library compiling and linking).

However, you will need another library (like cv2.aruco) to decode the tags ... see below for more info. If you install the optional opencv, then the decoder will be installed automatically.

Install

pip install moms_apriltag          # from pypi
pip install moms_apriltag[opencv]  # from pypi w/OpenCV decoders

Development

# setup temp environment
python -m venv ./venv/test
. ./venv/test/bin/activate
pip install -U pip setuptools

pip install -e .            # local dev
pip install -e ".[opencv]"  # local dev w/optional OpenCV

# interactive tools
pip install jupyterlab matplotlib
pip install marimo wigglystuff matplotlib

Examples / Usage

See the jupyter notebooks in docs/jupyter folder for how to use this.

This package create a simple numpy image that can then be saved to a PNG or JPEG image and printed. For circular or custom tags, there is a toRGBA() function to save the tag to a png using any image library that can accept numpy array images.

Supported families are shown in the table below in the image and table:

Family Generation Hamming Size Data Bits Unique Tags
tag16h5 2 5 4x4 16 30
tag25h9 2 9 5x5 25 35
tag36h10 2 10 5x5 36 2,320
tag36h11 2 11 5x5 36 587
tagCircle21h7 3 7 9x9 36 38
tagCircle49h12 3 12 11x11 49 65,535
tagCustom48h12 3 12 10x10 48 42,211
tagStandard41h12 3 12 9x9 41 2,115
tagStandard52h13 3 13 10x10 52 48,714

ref

#!/usr/bin/env python3
from moms_apriltag import ApriltagBoard
import imageio

board = ApriltagBoard.create(4,6,"tag25h9", 0.02)
tgt = board.board

filename = "apriltag_target.png"
imageio.imwrite(filename, tgt)
# for AprilTag v2
from moms_apriltag import TagGenerator2
from matplotlib import pyplot as plt

tg = TagGenerator2("tag16h5")
tag = tg.generate(4)

plt.imshow(tag, cmap="gray)
# for AprilTag v3
from moms_apriltag import TagGenerator3
from matplotlib import pyplot as plt

tg = TagGenerator3("tagStandard41h12")
tag = tg.generate(137)

plt.imshow(tag, cmap="gray)

Apriltags using opencv-contrib-python for Camera Calibration Target Detection

This library uses the builtin cv2.aruco module that can detect:

  • DICT_APRILTAG_16H5
  • DICT_APRILTAG_25h9
  • DICT_APRILTAG_36h10
  • DICT_APRILTAG_36h11

Decoders

cv2.aruco for calibration is built in, but it can decode generation 2 tags only.

Todo

  • change the way the board is created, do a fixed scale size and add a margin with text saying the orientation, family, size, and maybe in the small squares next to the tags, put the number of the tag (number is for the lower left apriltag). I think this would help debugging and understanding what is going on
  • insert stereo calibration code using pupil labs?
  • move the opencv_camera calibration code with apriltags here
  • refactor board code
  • enable apriltag v3 markers in board
  • make OpenCV optional

MIT License

Copyright (c) 2020 Kevin J. Walchko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for moms-apriltag 2026.11.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moms-apriltag 2026.11.29
File Size Uploaded Provenance Actions
moms_apriltag-2026.11.29.tar.gz 1.3 MB Without provenance Details for moms_apriltag-2026.11.29.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for moms-apriltag 2026.11.29
File Interpreter ABI Platform Actions
moms_apriltag-2026.11.29-py3-none-any.whl Python 3 none any Details for moms_apriltag-2026.11.29-py3-none-any.whl

Total release size: 2.7 MB

Release files / moms_apriltag-2026.11.29.tar.gz

Download URL moms_apriltag-2026.11.29.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
dbee6fcff641a281bb40bfc2ed3e11e8b387cdaebb5a7845ba547955f7940061
BLAKE2b-256 checksum
How to use checksums
f5698461fe41f009049a7aaa699dd22877adecb7351e877f36030c7eef16470e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / moms_apriltag-2026.11.29-py3-none-any.whl

Download URL moms_apriltag-2026.11.29-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e7e5dc7e269a67b5bfd51081cd21f3de87828a93728882b1afd46d0e62615e0e
BLAKE2b-256 checksum
How to use checksums
0f9b25e03c1b9262131728f945ee6deb6f3d35920f3a9d2caba5c61fdf6968af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for moms-apriltag 2026.11.29

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page