Skip to main content

Module anpr

Module anpr 

Source
Expand description

ANPR entry engine (Stage 4): consolidates per-frame plate reads from the AI worker into one authoritative entry/exit event per vehicle track via temporal voting, resolves the plate against the registered-vehicle / visitor-pass / watchlist registry, classifies authorization (matched / exception / unmatched / blocked), and writes a canonical entry event with an evidence frame.

Like the zone engine, all timing is driven by SERVER time and state is keyed per (camera, track) in memory. A track commits once its WINNING plate (plausible-preferred, majority vote) has accumulated min_votes reads, or on TTL prune if a vehicle passed too quickly to reach the threshold but did produce at least one plate read. Plate is the PRIMARY identity anchor; vehicle attributes (type/color/make/model) are SECONDARY — an attribute mismatch against a registered plate raises an exception for guard review, never an automatic rejection (by policy: no hard access decision on make/model without local benchmarking).

Structs§

AnprEngine

Functions§

is_plausible_plate
Loose plausibility gate for a normalized plate (Malaysian plates mix letters and digits, 3–10 chars). Used to flag likely-unreadable OCR rather than to hard-reject — guards review the rest.
normalize_plate
Normalize a plate string to its lookup key: ASCII alphanumerics only, uppercased.