From 8b50ebc1f16593763bc9f6b35393c80f55357ba0 Mon Sep 17 00:00:00 2001 From: "Adi P." Date: Tue, 1 Sep 2015 14:11:14 +0200 Subject: [PATCH] Fixed best plate selection When searching for best plate index if there are two results that matches the country template and if one of them is at index 0 than the second matching result will be selected as best result. --- src/openalpr/alpr_impl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index aa6463e..e065f67 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -218,12 +218,15 @@ namespace alpr int bestPlateIndex = 0; cv::Mat charTransformMatrix = getCharacterTransformMatrix(&pipeline_data); + bool isBestPlateSelected = false; for (unsigned int pp = 0; pp < ppResults.size(); pp++) { // 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) + if (isBestPlateSelected == false && ppResults[pp].matchesTemplate){ bestPlateIndex = plateResult.topNPlates.size(); + isBestPlateSelected = true; + } AlprPlate aplate; aplate.characters = ppResults[pp].letters;