Skip to main content

RapidTag — fast realtime fiducial marker (ArUco/AprilTag) detection in Rust

Project description

RapidTag

Fast, pure-Rust fiducial marker detection for realtime. RapidTag is a from-scratch Rust reimplementation of OpenCV's ArUco / AprilTag marker detector, exposed to Python via maturin / PyO3no OpenCV runtime dependency. It matches OpenCV's detections bit-for-bit while running faster on realtime single-frame workloads.

Why RapidTag

  • Faster than OpenCV for realtime single-frame detection (~370 vs ~330 FPS on 1280×800 mono; see below), and much faster for multi-camera / offline batches.
  • 🎯 OpenCV-accurate — validated at 0.0000 px corner agreement on synthetic, perspective-warped, and real camera data.
  • 🧵 Scales with your cores — a batch API processes many frames (e.g. a stereo pair, or a whole recording) across all cores with the GIL released.
  • 📦 No OpenCV needed at runtime — the detection pipeline and marker dictionaries are reimplemented in pure Rust on top of image / nalgebra.

Performance

Measured on real OV9281 dual-camera data (1280×800 monochrome, AprilTag 36h11), 24-core CPU:

Workload RapidTag OpenCV (single-thread)
Single-frame (realtime, one camera) ~370 FPS (2.7 ms) ~330 FPS (3.0 ms)
Dual-camera pair (both cameras/tick) ~590 FPS total (3.4 ms/pair)
Offline batch (all cores) ~700 FPS

Detection parity vs OpenCV: 0.0000 px mean corner error; identical marker sets (RapidTag detects a few extra at the margins).

Status

v1 — marker detection (detectMarkers, CORNER_REFINE_NONE), faithfully ported from opencv/modules/objdetect/src/aruco/:

  • Adaptive-threshold candidate detection across window-size scales (sliding-window box sum)
  • Suzuki-Abe contour tracing → polygon approximation → convex-square filtering
  • Near-duplicate candidate grouping
  • Perspective removal + Otsu bit extraction
  • Dictionary identification via Hamming distance over the 4 rotations

Supported dictionaries: all DICT_{4,5,6,7}X{4,5,6,7}_{50,100,250,1000}, DICT_ARUCO_ORIGINAL, DICT_ARUCO_MIP_36h12, and AprilTag DICT_APRILTAG_{16h5,25h9,36h10,36h11}.

Not yet implemented (future): corner sub-pixel refinement, pose estimation (solvePnP), grid boards, ChArUco.

Install

pip install rapidtag

Prebuilt wheels are published for:

OS Architectures libc
Linux x86_64, aarch64 (arm64) glibc (manylinux) + musl (Alpine)
macOS x86_64 (Intel), arm64 (Apple Silicon)
Windows x64

Wheels are abi3 (one wheel works on CPython 3.9+). x86 wheels target the portable x86-64-v2 baseline (any CPU since ~2009); arm64 wheels use the standard ARMv8 NEON baseline. If no wheel matches, pip builds from the source distribution (needs a Rust toolchain).

Build from source

# dev install into the current virtualenv
maturin develop --release        # always use --release for performance

# or build a wheel
maturin build --release

Note: .cargo/config.toml sets target-cpu=native for AVX2/SIMD. This makes the wheel non-portable to older CPUs; for distribution use target-cpu=x86-64-v3 instead.

Usage

import cv2            # only to load/generate images
import rapidtag

img = cv2.imread("scene.png")          # HxWx3 BGR, or HxW grayscale uint8

# --- realtime: one frame ---
corners, ids = rapidtag.detect_markers(img, "DICT_APRILTAG_36h11")
# corners: list of 4x2 [(x, y), ...] per marker (clockwise)
# ids:     list of marker ids, aligned with corners

# --- multi-camera / batch: process many frames across all cores ---
results = rapidtag.detect_markers_batch([cam0, cam1], "DICT_APRILTAG_36h11")
(c0, i0), (c1, i1) = results

