Skip to main content

Python bindings for ringgrid detector

Project description

ringgrid (Python)

Python bindings for the ringgrid detector (PyO3 + maturin).

Install

From PyPI:

pip install ringgrid

With plotting helpers:

pip install "ringgrid[viz]"

From source (repository checkout):

pip install maturin
maturin develop -m crates/ringgrid-py/Cargo.toml --release

Fast Start: Generate board_spec.json + Printable SVG/PNG

Target-generation scripts live in the repository root (tools/). If you only installed from PyPI, clone the repository first to access these scripts.

python3 -m venv .venv
./.venv/bin/python -m pip install -U pip
./.venv/bin/python -m pip install numpy

./.venv/bin/python tools/gen_synth.py \
  --out_dir tools/out/target_faststart \
  --n_images 0 \
  --board_mm 200 \
  --pitch_mm 8 \
  --print \
  --print_dpi 600 \
  --print_margin_mm 5 \
  --print_basename target_print

Key knobs:

Flag What it controls Typical value
--board_mm Physical board side length (mm) 200
--pitch_mm Marker spacing (mm) 8
--n_images Number of synthetic images (0 for print-only) 0
--print_dpi PNG raster resolution 300 or 600
--print_margin_mm Extra white border 3-10
--print_basename Output file basename target_print

Outputs:

  • tools/out/target_faststart/board_spec.json
  • tools/out/target_faststart/target_print.svg
  • tools/out/target_faststart/target_print.png

Load this board in Python:

from pathlib import Path
import ringgrid

board = ringgrid.BoardLayout.from_json_file(Path("tools/out/target_faststart/board_spec.json"))
cfg = ringgrid.DetectConfig(board)
detector = ringgrid.Detector(board, cfg)

Complete target-generation tutorial and full flag reference:

Features

  • Native Detector API with NumPy input support
  • Full DetectionResult model objects with JSON round-trips
  • Optional plotting helpers in ringgrid.viz (pip install ringgrid[viz])

Input Rules

  • Detector.detect(...) accepts:
    • np.ndarray with dtype=uint8 and shape (H, W) (grayscale)
    • np.ndarray with dtype=uint8 and shape (H, W, 3|4) (RGB/RGBA, auto-converted to grayscale)
    • image file path (str or pathlib.Path)
  • Other dtypes/shapes raise TypeError.

Adaptive Detection

Use adaptive detection when marker diameter varies substantially across the image (near/far perspective, zoom changes, mixed target scales).

Which Method Should I Use?

Situation Recommended call Why
You do not know marker size in advance detector.detect_adaptive(image) Probes scale and auto-selects tiers
You know approximate marker diameter (px) detector.detect_adaptive(image, nominal_diameter_px=d) Skips probe and uses focused two-tier bracket around d
You need fixed/reproducible tier policy detector.detect_multiscale(image, tiers) Full explicit control over tiers
Marker size range is tight and runtime is priority detector.detect(image) Single-pass (fastest)

Canonical adaptive entry point is:

  • Detector.detect_adaptive(image, nominal_diameter_px: float | None = None)

Compatibility alias (deprecated, still supported):

  • Detector.detect_adaptive_with_hint(image, nominal_diameter_px=...)

Tier objects:

  • ScaleTier(diameter_min_px, diameter_max_px)
  • ScaleTiers([...])
  • Presets: ScaleTiers.four_tier_wide(), ScaleTiers.two_tier_standard()
  • Single-pass equivalent: ScaleTiers.single(MarkerScalePrior(...))

Practical Recipes

Unknown scene scale:

from pathlib import Path
import ringgrid

board = ringgrid.BoardLayout.default()
detector = ringgrid.Detector(board, ringgrid.DetectConfig(board))
image = Path("testdata/target_3_split_00.png")

result = detector.detect_adaptive(image)

Known nominal diameter (for example, ~32 px):

result = detector.detect_adaptive(image, nominal_diameter_px=32.0)

Inspect tiers used by adaptive logic (debug/repro):

tiers = detector.adaptive_tiers(image, nominal_diameter_px=32.0)
for tier in tiers.tiers:
    print(tier.diameter_min_px, tier.diameter_max_px)

# Re-run exactly those tiers
result = detector.detect_multiscale(image, tiers)

Examples

Run from repository root:

python crates/ringgrid-py/examples/basic_detect.py \
  --image testdata/target_3_split_00.png \
  --out testdata/target_3_split_00_det_py.json

python crates/ringgrid-py/examples/detect_with_camera.py \
  --image testdata/target_3_split_00.png \
  --out testdata/target_3_split_00_det_cam_py.json

python crates/ringgrid-py/examples/detect_adaptive.py \
  --image testdata/target_3_split_00.png \
  --out testdata/target_3_split_00_det_adaptive_py.json

python crates/ringgrid-py/examples/detect_multiscale.py \
  --image testdata/target_3_split_00.png \
  --tiers four_tier_wide \
  --out testdata/target_3_split_00_det_multiscale_py.json

Plotting example:

python crates/ringgrid-py/examples/plot_detection.py \
  --image testdata/target_3_split_00.png \
  --out testdata/target_3_split_00_overlay_py.png

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

ringgrid-0.4.0-cp314-cp314-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.14Windows x86-64

ringgrid-0.4.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

ringgrid-0.4.0-cp314-cp314-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

ringgrid-0.4.0-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

ringgrid-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

