Language Bindings
ringgrid is one detection engine with several surfaces. The Rust crate is the reference; the bindings wrap it with the same detection results and the same JSON-at-the-boundary convention (targets, configs, and results cross as JSON; pixels as raw buffers), so switching languages does not change behavior.
| Language | Install | Import |
|---|---|---|
| Rust | cargo add ringgrid | use ringgrid::Detector; |
| Python | pip install ringgrid | import ringgrid |
| C / C++ | vcpkg install ringgrid (or CMake from source) | #include "ringgrid.h" / "ringgrid.hpp" |
| JavaScript / WASM | npm install @vitavision/ringgrid | import init, { RinggridDetector } from "@vitavision/ringgrid"; |
There is also a command-line tool — see the CLI Guide — and an in-browser interactive demo.
Python
pip install ringgrid # detector + typed TargetLayout API
pip install "ringgrid[viz]" # + optional matplotlib/Pillow visualization helpers
import ringgrid
detector = ringgrid.Detector.from_target(ringgrid.TargetLayout.default_hex())
result = detector.detect("photo.png") # a path or a 2-D uint8 numpy array
for m in result.detected_markers:
print(m.id, m.center)
The Python package ships type stubs (py.typed) and a typed TargetLayout API
that can also render printable SVG/PNG/DXF targets — write_svg / write_png /
write_dxf to files, or render_artifacts() for all four in memory. See the
ringgrid-py README for the full
DetectConfig field guide.
C / C++
A stable C ABI plus a header-only C++ RAII wrapper, distributed through vcpkg and
CMake find_package. See C & C++ for the full guide.
JavaScript / WebAssembly
npm install @vitavision/ringgrid
import init, { RinggridDetector, default_board_json } from "@vitavision/ringgrid";
await init();
const detector = new RinggridDetector(default_board_json());
const json = detector.detect_rgba(imageData.data, imageData.width, imageData.height);
const result = JSON.parse(json);
The WASM package powers the interactive demo; it accepts grayscale
or RGBA (canvas ImageData) buffers and returns the same DetectionResult JSON.
It also builds and renders targets, so a browser application needs no generator of its own:
import init, { coded_hex_target_json, render_target_bundle_json } from "@vitavision/ringgrid";
await init();
const targetJson = coded_hex_target_json(8.0, 15, 14, 4.8, 3.2, 1.152);
const bundle = render_target_bundle_json(targetJson, JSON.stringify({
page: { size: { kind: "a4" }, orientation: "portrait", margin_mm: 10 },
}));
// bundle.json_text / svg_text / png_bytes (Uint8Array) / dxf_text
See the ringgrid-wasm README
for the full function list and the page/scale-bar options.