# --- tunable parameters (same names/defaults as cv2.aruco.DetectorParameters) ---
p = rapidtag.DetectorParameters()
p.adaptive_thresh_constant = 7.0
p.detect_inverted_marker = True
corners, ids = rapidtag.detect_markers(img, "DICT_6X6_250", p)

print(rapidtag.predefined_dictionaries())   # list supported dictionary names

Regenerating dictionary tables

The byte tables in src/dictionaries_data.rs are generated from OpenCV's headers:

python3 gen_dicts.py

Tests

python tests/crosscheck.py     # cross-validate vs cv2.aruco on synthetic scenes
python tests/bench.py          # benchmark + parity on real camera data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rapidtag-0.1.0.tar.gz (250.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rapidtag-0.1.0-cp39-abi3-win_amd64.whl (436.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

rapidtag-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl (779.3 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

rapidtag-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl (744.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

rapidtag-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (568.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

rapidtag-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (568.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

rapidtag-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (524.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rapidtag-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (532.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file rapidtag-0.1.0.tar.gz.

File metadata

  • Download URL: rapidtag-0.1.0.tar.gz
  • Upload date:
  • Size: 250.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidtag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 995a2cacaa167b4839604c003d994a1ef41ba28b74b954ed588aa0ed60c2a13f
MD5 6eadaff22c5c22fb4a1fef37119805ad
BLAKE2b-256 211825b16dc4bb0f810cdac408759a11036e17d0c6eb4d42954c1d922f25146d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0.tar.gz:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidtag-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rapidtag-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 436.8 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rapidtag-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8bb120ec69f92cf376d6122fe7488322a770af66356ff794922494dcb4558344
MD5 571eb98ef82c7b2a96354468fd1367fc
BLAKE2b-256 f87045ec8e753bdf18587ed3d5626b35984fe6a735f89b1860493320d3ee31cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidtag-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c4ed63505db94201ab8333e554daca4034ad4c942ad38696097879a3369c12bc
MD5 d2ee126baf6041732704e1019c346395
BLAKE2b-256 b3db5f1579d9ad9b355bc5825987a4a92fb5e67ed3ad73bcdc5bcce052c22358

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidtag-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 11e66d17616a51b2e252f7ed55ece91fb599da8c06504972a439a5a35d5532ae
MD5 74ecc4734e5049cc70a38b3b3ecd3ec0
BLAKE2b-256 55ce65023b02990b9a52c1d606bc8c52b941b2f165111d76c0f1a0576563c503

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidtag-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6f876b15ca5f5d9da9662bdde027c682fe465edca5fc4f7d68d21f4f327cfe54
MD5 48845d4f3abc66c6c6522fb60543ffdd
BLAKE2b-256 431d7214fbe41232e2d8388c36995f9da284246594e504772d059797050918d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidtag-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 108678f57b16ce94473226c6d4620c80354c9ff8e70eedfedbe6e005afaede4c
MD5 0bb013d8bf183d33bb7985e59294be77
BLAKE2b-256 b673f3afff794a8fa90f3652ef29c9873fc9f06e5d0e92d84b143a19d55fa194

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidtag-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ad35b2a9234e5ec8b53b98ec2c42152723d0474cbc485fbb1bbff097133a203
MD5 f64eded472c2d1ae2981242f52f505e2
BLAKE2b-256 fc9735aee884a777ef8a8fe2355388bcd23a491c6e0872aa3166724d1563d5a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapidtag-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e484bf1aa7cef5087fdbad8a6972a4a751edafbda76f9fbd3e89799dfdf13cbb
MD5 6f9dfa13ab8701a65267663ed79774b3
BLAKE2b-256 aec2080b824fc03435ba7af8fc01e79865770eccf32925890c6f1f5898f23164

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on SujithChristopher/rapidtag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page