Changed library to point to a config file rather than runtime dir

runtime dir location is specified in the config file
This commit is contained in:
Matt Hill
2014-05-10 09:50:52 -05:00
parent cbfa90fc84
commit 66febb8ca8
10 changed files with 110 additions and 41 deletions

View File

@@ -21,9 +21,19 @@
void plateAnalysisThread(void* arg);
AlprImpl::AlprImpl(const std::string country, const std::string runtimeDir)
AlprImpl::AlprImpl(const std::string country, const std::string configFile)
{
config = new Config(country, runtimeDir);
config = new Config(country, configFile);
// Config file or runtime dir not found. Don't process any further.
if (config->loaded == false)
{
plateDetector = ALPR_NULL_PTR;
stateIdentifier = ALPR_NULL_PTR;
ocr = ALPR_NULL_PTR;
return;
}
plateDetector = new RegionDetector(config);
stateIdentifier = new StateIdentifier(config);
ocr = new OCR(config);
@@ -37,9 +47,20 @@ AlprImpl::AlprImpl(const std::string country, const std::string runtimeDir)
AlprImpl::~AlprImpl()
{
delete config;
delete plateDetector;
delete stateIdentifier;
delete ocr;
if (plateDetector != ALPR_NULL_PTR)
delete plateDetector;
if (stateIdentifier != ALPR_NULL_PTR)
delete stateIdentifier;
if (ocr != ALPR_NULL_PTR)
delete ocr;
}
bool AlprImpl::isLoaded()
{
return config->loaded;
}