fix compilation problem after rebase
authormarina.kolpakova <marina.kolpakova@itseez.com>
Sat, 3 Nov 2012 14:03:31 +0000 (18:03 +0400)
committermarina.kolpakova <marina.kolpakova@itseez.com>
Sat, 10 Nov 2012 01:12:01 +0000 (05:12 +0400)
modules/gpu/perf/perf_objdetect.cpp
modules/gpu/perf/perf_softcascade.cpp

index ced8ee1..6d040ac 100644 (file)
@@ -89,244 +89,6 @@ PERF_TEST_P(HOG, CalTech, Values<string>("gpu/caltech/image_00000009_0.png", "gp
     SANITY_CHECK(found_locations);
 }
 
-//================================================= ICF SoftCascade =================================================//
-
-typedef pair<string, string> pair_string;
-DEF_PARAM_TEST_1(SoftCascade, pair_string);
-
-
-// struct SoftCascadeTest : public perf::TestBaseWithParam<roi_fixture_t>
-// {
-//     typedef cv::gpu::SoftCascade::Detection detection_t;
-//     static cv::Rect getFromTable(int idx)
-//     {
-//         static const cv::Rect rois[] =
-//         {
-//             cv::Rect( 65,  20,  35, 80),
-//             cv::Rect( 95,  35,  45, 40),
-//             cv::Rect( 45,  35,  45, 40),
-//             cv::Rect( 25,  27,  50, 45),
-//             cv::Rect(100,  50,  45, 40),
-
-//             cv::Rect( 60,  30,  45, 40),
-//             cv::Rect( 40,  55,  50, 40),
-//             cv::Rect( 48,  37,  72, 80),
-//             cv::Rect( 48,  32,  85, 58),
-//             cv::Rect( 48,   0,  32, 27)
-//         };
-
-//         return rois[idx];
-//     }
-
-//     static std::string itoa(long i)
-//     {
-//         static char s[65];
-//         sprintf(s, "%ld", i);
-//         return std::string(s);
-//     }
-
-//     static std::string getImageName(int level)
-//     {
-//         time_t rawtime;
-//         struct tm * timeinfo;
-//         char buffer [80];
-
-//         time ( &rawtime );
-//         timeinfo = localtime ( &rawtime );
-
-//         strftime (buffer,80,"%Y-%m-%d--%H-%M-%S",timeinfo);
-//         return "gpu_rec_level_" + itoa(level)+ "_" + std::string(buffer) + ".png";
-//     }
-
-//     static void print(std::ostream &out, const detection_t& d)
-//     {
-//         out << "\x1b[32m[ detection]\x1b[0m ("
-//             << std::setw(4)  << d.x
-//             << " "
-//             << std::setw(4)  << d.y
-//             << ") ("
-//             << std::setw(4)  << d.w
-//             << " "
-//             << std::setw(4)  << d.h
-//             << ") "
-//             << std::setw(12) << d.confidence
-//             <<  std::endl;
-//     }
-
-//     static void printTotal(std::ostream &out, int detbytes)
-//     {
-//         out << "\x1b[32m[          ]\x1b[0m Total detections " << (detbytes / sizeof(detection_t)) << std::endl;
-//     }
-
-//     static void writeResult(const cv::Mat& result, const int level)
-//     {
-//         std::string path = cv::tempfile(getImageName(level).c_str());
-//         cv::imwrite(path, result);
-//         std::cout << "\x1b[32m" << "[          ]" << std::endl << "[ stored in]"<< "\x1b[0m" << path << std::endl;
-//     }
-// };
-
-typedef std::tr1::tuple<std::string, std::string> fixture_t;
-typedef perf::TestBaseWithParam<fixture_t> SoftCascadeTest;
-
-PERF_TEST_P(SoftCascadeTest, detect,
-    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"))))
-{
-    if (runOnGpu)
-    {
-        cv::Mat cpu = readImage (GET_PARAM(1));
-        ASSERT_FALSE(cpu.empty());
-        cv::gpu::GpuMat colored(cpu);
-
-        cv::gpu::SoftCascade cascade;
-        ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath(GET_PARAM(0))));
-
-        cv::gpu::GpuMat objectBoxes(1, 16384, CV_8UC1), rois(cascade.getRoiSize(), CV_8UC1), trois;
-        rois.setTo(1);
-        cv::gpu::transpose(rois, trois);
-
-        cv::gpu::GpuMat curr = objectBoxes;
-        cascade.detectMultiScale(colored, trois, curr);
-
-        TEST_CYCLE()
-        {
-            curr = objectBoxes;
-            cascade.detectMultiScale(colored, trois, curr);
-        }
-    }
-    else
-    {
-        cv::Mat colored = readImage(GET_PARAM(1));
-        ASSERT_FALSE(colored.empty());
-
-        cv::SoftCascade cascade;
-        ASSERT_TRUE(cascade.load(getDataPath(GET_PARAM(0))));
-
-        std::vector<cv::Rect> rois;
-
-        typedef cv::SoftCascade::Detection Detection;
-        std::vector<Detection>objectBoxes;
-        cascade.detectMultiScale(colored, rois, objectBoxes);
-
-        TEST_CYCLE()
-        {
-            cascade.detectMultiScale(colored, rois, objectBoxes);
-        }
-    }
-}
-
-static cv::Rect getFromTable(int idx)
-{
-    static const cv::Rect rois[] =
-    {
-        cv::Rect( 65,  20,  35, 80),
-        cv::Rect( 95,  35,  45, 40),
-        cv::Rect( 45,  35,  45, 40),
-        cv::Rect( 25,  27,  50, 45),
-        cv::Rect(100,  50,  45, 40),
-
-        cv::Rect( 60,  30,  45, 40),
-        cv::Rect( 40,  55,  50, 40),
-        cv::Rect( 48,  37,  72, 80),
-        cv::Rect( 48,  32,  85, 58),
-        cv::Rect( 48,   0,  32, 27)
-    };
-
-    return rois[idx];
-}
-
-typedef std::tr1::tuple<std::string, std::string, int> roi_fixture_t;
-typedef perf::TestBaseWithParam<roi_fixture_t> SoftCascadeTestRoi;
-
-PERF_TEST_P(SoftCascadeTestRoi, detectInRoi,
-    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")),
-        testing::Range(0, 5)))
-{
-    if (runOnGpu)
-    {
-        cv::Mat cpu = readImage (GET_PARAM(1));
-        ASSERT_FALSE(cpu.empty());
-        cv::gpu::GpuMat colored(cpu);
-
-        cv::gpu::SoftCascade cascade;
-        ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath(GET_PARAM(0))));
-
-        cv::gpu::GpuMat objectBoxes(1, 16384 * 20, CV_8UC1), rois(cascade.getRoiSize(), CV_8UC1);
-        rois.setTo(0);
-
-        int nroi = GET_PARAM(2);
-        cv::RNG rng;
-        for (int i = 0; i < nroi; ++i)
-        {
-            cv::Rect r = getFromTable(rng(10));
-            cv::gpu::GpuMat sub(rois, r);
-            sub.setTo(1);
-        }
-
-        cv::gpu::GpuMat trois;
-        cv::gpu::transpose(rois, trois);
-
-        cv::gpu::GpuMat curr = objectBoxes;
-        cascade.detectMultiScale(colored, trois, curr);
-
-        TEST_CYCLE()
-        {
-            curr = objectBoxes;
-            cascade.detectMultiScale(colored, trois, curr);
-        }
-    }
-    else
-    {
-        FAIL();
-    }
-}
-
-PERF_TEST_P(SoftCascadeTestRoi, detectEachRoi,
-    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")),
-        testing::Range(0, 10)))
-{
-    if (runOnGpu)
-    {
-        cv::Mat cpu = readImage (GET_PARAM(1));
-        ASSERT_FALSE(cpu.empty());
-        cv::gpu::GpuMat colored(cpu);
-
-        cv::gpu::SoftCascade cascade;
-        ASSERT_TRUE(cascade.load(perf::TestBase::getDataPath(GET_PARAM(0))));
-
-        cv::gpu::GpuMat objectBoxes(1, 16384 * 20, CV_8UC1), rois(cascade.getRoiSize(), CV_8UC1);
-        rois.setTo(0);
-
-        int idx = GET_PARAM(2);
-        cv::Rect r = getFromTable(idx);
-        cv::gpu::GpuMat sub(rois, r);
-        sub.setTo(1);
-
-        cv::gpu::GpuMat curr = objectBoxes;
-        cv::gpu::GpuMat trois;
-        cv::gpu::transpose(rois, trois);
-
-        cascade.detectMultiScale(colored, trois, curr);
-
-        TEST_CYCLE()
-        {
-            curr = objectBoxes;
-            cascade.detectMultiScale(colored, rois, curr);
-        }
-    }
-    else
-    {
-        FAIL();
-    }
-}
-
-
 ///////////////////////////////////////////////////////////////
 // HaarClassifier
 
