diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index 9492c2f..848f785 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -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) diff --git a/src/openalpr/alpr_impl.h b/src/openalpr/alpr_impl.h index a1ed0f9..df2b7e3 100644 --- a/src/openalpr/alpr_impl.h +++ b/src/openalpr/alpr_impl.h @@ -45,6 +45,8 @@ #include "pipeline_data.h" +#include "prewarp.h" + #include #include "support/platform.h"