From cc300a69b1358e5c396c1535179500c37d4676cf Mon Sep 17 00:00:00 2001 From: "marina.kolpakova" Date: Fri, 28 Sep 2012 10:21:22 +0400 Subject: [PATCH] add perfomance test for CPU soft cascade --- .../objdetect/perf/perf_cascadeclassifier.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/objdetect/perf/perf_cascadeclassifier.cpp b/modules/objdetect/perf/perf_cascadeclassifier.cpp index 98007e45d..cb214154c 100644 --- a/modules/objdetect/perf/perf_cascadeclassifier.cpp +++ b/modules/objdetect/perf/perf_cascadeclassifier.cpp @@ -52,3 +52,26 @@ PERF_TEST_P(ImageName_MinSize, CascadeClassifierLBPFrontalFace, std::sort(faces.begin(), faces.end(), comparators::RectLess()); SANITY_CHECK(faces, 3.001 * faces.size()); } + +typedef std::tr1::tuple fixture; +typedef perf::TestBaseWithParam detect; + +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")))) +{ + cv::Mat colored = imread(getDataPath(get<1>(GetParam()))); + ASSERT_FALSE(colored.empty()); + + cv::SoftCascade cascade; + ASSERT_TRUE(cascade.load(getDataPath(get<0>(GetParam())))); + + std::vector rois, objectBoxes; + cascade.detectMultiScale(colored, rois, objectBoxes); + + TEST_CYCLE() + { + cascade.detectMultiScale(colored, rois, objectBoxes); + } + SANITY_CHECK(objectBoxes); +}