From c46bd446f2e45c1e9e8eba6ccb9d92f8ef8f45f9 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Wed, 18 Mar 2015 18:09:53 -0400 Subject: [PATCH] Replaced GPU config mode option with detector --- config/openalpr.conf.in | 9 +++++---- src/openalpr/config.cpp | 16 +++++++++++++++- src/openalpr/config.h | 10 +++++----- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/config/openalpr.conf.in b/config/openalpr.conf.in index 4826f00..c9f8971 100644 --- a/config/openalpr.conf.in +++ b/config/openalpr.conf.in @@ -31,10 +31,11 @@ detection_strictness = 3 max_detection_input_width = 1280 max_detection_input_height = 720 -; gpu_mode can be set to -; 0=OFF -; 1=CUDA -gpu_mode = 0 +; detector is the technique used to find license plate regions in an image. Value can be set to +; lbpcpu - default LBP-based detector uses the system CPU +; lbpcuda - LBP-based detector that uses Nvidia GPU to increase recognition speed. +; morphcpu - Experimental detector that detects white rectangles in an image. Does not require training. +detector = lbpcpu ; Bypasses plate detection. If this is set to 1, the library assumes that each region provided is a likely plate area. skip_detection = 0 diff --git a/src/openalpr/config.cpp b/src/openalpr/config.cpp index 62881a4..3097814 100644 --- a/src/openalpr/config.cpp +++ b/src/openalpr/config.cpp @@ -130,7 +130,21 @@ namespace alpr runtimeBaseDir = getString("common", "runtime_dir", "/usr/share/openalpr/runtime_data"); - gpu_mode = getInt("common", "gpu_mode", GPU_OFF); + std::string detectorString = getString("common", "detector", "lbpcpu"); + std::transform(detectorString.begin(), detectorString.end(), detectorString.begin(), ::tolower); + + if (detectorString.compare("lbpcpu") == 0) + detector = DETECTOR_LBP_CPU; + else if (detectorString.compare("lbpgpu") == 0) + detector = DETECTOR_LBP_GPU; + else if (detectorString.compare("morphcpu") == 0) + detector = DETECTOR_MORPH_CPU; + else + { + std::cerr << "Invalid detector specified: " << detectorString << ". Using default" << std::endl; + detector = DETECTOR_LBP_CPU; + } + detection_iteration_increase = getFloat("common", "detection_iteration_increase", 1.1); detectionStrictness = getInt("common", "detection_strictness", 3); maxPlateWidthPercent = getFloat("common", "max_plate_width_percent", 100); diff --git a/src/openalpr/config.h b/src/openalpr/config.h index b388963..5ef5f97 100644 --- a/src/openalpr/config.h +++ b/src/openalpr/config.h @@ -47,7 +47,7 @@ namespace alpr std::string country; - int gpu_mode; + int detector; float detection_iteration_increase; int detectionStrictness; @@ -138,11 +138,11 @@ namespace alpr }; - enum GPU_MODE + enum DETECTOR_TYPE { - GPU_OFF=0, - GPU_CUDA=1, - GPU_OPENCL=2 + DETECTOR_LBP_CPU=0, + DETECTOR_LBP_GPU=1, + DETECTOR_MORPH_CPU=2 }; }