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