From c4e09cc0f80e086cdc142e86a1887834a05e4477 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sat, 30 Aug 2014 11:33:35 -0400 Subject: [PATCH] Resolves issue #45 Use better angle value for edge detection --- src/openalpr/platecorners.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/openalpr/platecorners.cpp b/src/openalpr/platecorners.cpp index 5757aff..a597f54 100644 --- a/src/openalpr/platecorners.cpp +++ b/src/openalpr/platecorners.cpp @@ -199,6 +199,15 @@ void PlateCorners::scoreVerticals(int v1, int v2) score += (verticalAngleDiff) * SCORING_BOXINESS_WEIGHT; + ///////////////////////////////////////////////////////////////////////// + // Score angle difference from detected character box + ///////////////////////////////////////////////////////////////////////// + + float perpendicularCharAngle = charAngle - 90; + float charanglediff = abs(perpendicularCharAngle - left.angle) + abs(perpendicularCharAngle - right.angle); + + score += charanglediff * SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT; + ////////////////////////////////////////////////////////////////////////// // SCORE the shape wrt character position and height relative to position ////////////////////////////////////////////////////////////////////////// @@ -241,6 +250,10 @@ void PlateCorners::scoreVerticals(int v1, int v2) scorecomponent = plateDistance * SCORING_DISTANCE_WEIGHT_VERTICAL; cout << " -- -- Score: " << scorecomponent << " = " << scorecomponent / score * 100 << "% of score" << endl; + cout << " -- Char angle Score: " << charanglediff << " -- Weight (" << SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT << ")" << endl; + scorecomponent = charanglediff * SCORING_ANGLE_MATCHES_LPCHARS_WEIGHT; + cout << " -- -- Score: " << scorecomponent << " = " << scorecomponent / score * 100 << "% of score" << endl; + cout << " -- Plate line confidence Score: " << confidenceDiff << " -- Weight (" << SCORING_LINE_CONFIDENCE_WEIGHT << ")" << endl; scorecomponent = confidenceDiff * SCORING_LINE_CONFIDENCE_WEIGHT; cout << " -- -- Score: " << scorecomponent << " = " << scorecomponent / score * 100 << "% of score" << endl;