From d93d268908c215ecdc224764d91bdbb0d6193a60 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sun, 28 Jun 2015 11:47:35 -0400 Subject: [PATCH] Disqualify plates with corners that are way too narrow --- src/openalpr/edges/platecorners.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/openalpr/edges/platecorners.cpp b/src/openalpr/edges/platecorners.cpp index 12be2cd..cbfcf35 100644 --- a/src/openalpr/edges/platecorners.cpp +++ b/src/openalpr/edges/platecorners.cpp @@ -196,10 +196,17 @@ namespace alpr Point leftMidLinePoint = left.closestPointOnSegmentTo(tlc.centerVerticalLine.midpoint()); Point rightMidLinePoint = right.closestPointOnSegmentTo(tlc.centerVerticalLine.midpoint()); - float plateDistance = abs(idealPixelWidth - distanceBetweenPoints(leftMidLinePoint, rightMidLinePoint)); + float actual_width = distanceBetweenPoints(leftMidLinePoint, rightMidLinePoint); + + // Disqualify the pairing if it's less than one quarter of the ideal width + if (actual_width < (idealPixelWidth / 4)) + return; + + float plateDistance = abs(idealPixelWidth - actual_width); + // normalize for image width plateDistance = plateDistance / ((float)inputImage.cols); - + scoreKeeper.setScore("SCORING_DISTANCE_WEIGHT_VERTICAL", plateDistance, SCORING_DISTANCE_WEIGHT_VERTICAL); float score = scoreKeeper.getTotal();