From cc3c4c7861e4a4b9f20c8bba88e7a82a79798079 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Wed, 19 Feb 2014 18:17:35 -0600 Subject: [PATCH] Updated postprocess permutation calculation to handle corner cases (topn = 1 and permutations == topn) --- src/openalpr/postprocess.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openalpr/postprocess.cpp b/src/openalpr/postprocess.cpp index 3a16a37..77e2195 100644 --- a/src/openalpr/postprocess.cpp +++ b/src/openalpr/postprocess.cpp @@ -357,10 +357,11 @@ vector PostProcess::getMaxDepth(int topn) int nextLeastDropCharPos = getNextLeastDrop(depth); while (nextLeastDropCharPos != -1) { - depth[nextLeastDropCharPos] = depth[nextLeastDropCharPos] + 1; - if (getPermutationCount(depth) > topn) + if (getPermutationCount(depth) >= topn) break; + depth[nextLeastDropCharPos] = depth[nextLeastDropCharPos] + 1; + nextLeastDropCharPos = getNextLeastDrop(depth); }