Commit 1edab120 authored by marina.kolpakova's avatar marina.kolpakova

fix for negative confidence

parent bd9ca48f
......@@ -232,7 +232,7 @@ struct cv::SCascade::Fields
float detectionScore = 0.f;
const Octave& octave = *(level.octave);
int stBegin = octave.index * octave.stages, stEnd = stBegin + 1024;//octave.stages;
int stBegin = octave.index * octave.stages, stEnd = stBegin + octave.stages;
int st = stBegin;
for(; st < stEnd; ++st)
......@@ -270,7 +270,8 @@ struct cv::SCascade::Fields
if (detectionScore <= stage.threshold) return;
}
level.addDetection(dx, dy, detectionScore, detections);
if (detectionScore > 0)
level.addDetection(dx, dy, detectionScore, detections);
}
octIt_t fitOctave(const float& logFactor)
......
......@@ -66,7 +66,7 @@ TEST(SCascade, detect)
std::vector<Detection> objects;
cascade.detect(colored, cv::noArray(), objects);
ASSERT_EQ((int)objects.size(), 3498);
ASSERT_EQ(1459, (int)objects.size());
}
TEST(SCascade, detectSeparate)
......@@ -83,7 +83,7 @@ TEST(SCascade, detectSeparate)
cv::Mat rects, confs;
cascade.detect(colored, cv::noArray(), rects, confs);
ASSERT_EQ(confs.cols, 3498);
ASSERT_EQ(1459, confs.cols);
}
TEST(SCascade, detectRoi)
......@@ -102,7 +102,7 @@ TEST(SCascade, detectRoi)
rois.push_back(cv::Rect(0, 0, 640, 480));
cascade.detect(colored, rois, objects);
ASSERT_EQ((int)objects.size(), 3498);
ASSERT_EQ(1459, (int)objects.size());
}
TEST(SCascade, detectNoRoi)
......@@ -121,5 +121,5 @@ TEST(SCascade, detectNoRoi)
cascade.detect(colored, rois, objects);
ASSERT_EQ((int)objects.size(), 0);
ASSERT_EQ(0, (int)objects.size());
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment