From b90566585a04dc99b8f82505d1d34b47f1ec683b Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 24 Mar 2014 10:10:55 -0500 Subject: [PATCH] Added variable to control plate detection size increase. Adjusting it to a smaller value means slower detection but higher probability that the plate will be found (and vice versa) --- runtime_data/openalpr.conf | 6 ++++-- src/openalpr/config.cpp | 3 +++ src/openalpr/config.h | 2 ++ src/openalpr/regiondetector.cpp | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/runtime_data/openalpr.conf b/runtime_data/openalpr.conf index b204592..382ef3d 100644 --- a/runtime_data/openalpr.conf +++ b/runtime_data/openalpr.conf @@ -6,6 +6,8 @@ state_id_img_size_percent = 2.0 max_plate_width_percent = 100 max_plate_height_percent = 100 +detection_iteration_increase = 1.1 + opencl_enabled = 0 ocr_min_font_point = 6 @@ -25,7 +27,7 @@ postprocess_min_characters = 4 postprocess_max_characters = 8 [debug] -general = 0 +general = 1 timing = 0 state_id = 0 plate_lines = 0 @@ -36,7 +38,7 @@ char_analysis = 0 color_filter = 0 ocr = 0 postprocess = 0 -show_images = 0 +show_images = 1 ;;; Country Specific variables ;;;; diff --git a/src/openalpr/config.cpp b/src/openalpr/config.cpp index f57c42f..3ebf922 100644 --- a/src/openalpr/config.cpp +++ b/src/openalpr/config.cpp @@ -71,6 +71,9 @@ void Config::loadValues(string country) { opencl_enabled = getBoolean("common", "opencl_enabled", false); + + detection_iteration_increase = getFloat("common", "detection_iteration_increase", 1.1); + maxPlateWidthPercent = getFloat("common", "max_plate_width_percent", 100); maxPlateHeightPercent = getFloat("common", "max_plate_height_percent", 100); diff --git a/src/openalpr/config.h b/src/openalpr/config.h index 78e6b7e..7328576 100644 --- a/src/openalpr/config.h +++ b/src/openalpr/config.h @@ -45,6 +45,8 @@ class Config bool opencl_enabled; + float detection_iteration_increase; + float maxPlateWidthPercent; float maxPlateHeightPercent; diff --git a/src/openalpr/regiondetector.cpp b/src/openalpr/regiondetector.cpp index 3f8f061..d2a7023 100644 --- a/src/openalpr/regiondetector.cpp +++ b/src/openalpr/regiondetector.cpp @@ -90,12 +90,12 @@ vector RegionDetector::doCascade(Mat frame) if (config->opencl_enabled) { ocl::oclMat openclFrame(frame); - ((ocl::OclCascadeClassifier*) plate_cascade)->detectMultiScale(openclFrame, plates, 1.1, 3, 0, minSize, maxSize); + ((ocl::OclCascadeClassifier*) plate_cascade)->detectMultiScale(openclFrame, plates, config->detection_iteration_increase, 3, 0, minSize, maxSize); } else { - plate_cascade->detectMultiScale( frame, plates, 1.1, 3, + plate_cascade->detectMultiScale( frame, plates, config->detection_iteration_increase, 3, 0, //0|CV_HAAR_SCALE_IMAGE, minSize, maxSize );