CircleCode encodes arbitrary data into concentric circular arcs with dual visual styles: classic discrete pills (Circle) or continuous sweeping arcs (LonCle). Decode across full 360° orientations with subpixel computer vision directly in web browsers and mobile apps.
CircleCode combines circular geometry with subpixel computer vision:
Data bits are distributed across concentric rings (4 to 14 rings). Each ring has a calculated radius, slot count, and fixed angular dash spacing ($0.35$ density).
A reference dark finder spoke at $0^\circ$ and a dark center badge ($R=42$) anchor the barcode in 2D space, allowing 360° omnidirectional detection.
When photographed from an angle, circles distort into ellipses. The decoder computes spatial moments to normalize perspective tilt before reading bits.
Every payload includes a 16-bit header, length byte, and Modulo-256 checksum with aggressive 1–3 bit recovery for low-contrast or partially shadowed codes.
Mathematical formulations governing concentric ring distributions, slot allocation, 360° rotational alignment, subpixel spatial moments, and elliptical inverse coordinate transforms.
A CircleCode barcode is normalized to an outer boundary disc of radius $R_{\text{disc}} = 190$ with a center branding badge of radius $r_{\text{badge}} = 42$. For $k$ rings ($k \in [4, 14]$), each ring $i \in [0, k-1]$ is mapped uniformly between $r_{\text{start}} = 55$ and $r_{\text{end}} = 157$:
To maintain equal physical bit density across expanding ring perimeters, the angular slot count $n_i$ grows proportionally to radius $r_i$ with constant density factor $d = 0.35$:
Each slot subtends angle $\Delta\theta_i$. The physical dash stroke spans an angular active zone:
Slot $0$ across every ring is reserved as a continuous radial finder spoke. The decoder sweeps the entire $360^\circ$ circle in $1.8^\circ$ angular increments ($M = 200$ samples) to find rotation angle $\theta_0$ that minimizes aggregate luminance:
The dark center badge ($R = 42$) is localized via annular contrast differential operator, followed by subpixel first-order spatial moments:
Oblique camera angles compress circular geometries into ellipses along tilt angle $\phi$. The decoder normalizes perspective via 2D rotation and aspect ratio correction:
The bitstream begins with a 16-bit big-endian length header $L$, followed by $8L$ data bits (UTF-8) and an 8-bit modulo-256 checksum:
If $\Delta = (\text{chk}_{\text{expected}} - \text{chk}_{\text{actual}}) \pmod{256} = \pm 2^p$ matches a single bit discrepancy, CircleCode repairs the bit flip deterministically in $O(L)$ time.
Choose the right engine for your application's requirements:
| Feature | Pure JavaScript (@axphia/circlecode) |
Native Rust WASM (circlecode/wasm) |
|---|---|---|
| Best Use Case | Web Image Uploads & Forms | Real-Time Mobile Camera Scanning |
| Decoding Latency | Device-dependent | Device-dependent; benchmark locally |
| External Dependencies | Zero (runs everywhere out-of-the-box) | Requires circlecode_core_bg.wasm binary |
| CPU & Battery Impact | Depends on device and workload | Requires device measurements |
| Ideal Environment | Drag & drop file upload, Node.js, static files | Live smartphone camera feed, kiosks, PWAs |
Install via npm or include the standalone browser bundle directly:
Create circular barcodes in LonCle or Circle mode and render to SVG or HTML5 Canvas:
Zero-dependency client-side decoding from user file uploads or canvas elements:
Rust WASM decoder; measure latency and resource use on the target device:
Include directly via script tag in vanilla HTML:
Experience CircleCode live in action. Select a tool to teleport directly into the web-use-demo/ environment:
Built with compiled Rust WebAssembly, audio chimes, haptics, flashlight torch, and reticle tracking. Decode latency depends on the device and image.
100% vanilla JavaScript decoding. Optimized for drag-and-drop file inputs, photo uploads, and environments where loading a .wasm file is not required.
Generate circular barcodes in dual modes: Circle (classic discrete) and LonCle (connected sweeping arcs) with customizable center badges. Export crisp vector SVG and PNG.
Live side-by-side benchmark, instant color theme switches, test presets, and standalone CDN script snippet integration examples.