From b145da1e85196737001b5f366d3063b2e3c968ad Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 10 Aug 2015 23:20:37 -0400 Subject: [PATCH] Fixes issue #174 --- src/openalpr/alpr_impl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index 042de45..85bf805 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -97,6 +97,10 @@ namespace alpr response.results.img_width = img.cols; response.results.img_height = img.rows; + // Fix regions of interest in case they extend beyond the bounds of the image + for (unsigned int i = 0; i < regionsOfInterest.size(); i++) + regionsOfInterest[i] = expandRect(regionsOfInterest[i], 0, 0, img.cols, img.rows); + for (unsigned int i = 0; i < regionsOfInterest.size(); i++) { response.results.regionsOfInterest.push_back(AlprRegionOfInterest(regionsOfInterest[i].x, regionsOfInterest[i].y,