Add ANSALPR country format
This commit is contained in:
@@ -109,6 +109,41 @@ namespace ANSCENTER
|
||||
// --- Original model zip path (reused for ANSONNXOCR initialization) ---
|
||||
std::string _modelZipFilePath;
|
||||
|
||||
// ────────────────────────────────────────────────────────────────
|
||||
// Country-specific plate-format processing — Vietnam-only.
|
||||
//
|
||||
// When `_country == VIETNAM`, `AnalyseLicensePlateText` strips
|
||||
// any remaining non-alphanumeric characters, uppercases the
|
||||
// result, and validates it against `_plateFormats` (the same
|
||||
// 11-pattern list ANSALPR_OD installs for Vietnam). Plates
|
||||
// that don't match any configured format are dropped — the
|
||||
// return value is "" and the caller skips the plate.
|
||||
//
|
||||
// Every other country (Japan, China, Indonesia, Australia, USA,
|
||||
// …) returns the input unchanged so the upstream
|
||||
// StripPlateSeparators output flows through verbatim, preserving
|
||||
// kana / kanji / region-specific punctuation.
|
||||
//
|
||||
// Hooked in after StripPlateSeparators and before the ALPRChecker
|
||||
// voter, so locked text + skip-when-locked output are emitted in
|
||||
// the canonical Vietnam form just like ANSALPR_OD's path.
|
||||
// ────────────────────────────────────────────────────────────────
|
||||
[[nodiscard]] std::string AnalyseLicensePlateText(const std::string& ocrText);
|
||||
|
||||
// Format match helper — patterns: 'd' = any digit, 'l' = any
|
||||
// letter, every other character is a literal that must match
|
||||
// exactly. Returns true when `_plateFormats` is empty (i.e.
|
||||
// no formats configured → no validation, accept all).
|
||||
[[nodiscard]] bool MatchesPlateFormat(const std::string& plate) const;
|
||||
|
||||
// Reset `_plateFormats` to the default list for the current
|
||||
// `_country`. Called at the end of Initialize (after country.txt
|
||||
// is read) and from SetCountry so a runtime country switch picks
|
||||
// up the right format set on the very next frame. Currently
|
||||
// populates Vietnam's 11 standard patterns; other countries leave
|
||||
// the list empty (= no validation).
|
||||
void ApplyCountryDefaultPlateFormats();
|
||||
|
||||
// --- Colour detection helpers ---
|
||||
[[nodiscard]] std::string DetectLPColourDetector(const cv::Mat& lprROI, const std::string& cameraId);
|
||||
[[nodiscard]] std::string DetectLPColourCached(const cv::Mat& lprROI, const std::string& cameraId, const std::string& plateText);
|
||||
|
||||
Reference in New Issue
Block a user