From e01919dd3e954d32b749af11d8f53adfa27c6783 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sat, 27 Dec 2014 21:40:09 -0500 Subject: [PATCH] Added config option to bypass detection. If detection is bypassed, OpenALPR assumes the region provided is already a likely plate region --- config/openalpr.conf.in | 3 ++- src/openalpr/alpr_impl.cpp | 16 +++++++++++++++- src/openalpr/config.cpp | 2 ++ src/openalpr/config.h | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/config/openalpr.conf.in b/config/openalpr.conf.in index d8db036..90180aa 100644 --- a/config/openalpr.conf.in +++ b/config/openalpr.conf.in @@ -31,7 +31,8 @@ detection_strictness = 3 max_detection_input_width = 1280 max_detection_input_height = 720 - +; Bypasses plate detection. If this is set to 1, the library assumes that each region provided is a likely plate area. +skip_detection = 0 max_plate_angle_degrees = 15 diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index 5758873..6c7c8f6 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -104,7 +104,21 @@ namespace alpr } // Find all the candidate regions - response.plateRegions = plateDetector->detect(img, regionsOfInterest); + if (config->skipDetection == false) + { + response.plateRegions = plateDetector->detect(img, regionsOfInterest); + } + else + { + // They have elected to skip plate detection. Instead, return a list of plate regions + // based on their regions of interest + for (unsigned int i = 0; i < regionsOfInterest.size(); i++) + { + PlateRegion pr; + pr.rect = cv::Rect(regionsOfInterest[i]); + response.plateRegions.push_back(pr); + } + } queue plateQueue; for (unsigned int i = 0; i < response.plateRegions.size(); i++) diff --git a/src/openalpr/config.cpp b/src/openalpr/config.cpp index 3abca75..798736a 100644 --- a/src/openalpr/config.cpp +++ b/src/openalpr/config.cpp @@ -137,6 +137,8 @@ namespace alpr maxDetectionInputWidth = getInt("common", "max_detection_input_width", 1280); maxDetectionInputHeight = getInt("common", "max_detection_input_height", 768); + skipDetection = getBoolean("common", "skip_detection", false); + maxPlateAngleDegrees = getInt("common", "max_plate_angle_degrees", 15); minPlateSizeWidthPx = getInt(country, "min_plate_size_width_px", 100); diff --git a/src/openalpr/config.h b/src/openalpr/config.h index 5815fee..0b8032b 100644 --- a/src/openalpr/config.h +++ b/src/openalpr/config.h @@ -53,6 +53,8 @@ namespace alpr float maxPlateHeightPercent; int maxDetectionInputWidth; int maxDetectionInputHeight; + + bool skipDetection; int maxPlateAngleDegrees;