mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 07:16:56 +08:00
Using utf-8 character length rather than num bytes
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
*/
|
||||
|
||||
#include "alpr_impl.h"
|
||||
#include "prewarp.h"
|
||||
#include "support/utf8.h"
|
||||
|
||||
|
||||
void plateAnalysisThread(void* arg);
|
||||
|
||||
@@ -197,8 +198,9 @@ namespace alpr
|
||||
if (pp >= topN)
|
||||
break;
|
||||
|
||||
if (ppResults[pp].letters.size() >= config->postProcessMinCharacters &&
|
||||
ppResults[pp].letters.size() <= config->postProcessMaxCharacters)
|
||||
int plate_char_length = utf8::distance(ppResults[pp].letters.begin(), ppResults[pp].letters.end());
|
||||
if (plate_char_length >= config->postProcessMinCharacters &&
|
||||
plate_char_length <= config->postProcessMaxCharacters)
|
||||
{
|
||||
// Set our "best plate" match to either the first entry, or the first entry with a postprocessor template match
|
||||
if (bestPlateIndex == 0 && ppResults[pp].matchesTemplate)
|
||||
@@ -210,6 +212,11 @@ namespace alpr
|
||||
aplate.matches_template = ppResults[pp].matchesTemplate;
|
||||
plateResult.topNPlates.push_back(aplate);
|
||||
}
|
||||
else if (plate_char_length > config->postProcessMaxCharacters)
|
||||
{
|
||||
cout << "Not within character count... " << ppResults[pp].letters << endl;
|
||||
cout << plate_char_length << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (plateResult.topNPlates.size() > bestPlateIndex)
|
||||
|
@@ -45,6 +45,8 @@
|
||||
|
||||
#include "pipeline_data.h"
|
||||
|
||||
#include "prewarp.h"
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
|
||||
#include "support/platform.h"
|
||||
|
Reference in New Issue
Block a user