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