From 7a0a9f3e511134568ce0b4f68eec9034f409769a Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Thu, 14 Nov 2013 16:29:08 -0500 Subject: [PATCH] introduced shell code for IntegralSlidingWindowTransform --- openbr/plugins/slidingwindow.cpp | 38 +++++++++++++++++++++++++++++--------- scripts/pedestrianBaselineLBP.sh | 2 +- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/openbr/plugins/slidingwindow.cpp b/openbr/plugins/slidingwindow.cpp index 357f262..4dc8a3b 100644 --- a/openbr/plugins/slidingwindow.cpp +++ b/openbr/plugins/slidingwindow.cpp @@ -66,6 +66,19 @@ private: } } + void store(QDataStream &stream) const + { + transform->store(stream); + stream << windowHeight; + } + + void load(QDataStream &stream) + { + transform->load(stream); + stream >> windowHeight; + } + +protected: // Let IntegralSlidingWindowTransform access this void project(const Template &src, Template &dst) const { dst = src; @@ -95,21 +108,28 @@ private: } dst.file.setList("Confidences", confidences); } +}; - void store(QDataStream &stream) const - { - transform->store(stream); - stream << windowHeight; - } +BR_REGISTER(Transform, SlidingWindowTransform) - void load(QDataStream &stream) +/*! + * \ingroup transforms + * \brief Overloads SlidingWindowTransform for integral images that should be + * sampled at multiple scales. + * \author Josh Klontz \cite jklontz + */ +class IntegralSlidingWindowTransform : public SlidingWindowTransform +{ + Q_OBJECT + + void project(const Template &src, Template &dst) const { - transform->load(stream); - stream >> windowHeight; + // TODO: call SlidingWindowTransform::project on multiple scales + SlidingWindowTransform::project(src, dst); } }; -BR_REGISTER(Transform, SlidingWindowTransform) +BR_REGISTER(Transform, IntegralSlidingWindowTransform) static TemplateList cropTrainingSamples(const TemplateList &data, const float aspectRatio, const int minSize = 32, const float maxOverlap = 0.5, const int negToPosRatio = 1) { diff --git a/scripts/pedestrianBaselineLBP.sh b/scripts/pedestrianBaselineLBP.sh index 619c9bf..ea6af8f 100755 --- a/scripts/pedestrianBaselineLBP.sh +++ b/scripts/pedestrianBaselineLBP.sh @@ -13,7 +13,7 @@ fi 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" # Josh's new algorithm (in progress) -# 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)))" +# 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)))" br -useGui 0 \ -algorithm "${ALG}" \ -- libgit2 0.21.4