Commit b29a63499fe68553d2922c5eac68b2cbc1cff700

Authored by Josh Klontz
1 parent 55565169

fixed positive sampling bug

openbr/plugins/slidingwindow.cpp
... ... @@ -111,7 +111,7 @@ private:
111 111  
112 112 BR_REGISTER(Transform, SlidingWindowTransform)
113 113  
114   -static TemplateList cropTrainingSamples(const TemplateList &data, const float aspectRatio, const int minSize = 0, const float maxOverlap = 0.5, const int negToPosRatio = 1)
  114 +static TemplateList cropTrainingSamples(const TemplateList &data, const float aspectRatio, const int minSize = 32, const float maxOverlap = 0.5, const int negToPosRatio = 1)
115 115 {
116 116 TemplateList result;
117 117 foreach (const Template &tmpl, data) {
... ... @@ -121,8 +121,8 @@ static TemplateList cropTrainingSamples(const TemplateList &data, const float as
121 121 Rect &posRect = posRects[i];
122 122  
123 123 // Adjust for training samples that have different aspect ratios
124   - const int diff = posRect.width - int(posRect.height * aspectRatio);
125   - posRect.x += diff / 2;
  124 + const int diff = int(posRect.height * aspectRatio) - posRect.width;
  125 + posRect.x -= diff / 2;
126 126 posRect.width += diff;
127 127  
128 128 // Ignore samples larger than the image
... ...