From 3964ffa49fd908c9a3102ca1602b394e972f66b8 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 17 Oct 2014 11:34:13 -0400 Subject: [PATCH] Added angle checking so that text areas with vertical angles are rejected --- src/openalpr/textdetection/linefinder.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/openalpr/textdetection/linefinder.cpp b/src/openalpr/textdetection/linefinder.cpp index db30e43..401537a 100644 --- a/src/openalpr/textdetection/linefinder.cpp +++ b/src/openalpr/textdetection/linefinder.cpp @@ -157,8 +157,18 @@ vector LineFinder::getBestLine(const TextContours contours, vector bottomRight = bottoms[i]; } - topLines.push_back(LineSegment(topLeft, topRight)); - bottomLines.push_back(LineSegment(bottomLeft, bottomRight)); + + LineSegment top(topLeft, topRight); + LineSegment bottom(bottomLeft, bottomRight); + + // Only allow lines that have a sane angle + if (abs(top.angle) <= pipeline_data->config->maxPlateAngleDegrees && + abs(bottom.angle) <= pipeline_data->config->maxPlateAngleDegrees) + { + topLines.push_back(top); + bottomLines.push_back(bottom); + } + } }