@@ -383,7 +145,7 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier,
     cv::Mat img = readImage(GetParam().first, cv::IMREAD_GRAYSCALE);
     ASSERT_FALSE(img.empty());
 
-    if (runOnGpu)
+    if (PERF_RUN_GPU())
     {
         cv::gpu::CascadeClassifier_GPU d_cascade;
         ASSERT_TRUE(d_cascade.load(perf::TestBase::getDataPath(GetParam().second)));
@@ -418,4 +180,4 @@ PERF_TEST_P(ImageAndCascade, ObjDetect_LBPClassifier,
     }
 }
 
-} // namespace
+} // namespace
\ No newline at end of file
index 582561c..9b53b2e 100644 (file)
@@ -34,17 +34,17 @@ namespace {
             else return a.h < b.h;
         }
 
-        bool operator()(const cv::SoftCascade::Detection& a,
-            const cv::SoftCascade::Detection& b) const
-        {
-            const cv::Rect& ra = a.rect;
-            const cv::Rect& rb = b.rect;
-
-            if (ra.x != rb.x) return ra.x < rb.x;
-            else if (ra.y != rb.y) return ra.y < rb.y;
-            else if (ra.width != rb.width) return ra.width < rb.width;
-            else return ra.height < rb.height;
-        }
+        // bool operator()(const cv::SoftCascade::Detection& a,
+        //     const cv::SoftCascade::Detection& b) const
+        // {
+        //     const cv::Rect& ra = a.rect;
+        //     const cv::Rect& rb = b.rect;
+
+        //     if (ra.x != rb.x) return ra.x < rb.x;
+        //     else if (ra.y != rb.y) return ra.y < rb.y;
+        //     else if (ra.width != rb.width) return ra.width < rb.width;
+        //     else return ra.height < rb.height;
+        // }
     };
 
     cv::Mat sortDetections(cv::gpu::GpuMat& objects)