ringgrid-0.4.0-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ringgrid-0.4.0-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

ringgrid-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ringgrid-0.4.0-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ringgrid-0.4.0-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

ringgrid-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ringgrid-0.4.0-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ringgrid-0.4.0-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

ringgrid-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ringgrid-0.4.0-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file ringgrid-0.4.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: ringgrid-0.4.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ringgrid-0.4.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 18bbdef5a3f876f1a8110e00622c2ac02b341d8d31d515bedc12cf988db58cdc
MD5 25048664f06ffb289c4e68948a578e4b
BLAKE2b-256 9e7c94a7e7da1fcace8d0ff46508b1db116dd786cba8d9f91d359fc0b5eaf6b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp314-cp314-win_amd64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12fafe7a867293f672e41bc4ac069941a404bc6647c87a72ca3fb81d89691fd0
MD5 fe2dceb88817b53b27961a2c76fdc945
BLAKE2b-256 b773044095b6ca9acf1c062b447e4a42c45c401f6d614a635536eccd523194ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 547fc820cd3d4c9cba1efe322e706baf993ec683092706536fb3a8530d25aa43
MD5 9078071ee6013c261a32bd2178e0e06e
BLAKE2b-256 dcb6a2c4e7dd99c57ed5daff67e338ff28cfc3664d7ea1278287931c2c04fc91

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: ringgrid-0.4.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ringgrid-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 41d8166a730740910587ebcd19d020ab85aad99bea54e9bdb6db883105a5c9c0
MD5 930060a8cc11e7d609a61a7f35852525
BLAKE2b-256 a723670005e177b4a85a547ef4226a70b3370d2e022e5c4412c81fa0a27c2808

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp313-cp313-win_amd64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a3844375fa6ba4b932ffd2ac66a734fd6c5988624cc983bcbef962dcc97f1799
MD5 19c6c02740449cb33acd477708940e28
BLAKE2b-256 a90d7e7dccc5a1e527a1dc131dec09f3f0e7cbb3c6375c054656461d6ff174f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c569e42c47a424b5105c0c183b3586dac151aea5921d67bc905833407920b1d
MD5 3b872c67441bbac22628dab465d5d9ec
BLAKE2b-256 25f8cc5e84869958e771f8fcd49081ebe679e5fef07efbe9a4be2d86338d0fcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ringgrid-0.4.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ringgrid-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 171eaa4b731e6c10d32ab24ef2d9b536a20dc528041e34a757eb08a0e186346c
MD5 c5533768378486974e8a7892c051913b
BLAKE2b-256 daeb863529bf4e86d463d8e6837cb3ef8609ea22d71a457a46b5f047a8068935

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp312-cp312-win_amd64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09fc5fef58fb65641facbcf6223a347cbefe1414f06d3687fd1cccd088828cb9
MD5 59aaac81ed1ff1c3f3fa596e0478d5e6
BLAKE2b-256 753a91833726ac0979884a070e3884489ca5bb77f4cb2190ca2eb2273edf8375

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 706480382c8ba883ea8d24b33764c9c825ff0df455c97c5ba4ced01bdc405b44
MD5 8fac5d158367cac268b92be22859fb02
BLAKE2b-256 d073888a234831ed0e1a503ec906bde5d2d53ac49b2654d24a78884232af50d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ringgrid-0.4.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ringgrid-0.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0cb7ee22259252184dcdcd4e1098f311006bedbdebaf7bd4e55886bad8a8adf9
MD5 07be2b251698bc7fa3c46bf4c5be7d62
BLAKE2b-256 ba78ad2606a537ff47c4686c25313795e591b9311c268060411be337f7093c0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp311-cp311-win_amd64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da3fcfa7052c14d7a3c83f495c95d0a875d85be2a268df811d903322f951fc59
MD5 77b2147ff78245166c911ec30d960d3a
BLAKE2b-256 54c5463e8560fb73b9c1a0e7eb49ede20933eec6b3526c0caa4d23c287a74494

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 831cbf47afacbae2f1880a85c0396b8ae674464fa225ed0beadfee71ebf89cf9
MD5 35f903f5e7c09e0bfff511ab22c73ad2
BLAKE2b-256 511488096aab7b5a4f763885bf589dfa4b3a9edd7b4f7408c88507320838f101

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ringgrid-0.4.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ringgrid-0.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5ff1c9830eed811b1de6e0f2bd420983ee690aa5276a4d04a8fea855a5bf37a2
MD5 1ff4f26e651ce1c91d36cb6721fc2a3d
BLAKE2b-256 a69782730511f6c6196730511532165a477b104d4fa481f908d9797c39bad804

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp310-cp310-win_amd64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ca3d8c8f014a0df0d780a7547ec0074d8009a103f5ce6251a63cde657b638261
MD5 bed412e648ff19ec6cdbdbed146b90fb
BLAKE2b-256 a8b560707314d41069c513067fa378b40ad4def6d7f7d55d0a3c8751fee8261b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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

File details

Details for the file ringgrid-0.4.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ringgrid-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dbd5cac646c8ceb70253014a7b1708c1c2fb1199e63c9f327cc693ac496c14d6
MD5 5fbab4d19459f0217b8678cca751d81b
BLAKE2b-256 74b53f07d1ef85183950b49cbc144f36fa6dc5ebaea637c8a7d402a2520c292d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ringgrid-0.4.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/ringgrid

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