added Generalized Hough implementation
[profile/ivi/opencv.git] / modules / gpu / test / test_imgproc.cpp
index b723ded..13c8a1c 100644 (file)
@@ -1126,142 +1126,6 @@ INSTANTIATE_TEST_CASE_P(GPU_ImgProc, CornerMinEigen, testing::Combine(
     testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),\r
     testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));\r
 \r
-///////////////////////////////////////////////////////////////////////////////////////////////////////\r
-// HoughLines\r
-\r
-PARAM_TEST_CASE(HoughLines, cv::gpu::DeviceInfo, cv::Size, UseRoi)\r
-{\r
-    static void generateLines(cv::Mat& img)\r
-    {\r
-        img.setTo(cv::Scalar::all(0));\r
-\r
-        cv::line(img, cv::Point(20, 0), cv::Point(20, img.rows), cv::Scalar::all(255));\r
-        cv::line(img, cv::Point(0, 50), cv::Point(img.cols, 50), cv::Scalar::all(255));\r
-        cv::line(img, cv::Point(0, 0), cv::Point(img.cols, img.rows), cv::Scalar::all(255));\r
-        cv::line(img, cv::Point(img.cols, 0), cv::Point(0, img.rows), cv::Scalar::all(255));\r
-    }\r
-\r
-    static void drawLines(cv::Mat& dst, const std::vector<cv::Vec2f>& lines)\r
-    {\r
-        dst.setTo(cv::Scalar::all(0));\r
-\r
-        for (size_t i = 0; i < lines.size(); ++i)\r
-        {\r
-            float rho = lines[i][0], theta = lines[i][1];\r
-            cv::Point pt1, pt2;\r
-            double a = std::cos(theta), b = std::sin(theta);\r
-            double x0 = a*rho, y0 = b*rho;\r
-            pt1.x = cvRound(x0 + 1000*(-b));\r
-            pt1.y = cvRound(y0 + 1000*(a));\r
-            pt2.x = cvRound(x0 - 1000*(-b));\r
-            pt2.y = cvRound(y0 - 1000*(a));\r
-            cv::line(dst, pt1, pt2, cv::Scalar::all(255));\r
-        }\r
-    }\r
-};\r
-\r
-TEST_P(HoughLines, Accuracy)\r
-{\r
-    const cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
-    cv::gpu::setDevice(devInfo.deviceID());\r
-    const cv::Size size = GET_PARAM(1);\r
-    const bool useRoi = GET_PARAM(2);\r
-\r
-    const float rho = 1.0f;\r
-    const float theta = 1.5f * CV_PI / 180.0f;\r
-    const int threshold = 100;\r
-\r
-    cv::Mat src(size, CV_8UC1);\r
-    generateLines(src);\r
-\r
-    cv::gpu::GpuMat d_lines;\r
-    cv::gpu::HoughLines(loadMat(src, useRoi), d_lines, rho, theta, threshold);\r
-\r
-    std::vector<cv::Vec2f> lines;\r
-    cv::gpu::HoughLinesDownload(d_lines, lines);\r
-\r
-    cv::Mat dst(size, CV_8UC1);\r
-    drawLines(dst, lines);\r
-\r
-    ASSERT_MAT_NEAR(src, dst, 0.0);\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(GPU_ImgProc, HoughLines, testing::Combine(\r
-    ALL_DEVICES,\r
-    DIFFERENT_SIZES,\r
-    WHOLE_SUBMAT));\r
-\r
-///////////////////////////////////////////////////////////////////////////////////////////////////////\r
-// HoughCircles\r
-\r
-PARAM_TEST_CASE(HoughCircles, cv::gpu::DeviceInfo, cv::Size, UseRoi)\r
-{\r
-    static void drawCircles(cv::Mat& dst, const std::vector<cv::Vec3f>& circles, bool fill)\r
-    {\r
-        dst.setTo(cv::Scalar::all(0));\r
-\r
-        for (size_t i = 0; i < circles.size(); ++i)\r
-            cv::circle(dst, cv::Point2f(circles[i][0], circles[i][1]), (int)circles[i][2], cv::Scalar::all(255), fill ? -1 : 1);\r
-    }\r
-};\r
-\r
-TEST_P(HoughCircles, Accuracy)\r
-{\r
-    const cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
-    cv::gpu::setDevice(devInfo.deviceID());\r
-    const cv::Size size = GET_PARAM(1);\r
-    const bool useRoi = GET_PARAM(2);\r
-\r
-    const float dp = 2.0f;\r
-    const float minDist = 10.0f;\r
-    const int minRadius = 10;\r
-    const int maxRadius = 20;\r
-    const int cannyThreshold = 100;\r
-    const int votesThreshold = 20;\r
-\r
-    std::vector<cv::Vec3f> circles_gold(4);\r
-    circles_gold[0] = cv::Vec3i(20, 20, minRadius);\r
-    circles_gold[1] = cv::Vec3i(90, 87, minRadius + 3);\r
-    circles_gold[2] = cv::Vec3i(30, 70, minRadius + 8);\r
-    circles_gold[3] = cv::Vec3i(80, 10, maxRadius);\r
-\r
-    cv::Mat src(size, CV_8UC1);\r
-    drawCircles(src, circles_gold, true);\r
-\r
-    cv::gpu::GpuMat d_circles;\r
-    cv::gpu::HoughCircles(loadMat(src, useRoi), d_circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);\r
-\r
-    std::vector<cv::Vec3f> circles;\r
-    cv::gpu::HoughCirclesDownload(d_circles, circles);\r
-\r
-    ASSERT_FALSE(circles.empty());\r
-\r
-    for (size_t i = 0; i < circles.size(); ++i)\r
-    {\r
-        cv::Vec3f cur = circles[i];\r
-\r
-        bool found = false;\r
-\r
-        for (size_t j = 0; j < circles_gold.size(); ++j)\r
-        {\r
-            cv::Vec3f gold = circles_gold[j];\r
-\r
-            if (std::fabs(cur[0] - gold[0]) < minDist && std::fabs(cur[1] - gold[1]) < minDist && std::fabs(cur[2] - gold[2]) < minDist)\r
-            {\r
-                found = true;\r
-                break;\r
-            }\r
-        }\r
-\r
-        ASSERT_TRUE(found);\r
-    }\r
-}\r
-\r
-INSTANTIATE_TEST_CASE_P(GPU_ImgProc, HoughCircles, testing::Combine(\r
-    ALL_DEVICES,\r
-    DIFFERENT_SIZES,\r
-    WHOLE_SUBMAT));\r
-\r
 } // namespace\r
 \r
 #endif // HAVE_CUDA\r