diff --git a/modules/objdetect/perf/perf_cascadeclassifier.cpp b/modules/objdetect/perf/perf_cascadeclassifier.cpp index bf47d555c..f91f2f8ec 100644 --- a/modules/objdetect/perf/perf_cascadeclassifier.cpp +++ b/modules/objdetect/perf/perf_cascadeclassifier.cpp @@ -56,6 +56,18 @@ PERF_TEST_P(ImageName_MinSize, CascadeClassifierLBPFrontalFace, typedef std::tr1::tuple fixture; typedef perf::TestBaseWithParam detect; + +namespace { + typedef cv::SoftCascade::Detection detection_t; + + void extractRacts(std::vector objectBoxes, vector rects) + { + rects.clear(); + for (int i = 0; i < (int)objectBoxes.size(); ++i) + rects.push_back(objectBoxes[i].rect); + } +} + PERF_TEST_P(detect, SoftCascade, testing::Combine(testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")), testing::Values(std::string("cv/cascadeandhog/bahnhof/image_00000000_0.png")))) @@ -76,5 +88,9 @@ PERF_TEST_P(detect, SoftCascade, { cascade.detectMultiScale(colored, rois, objectBoxes); } - SANITY_CHECK(objectBoxes); + + vector rects; + extractRacts(objectBoxes, rects); + std::sort(rects.begin(), rects.end(), comparators::RectLess()); + SANITY_CHECK(rects); } diff --git a/modules/objdetect/src/isf.cpp b/modules/objdetect/src/isf.cpp index 48bfc89a8..bbf4f27c0 100644 --- a/modules/objdetect/src/isf.cpp +++ b/modules/objdetect/src/isf.cpp @@ -44,44 +44,6 @@ #include #include - -template -struct Decimate { - int shrinkage; - - Decimate(const int sr) : shrinkage(sr) {} - - void operator()(const cv::Mat& in, cv::Mat& out) const - { - int cols = in.cols / shrinkage; - int rows = in.rows / shrinkage; - out.create(rows, cols, in.type()); - - CV_Assert(cols * shrinkage == in.cols); - CV_Assert(rows * shrinkage == in.rows); - - for (int outIdx_y = 0; outIdx_y < rows; ++outIdx_y) - { - T* outPtr = out.ptr(outIdx_y); - for (int outIdx_x = 0; outIdx_x < cols; ++outIdx_x) - { - // do desimate - int inIdx_y = outIdx_y * shrinkage; - int inIdx_x = outIdx_x * shrinkage; - int sum = 0; - - for (int y = inIdx_y; y < inIdx_y + shrinkage; ++y) - for (int x = inIdx_x; x < inIdx_x + shrinkage; ++x) - sum += in.at(y, x); - - sum /= shrinkage * shrinkage; - outPtr[outIdx_x] = cv::saturate_cast(sum); - } - } - } - -}; - void cv::IntegralChannels::createHogBins(const cv::Mat gray, std::vector& integrals, int bins) const { CV_Assert(gray.type() == CV_8UC1); @@ -89,8 +51,6 @@ void cv::IntegralChannels::createHogBins(const cv::Mat gray, std::vector decimate(shrinkage); - cv::Mat df_dx, df_dy, mag, angle; cv::Sobel(gray, df_dx, CV_32F, 1, 0, 3, 0.125); cv::Sobel(gray, df_dy, CV_32F, 0, 1, 3, 0.125); @@ -121,13 +81,13 @@ void cv::IntegralChannels::createHogBins(const cv::Mat gray, std::vector decimate(shrinkage); - cv::Mat luv; cv::cvtColor(frame, luv, CV_BGR2Luv); @@ -148,7 +106,7 @@ void cv::IntegralChannels::createLuvBins(const cv::Mat frame, std::vectorscale - << " " - << levels[sc].relScale - << " [" << levels[sc].objSize.width - << " " << levels[sc].objSize.height << "] [" - << levels[sc].workRect.width << " " << levels[sc].workRect.height << "]" << std::endl; } } @@ -523,10 +513,7 @@ bool cv::SoftCascade::read( const cv::FileStorage& fs) filds = new Filds; Filds& flds = *filds; - if (!flds.fill(fs.getFirstTopLevelNode(), minScale, maxScale)) return false; - // flds.calcLevels(FRAME_WIDTH, FRAME_HEIGHT, scales); - - return true; + return flds.fill(fs.getFirstTopLevelNode(), minScale, maxScale); } void cv::SoftCascade::detectMultiScale(const Mat& image, const std::vector& /*rois*/, @@ -535,9 +522,6 @@ void cv::SoftCascade::detectMultiScale(const Mat& image, const std::vector