From: Andrey Kamaev Date: Tue, 9 Oct 2012 11:28:10 +0000 (+0400) Subject: Add sanity checks to objdetect module perf tests X-Git-Tag: accepted/2.0/20130307.220821~364^2~93 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2ff0ed1fb0499f874f9c7d94f41e1a1534d7a82;p=profile%2Fivi%2Fopencv.git Add sanity checks to objdetect module perf tests --- diff --git a/modules/objdetect/perf/perf_cascadeclassifier.cpp b/modules/objdetect/perf/perf_cascadeclassifier.cpp index eff64fa..df8b5ae 100644 --- a/modules/objdetect/perf/perf_cascadeclassifier.cpp +++ b/modules/objdetect/perf/perf_cascadeclassifier.cpp @@ -38,17 +38,20 @@ PERF_TEST_P(ImageName_MinSize, CascadeClassifierLBPFrontalFace, if (img.empty()) FAIL() << "Can't load source image"; - vector res; + vector faces; equalizeHist(img, img); declare.in(img); while(next()) { - res.clear(); + faces.clear(); startTimer(); - cc.detectMultiScale(img, res, 1.1, 3, 0, minSize); + cc.detectMultiScale(img, faces, 1.1, 3, 0, minSize); stopTimer(); } + + std::sort(faces.begin(), faces.end(), comparators::RectLess()); + SANITY_CHECK(faces); } diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp index 44d98bc..449b434 100644 --- a/modules/ts/include/opencv2/ts/ts_perf.hpp +++ b/modules/ts/include/opencv2/ts/ts_perf.hpp @@ -473,10 +473,26 @@ int main(int argc, char **argv)\ #define TEST_CYCLE() for(; startTimer(), next(); stopTimer()) #define TEST_CYCLE_MULTIRUN(runsNum) for(declare.runs(runsNum); startTimer(), next(); stopTimer()) for(int r = 0; r < runsNum; ++r) -//flags namespace perf { -//GTEST_DECLARE_int32_(allowed_outliers); +namespace comparators +{ + +template +struct CV_EXPORTS RectLess_ +{ + bool operator()(const cv::Rect_& r1, const cv::Rect_& r2) const + { + return r1.x < r2.x + || (r1.x == r2.x && r1.y < r2.y) + || (r1.x == r2.x && r1.y == r2.y && r1.width < r2.width) + || (r1.x == r2.x && r1.y == r2.y && r1.width == r2.width && r1.height < r2.height); + } +}; + +typedef RectLess_ RectLess; + +} //namespace comparators } //namespace perf #endif //__OPENCV_TS_PERF_HPP__