mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 19:06:50 +08:00
Resolves issue #150 Automatically apply pattern matching for countries with only one pattern
This commit is contained in:
@@ -277,7 +277,13 @@ namespace alpr
|
|||||||
if (!pipeline_data.disqualified)
|
if (!pipeline_data.disqualified)
|
||||||
{
|
{
|
||||||
AlprPlateResult plateResult;
|
AlprPlateResult plateResult;
|
||||||
plateResult.region = defaultRegion;
|
|
||||||
|
// If there's only one pattern for a country, use it. Otherwise use the default
|
||||||
|
if (country_recognizers.ocr->postProcessor.getPatterns().size() == 1)
|
||||||
|
plateResult.region = country_recognizers.ocr->postProcessor.getPatterns()[0];
|
||||||
|
else
|
||||||
|
plateResult.region = defaultRegion;
|
||||||
|
|
||||||
plateResult.regionConfidence = 0;
|
plateResult.regionConfidence = 0;
|
||||||
plateResult.plate_index = platecount++;
|
plateResult.plate_index = platecount++;
|
||||||
|
|
||||||
|
@@ -386,6 +386,14 @@ namespace alpr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<string> PostProcess::getPatterns() {
|
||||||
|
vector<string> v;
|
||||||
|
for(map<string,std::vector<RegexRule*> >::iterator it = rules.begin(); it != rules.end(); ++it) {
|
||||||
|
v.push_back(it->first);
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
bool letterCompare( const Letter &left, const Letter &right )
|
bool letterCompare( const Letter &left, const Letter &right )
|
||||||
{
|
{
|
||||||
|
@@ -74,6 +74,8 @@ namespace alpr
|
|||||||
|
|
||||||
bool regionIsValid(std::string templateregion);
|
bool regionIsValid(std::string templateregion);
|
||||||
|
|
||||||
|
std::vector<std::string> getPatterns();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Config* config;
|
Config* config;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user