mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 10:46:53 +08:00
Added a must_match_pattern config option. When a text pattern is available, all non-matching values will be disregarded.
This commit is contained in:
@@ -42,6 +42,10 @@ max_detection_input_height = 720
|
||||
; morphcpu - Experimental detector that detects white rectangles in an image. Does not require training.
|
||||
detector = lbpcpu
|
||||
|
||||
; If set to true, all results must match a postprocess text pattern if a pattern is available.
|
||||
; If not, the result is disqualified.
|
||||
must_match_pattern = 0
|
||||
|
||||
; Bypasses plate detection. If this is set to 1, the library assumes that each region provided is a likely plate area.
|
||||
skip_detection = 0
|
||||
|
||||
|
@@ -176,6 +176,8 @@ namespace alpr
|
||||
maxDetectionInputWidth = getInt(ini, "", "max_detection_input_width", 1280);
|
||||
maxDetectionInputHeight = getInt(ini, "", "max_detection_input_height", 768);
|
||||
|
||||
mustMatchPattern = getBoolean(ini, "", "must_match_pattern", false);
|
||||
|
||||
skipDetection = getBoolean(ini, "", "skip_detection", false);
|
||||
|
||||
prewarp = getString(ini, "", "prewarp", "");
|
||||
|
@@ -104,6 +104,8 @@ namespace alpr
|
||||
std::string ocrLanguage;
|
||||
int ocrMinFontSize;
|
||||
|
||||
bool mustMatchPattern;
|
||||
|
||||
float postProcessMinConfidence;
|
||||
float postProcessConfidenceSkipLevel;
|
||||
unsigned int postProcessMinCharacters;
|
||||
|
@@ -381,9 +381,17 @@ namespace alpr
|
||||
if (allPossibilitiesLetters.end() != allPossibilitiesLetters.find(possibility.letters))
|
||||
return false;
|
||||
|
||||
allPossibilities.push_back(possibility);
|
||||
allPossibilitiesLetters.insert(possibility.letters);
|
||||
return true;
|
||||
// If mustMatchPattern is toggled in the config and a template is provided,
|
||||
// only include this result if there is a pattern match
|
||||
if (!config->mustMatchPattern || templateregion.size() == 0 ||
|
||||
(config->mustMatchPattern && possibility.matchesTemplate))
|
||||
{
|
||||
allPossibilities.push_back(possibility);
|
||||
allPossibilitiesLetters.insert(possibility.letters);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<string> PostProcess::getPatterns() {
|
||||
|
Reference in New Issue
Block a user