mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 18:36:51 +08:00
Added always/never/auto invert config property to country config
This commit is contained in:
@@ -33,4 +33,9 @@ ocr_language = lau
|
|||||||
|
|
||||||
; Override for postprocess letters/numbers regex.
|
; Override for postprocess letters/numbers regex.
|
||||||
postprocess_regex_letters = [A-Z]
|
postprocess_regex_letters = [A-Z]
|
||||||
postprocess_regex_numbers = [0-9]
|
postprocess_regex_numbers = [0-9]
|
||||||
|
|
||||||
|
|
||||||
|
; Whether the plate is always dark letters on light background, light letters on dark background, or both
|
||||||
|
; value can be either always, never, or auto
|
||||||
|
invert = auto
|
@@ -34,4 +34,9 @@ ocr_language = lau
|
|||||||
|
|
||||||
; Override for postprocess letters/numbers regex.
|
; Override for postprocess letters/numbers regex.
|
||||||
postprocess_regex_letters = [A-Z]
|
postprocess_regex_letters = [A-Z]
|
||||||
postprocess_regex_numbers = [0-9]
|
postprocess_regex_numbers = [0-9]
|
||||||
|
|
||||||
|
|
||||||
|
; Whether the plate is always dark letters on light background, light letters on dark background, or both
|
||||||
|
; value can be either always, never, or auto
|
||||||
|
invert = auto
|
@@ -35,4 +35,9 @@ ocr_language = leu
|
|||||||
|
|
||||||
; Override for postprocess letters/numbers regex.
|
; Override for postprocess letters/numbers regex.
|
||||||
postprocess_regex_letters = [A-Z]
|
postprocess_regex_letters = [A-Z]
|
||||||
postprocess_regex_numbers = [0-9]
|
postprocess_regex_numbers = [0-9]
|
||||||
|
|
||||||
|
|
||||||
|
; Whether the plate is always dark letters on light background, light letters on dark background, or both
|
||||||
|
; value can be either always, never, or auto
|
||||||
|
invert = auto
|
@@ -35,3 +35,7 @@ ocr_language = lkr
|
|||||||
; Override for postprocess letters/numbers regex.
|
; Override for postprocess letters/numbers regex.
|
||||||
postprocess_regex_letters = \pL
|
postprocess_regex_letters = \pL
|
||||||
postprocess_regex_numbers = \pN
|
postprocess_regex_numbers = \pN
|
||||||
|
|
||||||
|
; Whether the plate is always dark letters on light background, light letters on dark background, or both
|
||||||
|
; value can be either always, never, or auto
|
||||||
|
invert = auto
|
@@ -33,4 +33,8 @@ ocr_language = lus
|
|||||||
|
|
||||||
; Override for postprocess letters/numbers regex.
|
; Override for postprocess letters/numbers regex.
|
||||||
postprocess_regex_letters = [A-Z]
|
postprocess_regex_letters = [A-Z]
|
||||||
postprocess_regex_numbers = [0-9]
|
postprocess_regex_numbers = [0-9]
|
||||||
|
|
||||||
|
; Whether the plate is always dark letters on light background, light letters on dark background, or both
|
||||||
|
; value can be either always, never, or auto
|
||||||
|
invert = auto
|
@@ -219,6 +219,24 @@ namespace alpr
|
|||||||
|
|
||||||
multiline = getBoolean(ini, "", "multiline", false);
|
multiline = getBoolean(ini, "", "multiline", false);
|
||||||
|
|
||||||
|
string invert_val = getString(ini, "", "invert", "auto");
|
||||||
|
|
||||||
|
if (invert_val == "always")
|
||||||
|
{
|
||||||
|
auto_invert = false;
|
||||||
|
always_invert = true;
|
||||||
|
}
|
||||||
|
else if (invert_val == "never")
|
||||||
|
{
|
||||||
|
auto_invert = false;
|
||||||
|
always_invert = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto_invert = true;
|
||||||
|
always_invert = false;
|
||||||
|
}
|
||||||
|
|
||||||
plateWidthMM = getFloat(ini, "", "plate_width_mm", 100);
|
plateWidthMM = getFloat(ini, "", "plate_width_mm", 100);
|
||||||
plateHeightMM = getFloat(ini, "", "plate_height_mm", 100);
|
plateHeightMM = getFloat(ini, "", "plate_height_mm", 100);
|
||||||
|
|
||||||
|
@@ -54,6 +54,9 @@ namespace alpr
|
|||||||
|
|
||||||
bool skipDetection;
|
bool skipDetection;
|
||||||
|
|
||||||
|
bool auto_invert;
|
||||||
|
bool always_invert;
|
||||||
|
|
||||||
std::string prewarp;
|
std::string prewarp;
|
||||||
|
|
||||||
int maxPlateAngleDegrees;
|
int maxPlateAngleDegrees;
|
||||||
|
@@ -51,6 +51,9 @@ namespace alpr
|
|||||||
timespec startTime;
|
timespec startTime;
|
||||||
getTimeMonotonic(&startTime);
|
getTimeMonotonic(&startTime);
|
||||||
|
|
||||||
|
if (config->always_invert)
|
||||||
|
bitwise_not(pipeline_data->crop_gray, pipeline_data->crop_gray);
|
||||||
|
|
||||||
pipeline_data->clearThresholds();
|
pipeline_data->clearThresholds();
|
||||||
pipeline_data->thresholds = produceThresholds(pipeline_data->crop_gray, config);
|
pipeline_data->thresholds = produceThresholds(pipeline_data->crop_gray, config);
|
||||||
|
|
||||||
@@ -177,7 +180,13 @@ namespace alpr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline_data->plate_inverted = isPlateInverted();
|
if (config->auto_invert)
|
||||||
|
pipeline_data->plate_inverted = isPlateInverted();
|
||||||
|
else
|
||||||
|
pipeline_data->plate_inverted = config->always_invert;
|
||||||
|
|
||||||
|
if (config->debugGeneral)
|
||||||
|
cout << "Plate inverted: " << pipeline_data->plate_inverted << endl;
|
||||||
|
|
||||||
|
|
||||||
if (pipeline_data->textLines.size() > 0)
|
if (pipeline_data->textLines.size() > 0)
|
||||||
|
Reference in New Issue
Block a user