From d48119e7afe989ce2f3660c401ace2d410f6ba1d Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 15 May 2015 05:54:17 -0400 Subject: [PATCH] Added sanity check to LBP detector --- src/openalpr/detection/detectorcpu.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/openalpr/detection/detectorcpu.cpp b/src/openalpr/detection/detectorcpu.cpp index 0564f4b..5bbeb6c 100644 --- a/src/openalpr/detection/detectorcpu.cpp +++ b/src/openalpr/detection/detectorcpu.cpp @@ -60,9 +60,15 @@ namespace alpr } - vector detectedRegions; + vector detectedRegions; for (int i = 0; i < regionsOfInterest.size(); i++) { + // Sanity check. If roi width or height is less than minimum possible plate size, + // then skip it + if ((regionsOfInterest[i].width < config->minPlateSizeWidthPx) || + (regionsOfInterest[i].height < config->minPlateSizeHeightPx)) + continue; + Mat cropped = frame_gray(regionsOfInterest[i]); vector subRegions = doCascade(cropped, regionsOfInterest[i].x, regionsOfInterest[i].y);