Commit 7a0a9f3e511134568ce0b4f68eec9034f409769a
1 parent
8f1084e7
introduced shell code for IntegralSlidingWindowTransform
Showing
2 changed files
with
30 additions
and
10 deletions
openbr/plugins/slidingwindow.cpp
| ... | ... | @@ -66,6 +66,19 @@ private: |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | + void store(QDataStream &stream) const | |
| 70 | + { | |
| 71 | + transform->store(stream); | |
| 72 | + stream << windowHeight; | |
| 73 | + } | |
| 74 | + | |
| 75 | + void load(QDataStream &stream) | |
| 76 | + { | |
| 77 | + transform->load(stream); | |
| 78 | + stream >> windowHeight; | |
| 79 | + } | |
| 80 | + | |
| 81 | +protected: // Let IntegralSlidingWindowTransform access this | |
| 69 | 82 | void project(const Template &src, Template &dst) const |
| 70 | 83 | { |
| 71 | 84 | dst = src; |
| ... | ... | @@ -95,21 +108,28 @@ private: |
| 95 | 108 | } |
| 96 | 109 | dst.file.setList<float>("Confidences", confidences); |
| 97 | 110 | } |
| 111 | +}; | |
| 98 | 112 | |
| 99 | - void store(QDataStream &stream) const | |
| 100 | - { | |
| 101 | - transform->store(stream); | |
| 102 | - stream << windowHeight; | |
| 103 | - } | |
| 113 | +BR_REGISTER(Transform, SlidingWindowTransform) | |
| 104 | 114 | |
| 105 | - void load(QDataStream &stream) | |
| 115 | +/*! | |
| 116 | + * \ingroup transforms | |
| 117 | + * \brief Overloads SlidingWindowTransform for integral images that should be | |
| 118 | + * sampled at multiple scales. | |
| 119 | + * \author Josh Klontz \cite jklontz | |
| 120 | + */ | |
| 121 | +class IntegralSlidingWindowTransform : public SlidingWindowTransform | |
| 122 | +{ | |
| 123 | + Q_OBJECT | |
| 124 | + | |
| 125 | + void project(const Template &src, Template &dst) const | |
| 106 | 126 | { |
| 107 | - transform->load(stream); | |
| 108 | - stream >> windowHeight; | |
| 127 | + // TODO: call SlidingWindowTransform::project on multiple scales | |
| 128 | + SlidingWindowTransform::project(src, dst); | |
| 109 | 129 | } |
| 110 | 130 | }; |
| 111 | 131 | |
| 112 | -BR_REGISTER(Transform, SlidingWindowTransform) | |
| 132 | +BR_REGISTER(Transform, IntegralSlidingWindowTransform) | |
| 113 | 133 | |
| 114 | 134 | static TemplateList cropTrainingSamples(const TemplateList &data, const float aspectRatio, const int minSize = 32, const float maxOverlap = 0.5, const int negToPosRatio = 1) |
| 115 | 135 | { | ... | ... |
scripts/pedestrianBaselineLBP.sh
| ... | ... | @@ -13,7 +13,7 @@ fi |
| 13 | 13 | ALG="Open+Cvt(Gray)+Rename(neg,0)+BuildScales(Blur(2)+LBP(1,2)+SlidingWindow(Hist(59)+Cat+LDA(isBinary=true),windowWidth=10,takeLargestScale=false,threshold=2),windowWidth=10,takeLargestScale=false,minScale=4)+ConsolidateDetections+Discard" |
| 14 | 14 | |
| 15 | 15 | # Josh's new algorithm (in progress) |
| 16 | -# ALG="Open+Cvt(Gray)+Detector(Gradient+Bin(0,360,9,true)+Merge+Integral+SlidingWindow(RecursiveIntegralSampler(2,2,0,PCA(0.95))+Cat+LDA(0.95,isBinary=true)))" | |
| 16 | +# ALG="Open+Cvt(Gray)+Detector(Gradient+Bin(0,360,9,true)+Merge+Integral+IntegralSlidingWindow(RecursiveIntegralSampler(2,2,0,PCA(0.95))+Cat+LDA(0.95,isBinary=true)))" | |
| 17 | 17 | |
| 18 | 18 | br -useGui 0 \ |
| 19 | 19 | -algorithm "${ALG}" \ | ... | ... |