Commit 718aa824dc581e43aa529d7e5e6837751c6e2f42

Authored by Brendan Klare
1 parent b9a0b5ea

Bug fixes

openbr/plugins/slidingwindow.cpp
@@ -107,7 +107,6 @@ private: @@ -107,7 +107,6 @@ private:
107 return; 107 return;
108 } 108 }
109 109
110 - dst.file.clearRects();  
111 Template windowTemplate(src.file, src); 110 Template windowTemplate(src.file, src);
112 QList<float> confidences = dst.file.getList<float>("Confidences", QList<float>()); 111 QList<float> confidences = dst.file.getList<float>("Confidences", QList<float>());
113 for (float y = 0; y + windowHeight < src.m().rows; y += windowHeight*stepFraction) { 112 for (float y = 0; y + windowHeight < src.m().rows; y += windowHeight*stepFraction) {
@@ -273,13 +272,15 @@ private: @@ -273,13 +272,15 @@ private:
273 int rows = src.m().rows; 272 int rows = src.m().rows;
274 int cols = src.m().cols; 273 int cols = src.m().cols;
275 int windowHeight = (int) qRound((float) windowWidth / aspectRatio); 274 int windowHeight = (int) qRound((float) windowWidth / aspectRatio);
  275 +
276 float startScale; 276 float startScale;
277 if ((cols / rows) > aspectRatio) 277 if ((cols / rows) > aspectRatio)
278 startScale = qRound((float) rows / (float) windowHeight); 278 startScale = qRound((float) rows / (float) windowHeight);
279 else 279 else
280 startScale = qRound((float) cols / (float) windowWidth); 280 startScale = qRound((float) cols / (float) windowWidth);
  281 +
281 for (float scale = startScale; scale >= minScale; scale -= (1.0 - scaleFactor)) { 282 for (float scale = startScale; scale >= minScale; scale -= (1.0 - scaleFactor)) {
282 - Template scaleImg(src.file, Mat()); 283 + Template scaleImg(dst.file, Mat());
283 scaleImg.file.set("scale", scale); 284 scaleImg.file.set("scale", scale);
284 resize(src, scaleImg, Size(qRound(cols / scale), qRound(rows / scale))); 285 resize(src, scaleImg, Size(qRound(cols / scale), qRound(rows / scale)));
285 transform->project(scaleImg, dst); 286 transform->project(scaleImg, dst);