mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 01:07:42 +08:00
Added runtime data dir parameter
just in case it's not possible to configure the runtime directory via config file (i.e., if the location is only known at runtime)
This commit is contained in:
@@ -22,9 +22,9 @@
|
||||
|
||||
// ALPR code
|
||||
|
||||
Alpr::Alpr(const std::string country, const std::string configFile)
|
||||
Alpr::Alpr(const std::string country, const std::string configFile, const std::string runtimeDir)
|
||||
{
|
||||
impl = new AlprImpl(country, configFile);
|
||||
impl = new AlprImpl(country, configFile, runtimeDir);
|
||||
}
|
||||
|
||||
Alpr::~Alpr()
|
||||
|
@@ -63,7 +63,7 @@ class Alpr
|
||||
{
|
||||
|
||||
public:
|
||||
Alpr(const std::string country, const std::string configFile = "");
|
||||
Alpr(const std::string country, const std::string configFile = "", const std::string runtimeDir = "");
|
||||
virtual ~Alpr();
|
||||
|
||||
void setDetectRegion(bool detectRegion);
|
||||
|
@@ -21,9 +21,9 @@
|
||||
|
||||
void plateAnalysisThread(void* arg);
|
||||
|
||||
AlprImpl::AlprImpl(const std::string country, const std::string configFile)
|
||||
AlprImpl::AlprImpl(const std::string country, const std::string configFile, const std::string runtimeDir)
|
||||
{
|
||||
config = new Config(country, configFile);
|
||||
config = new Config(country, configFile, runtimeDir);
|
||||
|
||||
// Config file or runtime dir not found. Don't process any further.
|
||||
if (config->loaded == false)
|
||||
|
@@ -51,7 +51,7 @@ class AlprImpl
|
||||
{
|
||||
|
||||
public:
|
||||
AlprImpl(const std::string country, const std::string configFile = "");
|
||||
AlprImpl(const std::string country, const std::string configFile = "", const std::string runtimeDir = "");
|
||||
virtual ~AlprImpl();
|
||||
|
||||
std::vector<AlprResult> recognize(cv::Mat img);
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
|
||||
|
||||
Config::Config(const std::string country, const std::string config_file)
|
||||
Config::Config(const std::string country, const std::string config_file, const std::string runtime_dir)
|
||||
{
|
||||
|
||||
string debug_message = "";
|
||||
@@ -76,6 +76,11 @@ Config::Config(const std::string country, const std::string config_file)
|
||||
|
||||
loadValues(country);
|
||||
|
||||
if (runtime_dir.compare("") != 0)
|
||||
{
|
||||
// User provided a runtime directory directly into the library. Use this.
|
||||
this->runtimeBaseDir = runtime_dir;
|
||||
}
|
||||
|
||||
if (DirectoryExists(this->runtimeBaseDir.c_str()) == false)
|
||||
{
|
||||
|
@@ -38,7 +38,7 @@ class Config
|
||||
{
|
||||
|
||||
public:
|
||||
Config(const std::string country, const std::string config_file = "");
|
||||
Config(const std::string country, const std::string config_file = "", const std::string runtime_dir = "");
|
||||
virtual ~Config();
|
||||
|
||||
bool loaded;
|
||||
|
Reference in New Issue
Block a user