@@ -95,28 +95,30 @@ RUN_GPU(SoftCascadeTest, detect)
     SANITY_CHECK(sortDetections(curr));
 }
 
-RUN_CPU(SoftCascadeTest, detect)
-{
-    cv::Mat colored = readImage(GET_PARAM(1));
-    ASSERT_FALSE(colored.empty());
+NO_CPU(SoftCascadeTest, detect)
 
-    cv::SoftCascade cascade;
-    ASSERT_TRUE(cascade.load(getDataPath(GET_PARAM(0))));
+// RUN_CPU(SoftCascadeTest, detect)
+// {
+//     cv::Mat colored = readImage(GET_PARAM(1));
+//     ASSERT_FALSE(colored.empty());
 
-    std::vector<cv::Rect> rois;
+//     cv::SoftCascade cascade;
+//     ASSERT_TRUE(cascade.load(getDataPath(GET_PARAM(0))));
 
-    typedef cv::SoftCascade::Detection Detection;
-    std::vector<Detection>objects;
-    cascade.detectMultiScale(colored, rois, objects);
+//     std::vector<cv::Rect> rois;
 
-    TEST_CYCLE()
-    {
-        cascade.detectMultiScale(colored, rois, objects);
-    }
+//     typedef cv::SoftCascade::Detection Detection;
+//     std::vector<Detection>objects;
+//     cascade.detectMultiScale(colored, rois, objects);
 
-    std::sort(objects.begin(), objects.end(), DetectionLess());
-    SANITY_CHECK(objects);
-}
+//     TEST_CYCLE()
+//     {
+//         cascade.detectMultiScale(colored, rois, objects);
+//     }
+
+//     std::sort(objects.begin(), objects.end(), DetectionLess());
+//     SANITY_CHECK(objects);
+// }
 
 static cv::Rect getFromTable(int idx)
 {