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:
Matt Hill
2014-04-04 16:42:06 -05:00
parent b1fd90161f
commit 95c6e59610
2 changed files with 91 additions and 76 deletions

View File

@@ -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)

View File

@@ -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);