From 78f6fb2b412f5f5111b831cbf6f922f5038dbf2e Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 7 Mar 2016 12:56:37 -0500 Subject: [PATCH] Added a few extra pixels to the top/bottom plate edge line guess --- src/openalpr/edges/platecorners.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openalpr/edges/platecorners.cpp b/src/openalpr/edges/platecorners.cpp index d77666d..eea4859 100644 --- a/src/openalpr/edges/platecorners.cpp +++ b/src/openalpr/edges/platecorners.cpp @@ -242,7 +242,9 @@ namespace alpr LineSegment top; LineSegment bottom; - + + // Add a few extra pixels to the guessed line, so we don't accidentally crop the characters + int extra_vertical_pixels = 3; float charHeightToPlateHeightRatio = pipelineData->config->plateHeightMM / pipelineData->config->avgCharHeightMM; float idealPixelHeight = tlc.charHeight * charHeightToPlateHeightRatio; @@ -266,13 +268,13 @@ namespace alpr else if (h1 == NO_LINE && h2 != NO_LINE) { bottom = this->plateLines->horizontalLines[h2].line; - top = bottom.getParallelLine(idealPixelHeight); + top = bottom.getParallelLine(idealPixelHeight + extra_vertical_pixels); missingSegmentPenalty++; } else if (h1 != NO_LINE && h2 == NO_LINE) { top = this->plateLines->horizontalLines[h1].line; - bottom = top.getParallelLine(-1 * idealPixelHeight); + bottom = top.getParallelLine(-1 * idealPixelHeight + extra_vertical_pixels); missingSegmentPenalty++; }