Added a few extra pixels to the top/bottom plate edge line guess

This commit is contained in:
Matt Hill
2016-03-07 12:56:37 -05:00
parent 687f1c86d1
commit 78f6fb2b41

View File

@@ -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++;
}