Commit aa9836fb19a104a8dab05b05ae9509b8f7fb93ff

Authored by Scott Klum
1 parent 31103c96

Minor corrections in group

Showing 1 changed file with 7 additions and 9 deletions
openbr/core/opencvutils.cpp
@@ -480,7 +480,7 @@ void OpenCVUtils::group(QList<Rect> &rects, QList<float> &confidences, float con @@ -480,7 +480,7 @@ void OpenCVUtils::group(QList<Rect> &rects, QList<float> &confidences, float con
480 for (int i = 0; i < nClasses; i++) 480 for (int i = 0; i < nClasses; i++)
481 { 481 {
482 // Average rectangle 482 // Average rectangle
483 - Rect r1 = rrects[i]; 483 + const Rect r1 = rrects[i];
484 484
485 // Used to eliminate rectangles with few neighbors in the case of no weights 485 // Used to eliminate rectangles with few neighbors in the case of no weights
486 const float w1 = classConfidence[i]; 486 const float w1 = classConfidence[i];
@@ -501,21 +501,19 @@ void OpenCVUtils::group(QList&lt;Rect&gt; &amp;rects, QList&lt;float&gt; &amp;confidences, float con @@ -501,21 +501,19 @@ void OpenCVUtils::group(QList&lt;Rect&gt; &amp;rects, QList&lt;float&gt; &amp;confidences, float con
501 if (j == i || n2 < minNeighbors) 501 if (j == i || n2 < minNeighbors)
502 continue; 502 continue;
503 503
504 - Rect r2 = rrects[j]; 504 + const Rect r2 = rrects[j];
505 505
506 - int dx = saturate_cast<int>(r2.width * epsilon);  
507 - int dy = saturate_cast<int>(r2.height * epsilon); 506 + const int dx = saturate_cast<int>(r2.width * epsilon);
  507 + const int dy = saturate_cast<int>(r2.height * epsilon);
508 508
509 - float w2 = classConfidence[j]; 509 + const float w2 = classConfidence[j];
510 510
511 - // If, r1 is within the r2 AND  
512 - // r2 has a higher confidence than r1  
513 - // then, eliminate the r1  
514 if(r1.x >= r2.x - dx && 511 if(r1.x >= r2.x - dx &&
515 r1.y >= r2.y - dy && 512 r1.y >= r2.y - dy &&
516 r1.x + r1.width <= r2.x + r2.width + dx && 513 r1.x + r1.width <= r2.x + r2.width + dx &&
517 r1.y + r1.height <= r2.y + r2.height + dy && 514 r1.y + r1.height <= r2.y + r2.height + dy &&
518 - (w2 > std::max(confidenceThreshold, w1))) 515 + (w2 > w1) &&
  516 + (n2 > n1))
519 break; 517 break;
520 } 518 }
521 519