From 7cd94d2e4c2d0b89362f70b3c8badc112ba269a9 Mon Sep 17 00:00:00 2001 From: Kees-V Date: Sun, 19 Apr 2015 20:28:57 +0200 Subject: [PATCH] filterByOuterMask: Re-initialize mask for every contour to get a correct calculation --- src/openalpr/textdetection/characteranalysis.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openalpr/textdetection/characteranalysis.cpp b/src/openalpr/textdetection/characteranalysis.cpp index 65ccc89..1bbd913 100644 --- a/src/openalpr/textdetection/characteranalysis.cpp +++ b/src/openalpr/textdetection/characteranalysis.cpp @@ -549,7 +549,8 @@ namespace alpr totalChars++; - drawContours(tempFullContour, textContours.contours, i, Scalar(255,255,255), CV_FILLED, 8, textContours.hierarchy); + tempFullContour = Mat::zeros(plateMask.size(), CV_8U); + drawContours(tempFullContour, textContours.contours, i, Scalar(255,255,255), CV_FILLED, 8, textContours.hierarchy); bitwise_and(tempFullContour, plateMask, tempMaskedContour); float beforeMaskWhiteness = mean(tempFullContour)[0];