diff --git a/config/openalpr.conf.in b/config/openalpr.conf.in index 3507682..71d32fe 100644 --- a/config/openalpr.conf.in +++ b/config/openalpr.conf.in @@ -49,6 +49,10 @@ 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 +; OpenALPR detects high-contrast plate crops and uses an alternative edge detection technique. Setting this to 0.0 +; would classify ALL images as high-contrast, setting it to 1.0 would classify no images as high-contrast. +contrast_detection_threshold = 0.3 + max_plate_angle_degrees = 15 ocr_min_font_point = 6 diff --git a/src/openalpr/config.cpp b/src/openalpr/config.cpp index 876dd5e..83f0c3c 100644 --- a/src/openalpr/config.cpp +++ b/src/openalpr/config.cpp @@ -183,6 +183,8 @@ namespace alpr maxDetectionInputWidth = getInt(ini, "", "max_detection_input_width", 1280); maxDetectionInputHeight = getInt(ini, "", "max_detection_input_height", 768); + contrastDetectionThreshold = getFloat(ini, "", "contrast_detection_threshold", 0.3); + mustMatchPattern = getBoolean(ini, "", "must_match_pattern", false); skipDetection = getBoolean(ini, "", "skip_detection", false); diff --git a/src/openalpr/config.h b/src/openalpr/config.h index bcb3976..a0523c3 100644 --- a/src/openalpr/config.h +++ b/src/openalpr/config.h @@ -57,6 +57,8 @@ namespace alpr int maxDetectionInputWidth; int maxDetectionInputHeight; + float contrastDetectionThreshold; + bool skipDetection; bool auto_invert; diff --git a/src/openalpr/edges/edgefinder.cpp b/src/openalpr/edges/edgefinder.cpp index 9c3dd53..bbe8dd7 100644 --- a/src/openalpr/edges/edgefinder.cpp +++ b/src/openalpr/edges/edgefinder.cpp @@ -339,7 +339,7 @@ namespace alpr cout << "High Contrast Detection Time: " << diffclock(startTime, endTime) << "ms." << endl; } - return contrast > 0.3; + return contrast > pipeline_data->config->contrastDetectionThreshold; } } \ No newline at end of file