Expand description
Fast, symbology-agnostic frame-level code locator.
This is the cheap first half of the two-stage live pipeline (see crate::pipeline
and crate::traits::Detect). Given a camera frame it answers one question as fast
as possible: where are the barcodes, and roughly what kind is each? — a bounding
quad plus a coarse family guess per code. It never decodes; the heavier
Analyze pass does that, and only for the regions found
here.
§How it works
locate makes a single reduced-resolution pass:
- Downscale + binarize (
grid): box-average the frame down byLocateOptions::downscaleand Otsu-threshold the result once. Everything after this works on the small image, which is what makes the locator fast enough to run on every frame. - Concentric finders (
finder): a run-length row scan with a vertical cross-check flags QR/Aztec1:1:3:1:1fiducials. These give a high-confidence matrix classification and a module-size estimate. - Texture tiles (
tiles): tiles dense with dark/light edges are clustered into regions; the horizontal-vs-vertical edge balance separates 1D barcode regions from 2D matrix regions, catching every finder-less symbology. - Merge + map back: finder hits upgrade the region they fall in to a matrix
guess with a real module size; region boxes are scaled back to full resolution and
returned as
Candidates, ordered strongest-first and capped atLocateOptions::max_candidates.
The locator favours recall and speed over precision: it would rather hand
Analyze a few extra boxes than miss a code. It is fully deterministic; the only
randomness available (via a seeded Prng) is unused by the
default path and reserved for future sampling heuristics.
§Family guess
Candidate::symbology carries a representative symbology for the guessed family,
not a decode claim: a finder-backed matrix reports Symbology::QrCode, a
finder-less matrix Symbology::DataMatrix, and a linear region Symbology::Code128.
Recover just the family with Symbology::dimension.
Structs§
- Families
- Which layout families the locator should report.
- Frame
Detector - A ready-to-use
Detectwrappinglocatewith fixed options, reusing prior-frameHintsto short-circuit re-analysis: any candidate whose fingerprint matches a known symbol from a previous frame is returned with that symbol attached. - Locate
Options - Tuning knobs for
locate.Defaultgives sensible live-camera values.
Functions§
- locate
- Locate candidate code regions in
framewithout decoding them.