From aa9836fb19a104a8dab05b05ae9509b8f7fb93ff Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Fri, 18 Dec 2015 14:01:44 -0500 Subject: [PATCH] Minor corrections in group --- openbr/core/opencvutils.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/openbr/core/opencvutils.cpp b/openbr/core/opencvutils.cpp index b468d44..d815994 100644 --- a/openbr/core/opencvutils.cpp +++ b/openbr/core/opencvutils.cpp @@ -480,7 +480,7 @@ void OpenCVUtils::group(QList &rects, QList &confidences, float con for (int i = 0; i < nClasses; i++) { // Average rectangle - Rect r1 = rrects[i]; + const Rect r1 = rrects[i]; // Used to eliminate rectangles with few neighbors in the case of no weights const float w1 = classConfidence[i]; @@ -501,21 +501,19 @@ void OpenCVUtils::group(QList &rects, QList &confidences, float con if (j == i || n2 < minNeighbors) continue; - Rect r2 = rrects[j]; + const Rect r2 = rrects[j]; - int dx = saturate_cast(r2.width * epsilon); - int dy = saturate_cast(r2.height * epsilon); + const int dx = saturate_cast(r2.width * epsilon); + const int dy = saturate_cast(r2.height * epsilon); - float w2 = classConfidence[j]; + const float w2 = classConfidence[j]; - // If, r1 is within the r2 AND - // r2 has a higher confidence than r1 - // then, eliminate the r1 if(r1.x >= r2.x - dx && r1.y >= r2.y - dy && r1.x + r1.width <= r2.x + r2.width + dx && r1.y + r1.height <= r2.y + r2.height + dy && - (w2 > std::max(confidenceThreshold, w1))) + (w2 > w1) && + (n2 > n1)) break; } -- libgit2 0.21.4