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); }