Skip to main content

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

Project description

RapidTag

⚠️ Work in progress — not production-ready. RapidTag is under active development and pre-1.0. APIs, behavior, and results may change without notice. Use it for research, evaluation, and prototyping, and validate it against your own data before relying on it for anything critical.

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 / PyO3 — with no OpenCV runtime dependency. It reproduces OpenCV's detections down to the pixel while running substantially faster.

Why RapidTag

  • Faster than OpenCV~1.6× faster for realtime single-camera detection, and up to ~3.4× faster for multi-camera and offline batches (scales across cores).
  • 🎯 A true drop-in for accuracy — corners match OpenCV to 0.0000 px, so any downstream pose or tracking is identical (see below).
  • 🧵 Scales with your cores — a batch API processes many frames (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 implemented in pure Rust on top of image / nalgebra.

Performance

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

Workload Speed vs OpenCV
Realtime, single camera 1.57× faster
Multi-camera / offline batch (all cores) up to ~3.4× faster

Same detections, less time — the speedup comes from a leaner detection pipeline, not from skipping work.

Heterogeneous (big.LITTLE) ARM CPUs

On big.LITTLE SoCs, RapidTag pins its worker pool to the fast cores automatically. Every detect call waits on its slowest parallel task, so letting the OS place even one task on a little core caps the whole batch at little-core speed — on a Radxa Dragon Q6A (QCS6490: 4× A55 @1.9 GHz + 4× A78 @2.4–2.7 GHz) auto-pinning takes a single 1280×800 detect from 68 fps to 211 fps, and a dual-camera pair from 66 to 134 pairs/s. The calling thread and any capture/IO threads are left unpinned, keeping the little cores for them. Homogeneous CPUs and non-Linux hosts are unaffected.

Override with RAPIDTAG_CORES: an explicit core list (4-7, 0,2,4) or all to disable pinning. RAYON_NUM_THREADS still controls pool size when set.

Two further board-level settings are worth it on embedded targets:

  • build for the exact CPU with scripts/build-board.sh (-C target-cpu=native)
  • switch the fast cores' cpufreq governor to performance — bursty per-frame work never keeps schedutil clocked up (on the Q6A this is another ~1.7×: 123 → 211 fps single, 102 → 134 pairs/s dual)

Accuracy — verified as a drop-in replacement

Because RapidTag's corners are pixel-identical to OpenCV's, feeding them into the exact same pose pipeline (cv2.solvePnP) yields the same trajectory. Across a ~1,700-frame stereo recording of a moving AprilTag, the recovered position from RapidTag vs OpenCV corners is indistinguishable — a median difference of 0.00 mm on both cameras.

OpenCV vs RapidTag pose comparison

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+). If no wheel matches, pip builds from the source distribution (needs a Rust toolchain).

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

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}.

Status

v1 — marker detection (detectMarkers, CORNER_REFINE_NONE).

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

Build from source

maturin develop --release        # dev install into the current virtualenv
maturin build --release          # or build a wheel

The committed build uses portable CPU baselines so one wheel works everywhere. For a max-performance build tuned to your own machine (not portable — don't redistribute it):

RUSTFLAGS="-C target-cpu=native" maturin build --release

For a wheel tuned to a specific ARM64 board, use ./scripts/build-board.sh (it picks the right CPU flags so the published portable wheels stay CPU-agnostic).

Tests

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

The verification figures above are reproduced by the scripts in scripts/ (pnp_opencv_vs_rapidtag.py, pnp_sanity.py).

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.4.tar.gz (946.1 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.4-cp39-abi3-win_amd64.whl (458.6 kB view details)

Uploaded CPython 3.9+Windows x86-64

rapidtag-0.1.4-cp39-abi3-musllinux_1_2_x86_64.whl (796.5 kB view details)

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

rapidtag-0.1.4-cp39-abi3-musllinux_1_2_aarch64.whl (760.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

rapidtag-0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (584.9 kB view details)

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

rapidtag-0.1.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (582.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

rapidtag-0.1.4-cp39-abi3-macosx_11_0_arm64.whl (539.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rapidtag-0.1.4-cp39-abi3-macosx_10_12_x86_64.whl (551.0 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rapidtag-0.1.4.tar.gz
  • Upload date:
  • Size: 946.1 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.4.tar.gz
Algorithm Hash digest
SHA256 4bcbcea10f6f9859678fdd7201291d961692e908673aef0644b3a00bf18a8246
MD5 5ddb99c0f6776194b668b695b3ddd400
BLAKE2b-256 a6664152b1f0b388bcb57c069d61691f8d48ad65c3f776bacec0b40c905afefa

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4.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.4-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rapidtag-0.1.4-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 458.6 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.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e8fe3ab1c1fcfb8c5781f325663e0d272b01216764ad99006b4063fb5299195e
MD5 54e47beb863c2e00ccb239aca9392048
BLAKE2b-256 692364461dfa80671bcd7b0a09242d3470f2e00ba9841200cb14d9c626153be0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4-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.4-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.4-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 34852de3167d9e26446e532a2685665ddc493f3d7fdc7c7231f6ce3dff352b05
MD5 f4c59cd5f74a606d8d1cecf4ca94f729
BLAKE2b-256 e2ec07c46641f1e76afcdefcbafca3304d9ffa9a5014395e08d6d9ceddc13c1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4-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.4-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.4-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 46888fd20f62da6f5cb84b85f9b1e3a3d99523d57c06a63e613ffe6d56046174
MD5 449aa997801707a8a2597760b0ed4cf5
BLAKE2b-256 d50bc8af90e20e285be64325de5cb4627bb339ef664c8a13e877e98df9ea38a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4-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.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f522e9dd1850b009a73d7750eead933bd5b137c0e650186f6095d67eeb261c19
MD5 7ccaec56aa64fbd1e09dce2f77347aee
BLAKE2b-256 9c9b1d157c0d59b6c781aa4f6cfc93a4aef20d084b86acc5f04868cb083af4ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4-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.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b8a1be6dfad1cf870003916e5283b2ec723e577fdfacf12e91bb4626cbe3e3b
MD5 7f1a6e5acf8bbb316c7fa2c7aaa6d275
BLAKE2b-256 46ae8d5e14fb854dca4fc0bbc25aee7b0cab4be9896f5a6a7cc90d97ee3ea39a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4-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.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73c353fd80e9de27051cf1858e68e45332467fa868147b06aefe24e51aa7c35e
MD5 bccf95ecc792812ec63f2143d3225fd0
BLAKE2b-256 eb0e264f2848f38f62880e0a9462d0cca721fc8031b761527f7e101a7964bcb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4-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.4-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rapidtag-0.1.4-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a33c1fd61b2bdcb8bbc993920b007e68e886473efd7a6cd55bcacd76c16f5a5b
MD5 4739df3454c5066bde2a2bc399412621
BLAKE2b-256 f50528dfa8c359d93ef81f2bf5ccc654e314bc503310bd85696cf05a668c7caa

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapidtag-0.1.4-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