From b29a63499fe68553d2922c5eac68b2cbc1cff700 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Thu, 14 Nov 2013 14:43:19 -0500 Subject: [PATCH] fixed positive sampling bug --- openbr/plugins/slidingwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openbr/plugins/slidingwindow.cpp b/openbr/plugins/slidingwindow.cpp index 458f681..e5135c1 100644 --- a/openbr/plugins/slidingwindow.cpp +++ b/openbr/plugins/slidingwindow.cpp @@ -111,7 +111,7 @@ private: BR_REGISTER(Transform, SlidingWindowTransform) -static TemplateList cropTrainingSamples(const TemplateList &data, const float aspectRatio, const int minSize = 0, const float maxOverlap = 0.5, const int negToPosRatio = 1) +static TemplateList cropTrainingSamples(const TemplateList &data, const float aspectRatio, const int minSize = 32, const float maxOverlap = 0.5, const int negToPosRatio = 1) { TemplateList result; foreach (const Template &tmpl, data) { @@ -121,8 +121,8 @@ static TemplateList cropTrainingSamples(const TemplateList &data, const float as Rect &posRect = posRects[i]; // Adjust for training samples that have different aspect ratios - const int diff = posRect.width - int(posRect.height * aspectRatio); - posRect.x += diff / 2; + const int diff = int(posRect.height * aspectRatio) - posRect.width; + posRect.x -= diff / 2; posRect.width += diff; // Ignore samples larger than the image -- libgit2 0.21.4