Commit 919686ebdc7a5733865c68497e6fbff972201ea2
1 parent
7a0a9f3e
factored out the common code needed for IntegralSlidingWindowTransform
Showing
1 changed file
with
8 additions
and
3 deletions
openbr/plugins/slidingwindow.cpp
| @@ -78,15 +78,20 @@ private: | @@ -78,15 +78,20 @@ private: | ||
| 78 | stream >> windowHeight; | 78 | stream >> windowHeight; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | -protected: // Let IntegralSlidingWindowTransform access this | ||
| 82 | void project(const Template &src, Template &dst) const | 81 | void project(const Template &src, Template &dst) const |
| 83 | { | 82 | { |
| 83 | + float scale = src.file.get<float>("scale", 1); | ||
| 84 | + projectHelp(src, dst, windowWidth, windowHeight, scale); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | +protected: // Let IntegralSlidingWindowTransform access this | ||
| 88 | + void projectHelp(const Template &src, Template &dst, int windowWidth, int windowHeight, float scale = 1) const | ||
| 89 | + { | ||
| 84 | dst = src; | 90 | dst = src; |
| 85 | // no need to slide a window over ground truth data | 91 | // no need to slide a window over ground truth data |
| 86 | if (src.file.getBool("Train", false)) return; | 92 | if (src.file.getBool("Train", false)) return; |
| 87 | 93 | ||
| 88 | dst.file.clearRects(); | 94 | dst.file.clearRects(); |
| 89 | - float scale = src.file.get<float>("scale", 1); | ||
| 90 | Template windowTemplate(src.file, src); | 95 | Template windowTemplate(src.file, src); |
| 91 | QList<float> confidences = dst.file.getList<float>("Confidences", QList<float>()); | 96 | QList<float> confidences = dst.file.getList<float>("Confidences", QList<float>()); |
| 92 | for (float y = 0; y + windowHeight < src.m().rows; y += windowHeight*stepFraction) { | 97 | for (float y = 0; y + windowHeight < src.m().rows; y += windowHeight*stepFraction) { |
| @@ -125,7 +130,7 @@ class IntegralSlidingWindowTransform : public SlidingWindowTransform | @@ -125,7 +130,7 @@ class IntegralSlidingWindowTransform : public SlidingWindowTransform | ||
| 125 | void project(const Template &src, Template &dst) const | 130 | void project(const Template &src, Template &dst) const |
| 126 | { | 131 | { |
| 127 | // TODO: call SlidingWindowTransform::project on multiple scales | 132 | // TODO: call SlidingWindowTransform::project on multiple scales |
| 128 | - SlidingWindowTransform::project(src, dst); | 133 | + SlidingWindowTransform::projectHelp(src, dst, 24, 24); |
| 129 | } | 134 | } |
| 130 | }; | 135 | }; |
| 131 | 136 |