mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 12:06:51 +08:00
Lazy load StateIdentifier.
This commit is contained in:
@@ -40,13 +40,12 @@ namespace alpr
|
||||
}
|
||||
|
||||
plateDetector = createDetector(config);
|
||||
stateIdentifier = new StateIdentifier(config);
|
||||
ocr = new OCR(config);
|
||||
setNumThreads(0);
|
||||
|
||||
this->detectRegion = DEFAULT_DETECT_REGION;
|
||||
setDetectRegion(DEFAULT_DETECT_REGION);
|
||||
this->topN = DEFAULT_TOPN;
|
||||
this->defaultRegion = "";
|
||||
setDefaultRegion("");
|
||||
|
||||
}
|
||||
AlprImpl::~AlprImpl()
|
||||
@@ -498,6 +497,11 @@ namespace alpr
|
||||
void AlprImpl::setDetectRegion(bool detectRegion)
|
||||
{
|
||||
this->detectRegion = detectRegion;
|
||||
if (detectRegion && this->stateIdentifier == NULL)
|
||||
{
|
||||
this->stateIdentifier = new StateIdentifier(this->config);
|
||||
}
|
||||
|
||||
}
|
||||
void AlprImpl::setTopN(int topn)
|
||||
{
|
||||
@@ -506,6 +510,10 @@ namespace alpr
|
||||
void AlprImpl::setDefaultRegion(string region)
|
||||
{
|
||||
this->defaultRegion = region;
|
||||
if (!region.empty() && this->stateIdentifier == NULL)
|
||||
{
|
||||
this->stateIdentifier = new StateIdentifier(this->config);
|
||||
}
|
||||
}
|
||||
|
||||
std::string AlprImpl::getVersion()
|
||||
|
Reference in New Issue
Block a user