Commit c19e8b53d898cfc915826cadeeb30101f6f64b16

Authored by Austin Van Blanton
1 parent 508e802a

Append detections as rects and pass full Template

openbr/plugins/slidingwindow.cpp
... ... @@ -74,23 +74,22 @@ private:
74 74  
75 75 void project(const Template &src, Template &dst) const
76 76 {
  77 + dst = src;
77 78 // no need to slide a window over ground truth data
78   - if (src.file.getBool("Train", false)) {
79   - dst = src;
80   - return;
81   - }
  79 + if (src.file.getBool("Train", false)) return;
82 80  
83   - dst.file = src.file;
  81 + dst.file.clearRects();
84 82 int rows = src.m().rows, cols = src.m().cols;
85 83 for (double size=std::min(rows, cols); size>=minSize; size*=scaleFactor) {
86 84 for (double y=0; y+size<rows; y+=(size*stepSize)) {
87 85 for (double x=0; x+size<cols; x+=(size*stepSize)) {
88   - Template window(src.file, Mat(src.m(), Rect(x, y, size, size)));
  86 + Rect window(x, y, size, size);
  87 + Template windowMat(src.file, Mat(src.m(), window));
89 88 Template detect;
90   - transform->project(window, detect);
  89 + transform->project(windowMat, detect);
91 90 // the result will be in the Label
92 91 if (detect.file.get<QString>(QString("Label")) == "pos") {
93   - dst += detect;
  92 + dst.file.appendRect(OpenCVUtils::fromRect(window));
94 93 if (takeLargestScale) return;
95 94 }
96 95 }
... ...