mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 17:07:39 +08:00
Detecting regions hierarchically. Starting with the biggest boxes, and then moving into their children if the bigger box was not detected.
This commit is contained in:
@@ -159,7 +159,6 @@ void plateAnalysisThread(void* arg)
|
||||
if (dispatcher->hasPlate() == false)
|
||||
break;
|
||||
|
||||
// Synchronized section
|
||||
if (dispatcher->config->debugGeneral)
|
||||
cout << "Thread: " << tthread::this_thread::get_id() << " loop " << ++loop_count << endl;
|
||||
|
||||
@@ -168,8 +167,6 @@ void plateAnalysisThread(void* arg)
|
||||
|
||||
Mat img = dispatcher->getImageCopy();
|
||||
|
||||
|
||||
// Parallel section
|
||||
timespec platestarttime;
|
||||
getTime(&platestarttime);
|
||||
|
||||
@@ -178,7 +175,16 @@ void plateAnalysisThread(void* arg)
|
||||
lp.recognize();
|
||||
|
||||
|
||||
if (lp.confidence > 10)
|
||||
if (lp.confidence <= 10)
|
||||
{
|
||||
// Not a valid plate
|
||||
// Check if this plate has any children, if so, send them back up to the dispatcher for processing
|
||||
for (int childidx = 0; childidx < plateRegion.children.size(); childidx++)
|
||||
{
|
||||
dispatcher->appendPlate(plateRegion.children[childidx]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AlprResult plateResult;
|
||||
plateResult.region = dispatcher->defaultRegion;
|
||||
@@ -245,9 +251,10 @@ void plateAnalysisThread(void* arg)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (dispatcher->config->debugTiming)
|
||||
{
|
||||
timespec plateEndTime;
|
||||
@@ -255,6 +262,7 @@ void plateAnalysisThread(void* arg)
|
||||
cout << "Thread: " << tthread::this_thread::get_id() << " Finished loop " << loop_count << " in " << diffclock(platestarttime, plateEndTime) << "ms." << endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (dispatcher->config->debugGeneral)
|
||||
|
@@ -123,6 +123,13 @@ class PlateDispatcher
|
||||
return plateRegion;
|
||||
}
|
||||
|
||||
void appendPlate(PlateRegion plate)
|
||||
{
|
||||
tthread::lock_guard<tthread::mutex> guard(mMutex);
|
||||
|
||||
plateRegions.push_back(plate);
|
||||
}
|
||||
|
||||
void addResult(AlprResult recognitionResult)
|
||||
{
|
||||
tthread::lock_guard<tthread::mutex> guard(mMutex);
|
||||
|
Reference in New Issue
Block a user