From 28aed1b7d978d4143c0e942fe1b829f846d98f28 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 10 Aug 2015 23:02:33 -0400 Subject: [PATCH] Added country config arguments for postprocess_regex_letters and postprocess_regex_numbers --- runtime_data/config/au.conf | 4 ++++ runtime_data/config/auwide.conf | 4 ++++ runtime_data/config/eu.conf | 4 ++++ runtime_data/config/kr.conf | 4 ++++ runtime_data/config/us.conf | 4 ++++ src/openalpr/config.cpp | 5 ++++- src/openalpr/config.h | 3 +++ 7 files changed, 27 insertions(+), 1 deletion(-) diff --git a/runtime_data/config/au.conf b/runtime_data/config/au.conf index 19d2bd4..d3fd4a9 100644 --- a/runtime_data/config/au.conf +++ b/runtime_data/config/au.conf @@ -30,3 +30,7 @@ min_plate_size_width_px = 85 min_plate_size_height_px = 28 ocr_language = lau + +; Override for postprocess letters/numbers regex. +postprocess_regex_letters = [A-Z] +postprocess_regex_numbers = [0-9] \ No newline at end of file diff --git a/runtime_data/config/auwide.conf b/runtime_data/config/auwide.conf index 9fdbe79..490e7b3 100644 --- a/runtime_data/config/auwide.conf +++ b/runtime_data/config/auwide.conf @@ -31,3 +31,7 @@ min_plate_size_width_px = 100 min_plate_size_height_px = 20 ocr_language = lau + +; Override for postprocess letters/numbers regex. +postprocess_regex_letters = [A-Z] +postprocess_regex_numbers = [0-9] \ No newline at end of file diff --git a/runtime_data/config/eu.conf b/runtime_data/config/eu.conf index 8d00aa5..b3d3f69 100644 --- a/runtime_data/config/eu.conf +++ b/runtime_data/config/eu.conf @@ -32,3 +32,7 @@ min_plate_size_width_px = 65 min_plate_size_height_px = 18 ocr_language = leu + +; Override for postprocess letters/numbers regex. +postprocess_regex_letters = [A-Z] +postprocess_regex_numbers = [0-9] \ No newline at end of file diff --git a/runtime_data/config/kr.conf b/runtime_data/config/kr.conf index 84b2b4d..e0ca45f 100644 --- a/runtime_data/config/kr.conf +++ b/runtime_data/config/kr.conf @@ -31,3 +31,7 @@ min_plate_size_width_px = 100 min_plate_size_height_px = 20 ocr_language = lkr + +; Override for postprocess letters/numbers regex. +postprocess_regex_letters = \pL +postprocess_regex_numbers = \pN diff --git a/runtime_data/config/us.conf b/runtime_data/config/us.conf index d311841..c9f8124 100644 --- a/runtime_data/config/us.conf +++ b/runtime_data/config/us.conf @@ -30,3 +30,7 @@ min_plate_size_width_px = 70 min_plate_size_height_px = 35 ocr_language = lus + +; Override for postprocess letters/numbers regex. +postprocess_regex_letters = [A-Z] +postprocess_regex_numbers = [0-9] \ No newline at end of file diff --git a/src/openalpr/config.cpp b/src/openalpr/config.cpp index 35c24fa..1e8c99d 100644 --- a/src/openalpr/config.cpp +++ b/src/openalpr/config.cpp @@ -243,7 +243,10 @@ namespace alpr plateLinesSensitivityHorizontal = getFloat(ini, "", "plateline_sensitivity_horizontal", 0); ocrLanguage = getString(ini, "", "ocr_language", "none"); - + + postProcessRegexLetters = getString(ini, "", "postprocess_regex_letters", "\\pL"); + postProcessRegexNumbers = getString(ini, "", "postprocess_regex_numbers", "\\pN"); + ocrImageWidthPx = round(((float) templateWidthPx) * ocrImagePercent); ocrImageHeightPx = round(((float)templateHeightPx) * ocrImagePercent); stateIdImageWidthPx = round(((float)templateWidthPx) * stateIdImagePercent); diff --git a/src/openalpr/config.h b/src/openalpr/config.h index 1880a4e..3767329 100644 --- a/src/openalpr/config.h +++ b/src/openalpr/config.h @@ -100,6 +100,9 @@ namespace alpr unsigned int postProcessMinCharacters; unsigned int postProcessMaxCharacters; + std::string postProcessRegexLetters; + std::string postProcessRegexNumbers; + bool debugGeneral; bool debugTiming; bool debugPrewarp;