Remove spaces, ".", and "-" from ALPR

This commit is contained in:
2026-04-28 17:49:37 +10:00
parent 234f2c68a2
commit cd5d6f1923
4 changed files with 251 additions and 12 deletions

View File

@@ -191,6 +191,23 @@ namespace ANSCENTER
// characters are collapsed and leading/trailing spaces trimmed.
[[nodiscard]] static std::string StripPlateArtifacts(const std::string& text);
// Final-pass post-processing: strip the visual separators that some
// countries put between plate sections — spaces, periods, hyphens —
// so the emitted plate string is a contiguous alphanumeric token.
// Examples:
// "84-F1 273.36" → "84F127336"
// "54-0L 7564" → "540L7564"
// "59-N2 363.25" → "59N236325"
// "東京 500あ12-34" → "東京500あ1234"
// Handles ASCII space/period/hyphen-minus plus the common Unicode
// variants (NBSP, ideographic space, em/en dashes, full-width
// period and hyphen, JP prolonged-sound mark) so JP-OCR output
// is normalised the same way as Latin output.
// Applied BEFORE the ALPRChecker voter so voting + locking both
// operate on the canonical stripped form, and the skip-when-locked
// path inherits stripped output without a second strip site.
[[nodiscard]] static std::string StripPlateSeparators(const std::string& text);
// Run recognizer-only on a tight crop of the left portion of the
// bottom half, trying three vertical offsets to absorb row-split
// inaccuracies. Returns the first non-empty result that contains