#include "perf_precomp.hpp"\r
\r
-#ifdef HAVE_CUDA\r
+using namespace std;\r
+using namespace testing;\r
+\r
+namespace {\r
\r
//////////////////////////////////////////////////////////////////////\r
// Remap\r
\r
-GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation, BorderMode)\r
+enum{HALF_SIZE=0, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH};\r
+CV_ENUM(RemapMode, HALF_SIZE, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH);\r
+#define ALL_REMAP_MODES ValuesIn(RemapMode::all())\r
+\r
+void generateMap(cv::Mat& map_x, cv::Mat& map_y, int remapMode)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ for (int j = 0; j < map_x.rows; ++j)\r
+ {\r
+ for (int i = 0; i < map_x.cols; ++i)\r
+ {\r
+ switch (remapMode)\r
+ {\r
+ case HALF_SIZE:\r
+ if (i > map_x.cols*0.25 && i < map_x.cols*0.75 && j > map_x.rows*0.25 && j < map_x.rows*0.75)\r
+ {\r
+ map_x.at<float>(j,i) = 2.f * (i - map_x.cols * 0.25f) + 0.5f;\r
+ map_y.at<float>(j,i) = 2.f * (j - map_x.rows * 0.25f) + 0.5f;\r
+ }\r
+ else\r
+ {\r
+ map_x.at<float>(j,i) = 0.f;\r
+ map_y.at<float>(j,i) = 0.f;\r
+ }\r
+ break;\r
+ case UPSIDE_DOWN:\r
+ map_x.at<float>(j,i) = static_cast<float>(i);\r
+ map_y.at<float>(j,i) = static_cast<float>(map_x.rows - j);\r
+ break;\r
+ case REFLECTION_X:\r
+ map_x.at<float>(j,i) = static_cast<float>(map_x.cols - i);\r
+ map_y.at<float>(j,i) = static_cast<float>(j);\r
+ break;\r
+ case REFLECTION_BOTH:\r
+ map_x.at<float>(j,i) = static_cast<float>(map_x.cols - i);\r
+ map_y.at<float>(j,i) = static_cast<float>(map_x.rows - j);\r
+ break;\r
+ } // end of switch\r
+ }\r
+ }\r
+}\r
+\r
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border_Mode, cv::Size, MatDepth, int, Interpolation, BorderMode, RemapMode);\r
+\r
+PERF_TEST_P(Sz_Depth_Cn_Inter_Border_Mode, ImgProc_Remap, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4,\r
+ Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
+ ALL_BORDER_MODES,\r
+ ALL_REMAP_MODES))\r
+{\r
+ declare.time(20.0);\r
+\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
int interpolation = GET_PARAM(3);\r
int borderMode = GET_PARAM(4);\r
+ int remapMode = GET_PARAM(5);\r
+\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- cv::Mat src_host(size, type);\r
- cv::Mat xmap_host(size, CV_32FC1);\r
- cv::Mat ymap_host(size, CV_32FC1);\r
+ cv::Mat xmap(size, CV_32FC1);\r
+ cv::Mat ymap(size, CV_32FC1);\r
\r
- declare.in(src_host, xmap_host, ymap_host, WARMUP_RNG);\r
+ generateMap(xmap, ymap, remapMode);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat xmap(xmap_host);\r
- cv::gpu::GpuMat ymap(ymap_host);\r
- cv::gpu::GpuMat dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_xmap(xmap);\r
+ cv::gpu::GpuMat d_ymap(ymap);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- declare.time(3.0);\r
+ cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode);\r
+ cv::Mat dst;\r
+\r
+ cv::remap(src, dst, xmap, ymap, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::remap(src, dst, xmap, ymap, interpolation, borderMode);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Remap, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_32FC1), \r
- testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC),\r
- testing::Values((int) cv::BORDER_REFLECT101, (int) cv::BORDER_REPLICATE, (int) cv::BORDER_CONSTANT)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// MeanShiftFiltering\r
+// Resize\r
\r
-GPU_PERF_TEST_1(MeanShiftFiltering, cv::gpu::DeviceInfo)\r
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Scale, cv::Size, MatDepth, int, Interpolation, double);\r
+\r
+PERF_TEST_P(Sz_Depth_Cn_Inter_Scale, ImgProc_Resize, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4,\r
+ ALL_INTERPOLATIONS,\r
+ Values(0.5, 0.3, 2.0)))\r
{\r
- cv::gpu::DeviceInfo devInfo = GetParam();\r
+ declare.time(20.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+ int interpolation = GET_PARAM(3);\r
+ double f = GET_PARAM(4);\r
\r
- cv::Mat img = readImage("gpu/meanshift/cones.png");\r
- ASSERT_FALSE(img.empty());\r
- \r
- cv::Mat rgba;\r
- cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::gpu::GpuMat src(rgba);\r
- cv::gpu::GpuMat dst;\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- declare.time(5.0);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::meanShiftFiltering(src, dst, 50, 50);\r
+ cv::Mat dst;\r
+\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftFiltering, ALL_DEVICES);\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// MeanShiftProc\r
+// ResizeArea\r
+\r
+DEF_PARAM_TEST(Sz_Depth_Cn_Scale, cv::Size, MatDepth, int, double);\r
\r
-GPU_PERF_TEST_1(MeanShiftProc, cv::gpu::DeviceInfo)\r
+PERF_TEST_P(Sz_Depth_Cn_Scale, ImgProc_ResizeArea, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4,\r
+ Values(0.2, 0.1, 0.05)))\r
{\r
- cv::gpu::DeviceInfo devInfo = GetParam();\r
+ declare.time(1.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+ int interpolation = cv::INTER_AREA;\r
+ double f = GET_PARAM(3);\r
\r
- cv::Mat img = readImage("gpu/meanshift/cones.png");\r
- ASSERT_FALSE(img.empty());\r
- \r
- cv::Mat rgba;\r
- cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::gpu::GpuMat src(rgba);\r
- cv::gpu::GpuMat dstr;\r
- cv::gpu::GpuMat dstsp;\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- declare.time(5.0);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);\r
+ cv::Mat dst;\r
+\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::resize(src, dst, cv::Size(), f, f, interpolation);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftProc, ALL_DEVICES);\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// MeanShiftSegmentation\r
+// WarpAffine\r
\r
-GPU_PERF_TEST_1(MeanShiftSegmentation, cv::gpu::DeviceInfo)\r
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border, cv::Size, MatDepth, int, Interpolation, BorderMode);\r
+\r
+PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpAffine, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4,\r
+ Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
+ ALL_BORDER_MODES))\r
{\r
- cv::gpu::DeviceInfo devInfo = GetParam();\r
+ declare.time(20.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+ int interpolation = GET_PARAM(3);\r
+ int borderMode = GET_PARAM(4);\r
\r
- cv::Mat img = readImage("gpu/meanshift/cones.png");\r
- ASSERT_FALSE(img.empty());\r
- \r
- cv::Mat rgba;\r
- cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::gpu::GpuMat src(rgba);\r
- cv::Mat dst;\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- declare.time(5.0);\r
+ const double aplha = CV_PI / 4;\r
+ double mat[2][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},\r
+ {std::sin(aplha), std::cos(aplha), 0}};\r
+ cv::Mat M(2, 3, CV_64F, (void*) mat);\r
\r
- TEST_CYCLE(100)\r
+ if (runOnGpu)\r
{\r
- meanShiftSegmentation(src, dst, 10, 10, 20);\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);\r
+ }\r
}\r
-}\r
+ else\r
+ {\r
+ cv::Mat dst;\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftSegmentation, ALL_DEVICES);\r
+ cv::warpAffine(src, dst, M, size, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::warpAffine(src, dst, M, size, interpolation, borderMode);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
-// DrawColorDisp\r
+// WarpPerspective\r
\r
-GPU_PERF_TEST(DrawColorDisp, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpPerspective, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4,\r
+ Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),\r
+ ALL_BORDER_MODES))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ declare.time(20.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+ int interpolation = GET_PARAM(3);\r
+ int borderMode = GET_PARAM(4);\r
\r
- cv::Mat src_host(size, type);\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- fill(src_host, 0, 255);\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ const double aplha = CV_PI / 4;\r
+ double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},\r
+ {std::sin(aplha), std::cos(aplha), 0},\r
+ {0.0, 0.0, 1.0}};\r
+ cv::Mat M(3, 3, CV_64F, (void*) mat);\r
\r
- TEST_CYCLE(100)\r
+ if (runOnGpu)\r
{\r
- cv::gpu::drawColorDisp(src, dst, 255);\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);\r
+ }\r
}\r
-}\r
+ else\r
+ {\r
+ cv::Mat dst;\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, DrawColorDisp, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_16SC1)));\r
+ cv::warpPerspective(src, dst, M, size, interpolation, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::warpPerspective(src, dst, M, size, interpolation, borderMode);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
-// ReprojectImageTo3D\r
+// CopyMakeBorder\r
+\r
+DEF_PARAM_TEST(Sz_Depth_Cn_Border, cv::Size, MatDepth, int, BorderMode);\r
\r
-GPU_PERF_TEST(ReprojectImageTo3D, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz_Depth_Cn_Border, ImgProc_CopyMakeBorder, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4,\r
+ ALL_BORDER_MODES))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+ int borderMode = GET_PARAM(3);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::Mat src_host(size, type);\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::reprojectImageTo3D(src, dst, cv::Mat::ones(4, 4, CV_32FC1));\r
+ cv::Mat dst;\r
+\r
+ cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, ReprojectImageTo3D, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_16SC1)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// CvtColor\r
+// Threshold\r
\r
-GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, perf::MatType, CvtColorInfo)\r
-{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- CvtColorInfo info = GET_PARAM(3);\r
+CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)\r
+#define ALL_THRESH_OPS ValuesIn(ThreshOp::all())\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+DEF_PARAM_TEST(Sz_Depth_Op, cv::Size, MatDepth, ThreshOp);\r
\r
- cv::Mat src_host(size, CV_MAKETYPE(type, info.scn));\r
+PERF_TEST_P(Sz_Depth_Op, ImgProc_Threshold, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F, CV_64F),\r
+ ALL_THRESH_OPS))\r
+{\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int threshOp = GET_PARAM(2);\r
+\r
+ cv::Mat src(size, depth);\r
+ fillRandom(src);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst(size, CV_MAKETYPE(type, info.dcn));\r
+ cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::cvtColor(src, dst, info.code, info.dcn);\r
+ cv::Mat dst;\r
+\r
+ cv::threshold(src, dst, 100.0, 255.0, threshOp);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::threshold(src, dst, 100.0, 255.0, threshOp);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_16UC1, CV_32FC1),\r
- testing::Values(\r
- CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA), CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY), CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA), \r
- CvtColorInfo(4, 4, cv::COLOR_BGR2XYZ), CvtColorInfo(4, 4, cv::COLOR_BGR2YCrCb), CvtColorInfo(4, 4, cv::COLOR_YCrCb2BGR), \r
- CvtColorInfo(4, 4, cv::COLOR_BGR2HSV), CvtColorInfo(4, 4, cv::COLOR_HSV2BGR))));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// Threshold\r
+// Integral\r
\r
-GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz, ImgProc_Integral, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ cv::Size size = GetParam();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src(size, CV_8UC1);\r
+ fillRandom(src);\r
\r
- cv::Mat src_host(size, type);\r
-\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst(size, type);\r
+ cv::gpu::integralBuffered(d_src, d_dst, d_buf);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::integralBuffered(d_src, d_dst, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::threshold(src, dst, 100.0, 255.0, cv::THRESH_BINARY);\r
+ cv::Mat dst;\r
+\r
+ cv::integral(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::integral(src, dst);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Threshold, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_16UC1, CV_32FC1)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// Resize\r
+// IntegralSqr\r
\r
-GPU_PERF_TEST(Resize, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation, double)\r
+PERF_TEST_P(Sz, ImgProc_IntegralSqr, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
- double f = GET_PARAM(4);\r
+ cv::Size size = GetParam();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src(size, CV_8UC1);\r
+ fillRandom(src);\r
\r
- cv::Mat src_host(size, type);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::gpu::sqrIntegral(d_src, d_dst);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::sqrIntegral(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
+ }\r
+}\r
\r
- declare.time(1.0);\r
+//////////////////////////////////////////////////////////////////////\r
+// HistEvenC1\r
+\r
+PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC1, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S)))\r
+{\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
\r
- TEST_CYCLE(100)\r
+ cv::Mat src(size, depth);\r
+ fillRandom(src);\r
+\r
+ if (runOnGpu)\r
{\r
- cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_hist;\r
+ cv::gpu::GpuMat d_buf;\r
+\r
+ cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);\r
+ }\r
}\r
-}\r
+ else\r
+ {\r
+ int hbins = 30;\r
+ float hranges[] = {0.0f, 180.0f};\r
+ int histSize[] = {hbins};\r
+ const float* ranges[] = {hranges};\r
+ int channels[] = {0};\r
+\r
+ cv::Mat hist;\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(\r
- ALL_DEVICES, \r
- testing::Values(perf::szSXGA, perf::sz1080p), \r
- testing::Values(CV_8UC1, CV_8UC4, CV_16UC1, CV_32FC1),\r
- testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC),\r
- testing::Values(0.5, 2.0)));\r
+ cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
-// WarpAffine\r
+// HistEvenC4\r
\r
-GPU_PERF_TEST(WarpAffine, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation)\r
+PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC4, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S)))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
-\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
\r
- cv::Mat src_host(size, type);\r
+ cv::Mat src(size, CV_MAKE_TYPE(depth, 4));\r
+ fillRandom(src);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ int histSize[] = {30, 30, 30, 30};\r
+ int lowerLevel[] = {0, 0, 0, 0};\r
+ int upperLevel[] = {180, 180, 180, 180};\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_hist[4];\r
+ cv::gpu::GpuMat d_buf;\r
\r
- double reflect[2][3] = { {-1, 0, 0},\r
- { 0, -1, 0}};\r
- reflect[0][2] = size.width;\r
- reflect[1][2] = size.height;\r
- cv::Mat M(2, 3, CV_64F, (void*) reflect); \r
+ cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::warpAffine(src, dst, M, size, interpolation);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, WarpAffine, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),\r
- testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// WarpPerspective\r
+// CalcHist\r
\r
-GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation)\r
+PERF_TEST_P(Sz, ImgProc_CalcHist, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
+ cv::Size size = GetParam();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src(size, CV_8UC1);\r
+ fillRandom(src);\r
\r
- cv::Mat src_host(size, type);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_hist;\r
+ cv::gpu::GpuMat d_buf;\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::gpu::calcHist(d_src, d_hist, d_buf);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::calcHist(d_src, d_hist, d_buf);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
+ }\r
+}\r
\r
- double reflect[3][3] = { {-1, 0, 0},\r
- { 0, -1, 0},\r
- { 0, 0, 1}};\r
- reflect[0][2] = size.width;\r
- reflect[1][2] = size.height;\r
- cv::Mat M(3, 3, CV_64F, (void*)reflect); \r
+//////////////////////////////////////////////////////////////////////\r
+// EqualizeHist\r
\r
- TEST_CYCLE(100)\r
+PERF_TEST_P(Sz, ImgProc_EqualizeHist, GPU_TYPICAL_MAT_SIZES)\r
+{\r
+ cv::Size size = GetParam();\r
+\r
+ cv::Mat src(size, CV_8UC1);\r
+ fillRandom(src);\r
+\r
+ if (runOnGpu)\r
{\r
- cv::gpu::warpPerspective(src, dst, M, size, interpolation);\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_hist;\r
+ cv::gpu::GpuMat d_buf;\r
+\r
+ cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);\r
+ }\r
}\r
-}\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::equalizeHist(src, dst);\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, WarpPerspective, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),\r
- testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));\r
+ TEST_CYCLE()\r
+ {\r
+ cv::equalizeHist(src, dst);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
-// BuildWarpPlaneMaps\r
+// ColumnSum\r
\r
-GPU_PERF_TEST(BuildWarpPlaneMaps, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Sz, ImgProc_ColumnSum, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GetParam();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src(size, CV_32FC1);\r
+ fillRandom(src);\r
\r
- cv::gpu::GpuMat map_x;\r
- cv::gpu::GpuMat map_y;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::columnSum(d_src, d_dst);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::columnSum(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), cv::Mat::eye(3, 3, CV_32FC1), \r
- cv::Mat::ones(3, 3, CV_32FC1), cv::Mat::zeros(1, 3, CV_32F), 1.0, map_x, map_y);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpPlaneMaps, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// BuildWarpCylindricalMaps\r
+// Canny\r
\r
-GPU_PERF_TEST(BuildWarpCylindricalMaps, cv::gpu::DeviceInfo, cv::Size)\r
+DEF_PARAM_TEST(Image_AppertureSz_L2gradient, string, int, bool);\r
+\r
+PERF_TEST_P(Image_AppertureSz_L2gradient, ImgProc_Canny, Combine(\r
+ Values("perf/800x600.jpg", "perf/1280x1024.jpg", "perf/1680x1050.jpg"),\r
+ Values(3, 5),\r
+ Bool()))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ string fileName = GET_PARAM(0);\r
+ int apperture_size = GET_PARAM(1);\r
+ bool useL2gradient = GET_PARAM(2);\r
+\r
+ cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE);\r
+ ASSERT_FALSE(image.empty());\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image(image);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::CannyBuf d_buf;\r
\r
- cv::gpu::GpuMat map_x;\r
- cv::gpu::GpuMat map_y;\r
+ cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), cv::Mat::eye(3, 3, CV_32FC1),\r
- cv::Mat::ones(3, 3, CV_32FC1), 1.0, map_x, map_y);\r
+ cv::Mat dst;\r
+\r
+ cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpCylindricalMaps, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// BuildWarpSphericalMaps\r
+// MeanShiftFiltering\r
+\r
+DEF_PARAM_TEST_1(Image, string);\r
\r
-GPU_PERF_TEST(BuildWarpSphericalMaps, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, Values<string>("gpu/meanshift/cones.png"))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ declare.time(15.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat img = readImage(GetParam());\r
+ ASSERT_FALSE(img.empty());\r
\r
- cv::gpu::GpuMat map_x;\r
- cv::gpu::GpuMat map_y;\r
+ cv::Mat rgba;\r
+ cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
\r
- TEST_CYCLE(100)\r
+ if (runOnGpu)\r
{\r
- cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), cv::Mat::eye(3, 3, CV_32FC1),\r
- cv::Mat::ones(3, 3, CV_32FC1), 1.0, map_x, map_y);\r
+ cv::gpu::GpuMat d_src(rgba);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);\r
+ }\r
}\r
-}\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::pyrMeanShiftFiltering(img, dst, 50, 50);\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpSphericalMaps, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
+ TEST_CYCLE()\r
+ {\r
+ cv::pyrMeanShiftFiltering(img, dst, 50, 50);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
-// Rotate\r
+// MeanShiftProc\r
\r
-GPU_PERF_TEST(Rotate, cv::gpu::DeviceInfo, cv::Size, perf::MatType, Interpolation)\r
+PERF_TEST_P(Image, ImgProc_MeanShiftProc, Values<string>("gpu/meanshift/cones.png"))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int interpolation = GET_PARAM(3);\r
+ declare.time(5.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat img = readImage(GetParam());\r
+ ASSERT_FALSE(img.empty());\r
\r
- cv::Mat src_host(size, type);\r
+ cv::Mat rgba;\r
+ cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(rgba);\r
+ cv::gpu::GpuMat d_dstr;\r
+ cv::gpu::GpuMat d_dstsp;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Rotate, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4),\r
- testing::Values((int) cv::INTER_NEAREST, (int) cv::INTER_LINEAR, (int) cv::INTER_CUBIC)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// CopyMakeBorder\r
+// MeanShiftSegmentation\r
\r
-GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, perf::MatType, BorderMode)\r
+PERF_TEST_P(Image, ImgProc_MeanShiftSegmentation, Values<string>("gpu/meanshift/cones.png"))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
- int borderType = GET_PARAM(3);\r
+ declare.time(5.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat img = readImage(GetParam());\r
+ ASSERT_FALSE(img.empty());\r
\r
- cv::Mat src_host(size, type);\r
+ cv::Mat rgba;\r
+ cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::Mat dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(rgba);\r
\r
- TEST_CYCLE(100)\r
+ cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CopyMakeBorder, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),\r
- testing::Values((int) cv::BORDER_REPLICATE, (int) cv::BORDER_REFLECT, (int) cv::BORDER_WRAP, (int) cv::BORDER_CONSTANT)));\r
+//////////////////////////////////////////////////////////////////////\r
+// BlendLinear\r
+\r
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_BlendLinear, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_32F), GPU_CHANNELS_1_3_4))\r
+{\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
+\r
+ cv::Mat img1(size, type);\r
+ fillRandom(img1);\r
+\r
+ cv::Mat img2(size, type);\r
+ fillRandom(img2);\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_img1(img1);\r
+ cv::gpu::GpuMat d_img2(img2);\r
+ cv::gpu::GpuMat d_weights1(size, CV_32FC1, cv::Scalar::all(0.5));\r
+ cv::gpu::GpuMat d_weights2(size, CV_32FC1, cv::Scalar::all(0.5));\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
-// Integral\r
+// Convolve\r
+\r
+DEF_PARAM_TEST(Sz_KernelSz_Ccorr, cv::Size, int, bool);\r
\r
-GPU_PERF_TEST(Integral, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, Combine(GPU_TYPICAL_MAT_SIZES, Values(17, 27, 32, 64), Bool()))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ declare.time(10.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Size size = GET_PARAM(0);\r
+ int templ_size = GET_PARAM(1);\r
+ bool ccorr = GET_PARAM(2);\r
\r
- cv::Mat src_host(size, CV_8UC1);\r
+ cv::Mat image(size, CV_32FC1);\r
+ image.setTo(1.0);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::Mat templ(templ_size, templ_size, CV_32FC1);\r
+ templ.setTo(1.0);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
- cv::gpu::GpuMat buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image = cv::gpu::createContinuous(size, CV_32FC1);\r
+ d_image.upload(image);\r
\r
- TEST_CYCLE(100)\r
+ cv::gpu::GpuMat d_templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);\r
+ d_templ.upload(templ);\r
+\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::ConvolveBuf d_buf;\r
+\r
+ cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::integralBuffered(src, dst, buf);\r
+ ASSERT_FALSE(ccorr);\r
+\r
+ cv::Mat dst;\r
+\r
+ cv::filter2D(image, dst, image.depth(), templ);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::filter2D(image, dst, image.depth(), templ);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
+////////////////////////////////////////////////////////////////////////////////\r
+// MatchTemplate8U\r
\r
-//////////////////////////////////////////////////////////////////////\r
-// IntegralBoth\r
+CV_ENUM(TemplateMethod, cv::TM_SQDIFF, cv::TM_SQDIFF_NORMED, cv::TM_CCORR, cv::TM_CCORR_NORMED, cv::TM_CCOEFF, cv::TM_CCOEFF_NORMED)\r
+#define ALL_TEMPLATE_METHODS ValuesIn(TemplateMethod::all())\r
\r
-GPU_PERF_TEST(IntegralBoth, cv::gpu::DeviceInfo, cv::Size)\r
+DEF_PARAM_TEST(Sz_TemplateSz_Cn_Method, cv::Size, cv::Size, int, TemplateMethod);\r
+\r
+PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate8U, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)),\r
+ GPU_CHANNELS_1_3_4,\r
+ ALL_TEMPLATE_METHODS))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GET_PARAM(0);\r
+ cv::Size templ_size = GET_PARAM(1);\r
+ int cn = GET_PARAM(2);\r
+ int method = GET_PARAM(3);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat image(size, CV_MAKE_TYPE(CV_8U, cn));\r
+ fillRandom(image);\r
\r
- cv::Mat src_host(size, CV_8UC1);\r
+ cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_8U, cn));\r
+ fillRandom(templ);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image(image);\r
+ cv::gpu::GpuMat d_templ(templ);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat sum, sqsum;\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::integral(src, sum, sqsum);\r
+ cv::Mat dst;\r
+\r
+ cv::matchTemplate(image, templ, dst, method);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::matchTemplate(image, templ, dst, method);\r
+ }\r
}\r
-}\r
+};\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+// MatchTemplate32F\r
+\r
+PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate32F, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)),\r
+ GPU_CHANNELS_1_3_4,\r
+ Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR))))\r
+{\r
+ cv::Size size = GET_PARAM(0);\r
+ cv::Size templ_size = GET_PARAM(1);\r
+ int cn = GET_PARAM(2);\r
+ int method = GET_PARAM(3);\r
+\r
+ cv::Mat image(size, CV_MAKE_TYPE(CV_32F, cn));\r
+ fillRandom(image);\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, IntegralBoth, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
+ cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_32F, cn));\r
+ fillRandom(templ);\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_image(image);\r
+ cv::gpu::GpuMat d_templ(templ);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::matchTemplate(image, templ, dst, method);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::matchTemplate(image, templ, dst, method);\r
+ }\r
+ }\r
+};\r
\r
//////////////////////////////////////////////////////////////////////\r
-// IntegralSqr\r
+// MulSpectrums\r
\r
-GPU_PERF_TEST(IntegralSqr, cv::gpu::DeviceInfo, cv::Size)\r
+CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT)\r
+\r
+DEF_PARAM_TEST(Sz_Flags, cv::Size, DftFlags);\r
+\r
+PERF_TEST_P(Sz_Flags, ImgProc_MulSpectrums, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(0, DftFlags(cv::DFT_ROWS))))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GET_PARAM(0);\r
+ int flag = GET_PARAM(1);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat a(size, CV_32FC2);\r
+ fillRandom(a, 0, 100);\r
\r
- cv::Mat src_host(size, CV_8UC1);\r
+ cv::Mat b(size, CV_32FC2);\r
+ fillRandom(b, 0, 100);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_a(a);\r
+ cv::gpu::GpuMat d_b(b);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::sqrIntegral(src, dst);\r
+ cv::Mat dst;\r
+\r
+ cv::mulSpectrums(a, b, dst, flag);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::mulSpectrums(a, b, dst, flag);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, IntegralSqr, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// ColumnSum\r
+// MulAndScaleSpectrums\r
\r
-GPU_PERF_TEST(ColumnSum, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Sz, ImgProc_MulAndScaleSpectrums, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GetParam();\r
+\r
+ float scale = 1.f / size.area();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src1(size, CV_32FC2);\r
+ fillRandom(src1, 0, 100);\r
\r
- cv::Mat src_host(size, CV_32FC1);\r
+ cv::Mat src2(size, CV_32FC2);\r
+ fillRandom(src2, 0, 100);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src1(src1);\r
+ cv::gpu::GpuMat d_src2(src2);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::columnSum(src, dst);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, ColumnSum, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
+//////////////////////////////////////////////////////////////////////\r
+// Dft\r
+\r
+PERF_TEST_P(Sz_Flags, ImgProc_Dft, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(0, DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))))\r
+{\r
+ declare.time(10.0);\r
+\r
+ cv::Size size = GET_PARAM(0);\r
+ int flag = GET_PARAM(1);\r
+\r
+ cv::Mat src(size, CV_32FC2);\r
+ fillRandom(src, 0, 100);\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::dft(d_src, d_dst, size, flag);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::dft(d_src, d_dst, size, flag);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::dft(src, dst, flag);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::dft(src, dst, flag);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
// CornerHarris\r
\r
-GPU_PERF_TEST(CornerHarris, cv::gpu::DeviceInfo, perf::MatType)\r
+DEF_PARAM_TEST(Image_Type_Border_BlockSz_ApertureSz, string, MatType, BorderMode, int, int);\r
+\r
+PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerHarris, Combine(\r
+ Values<string>("gpu/stereobm/aloe-L.png"),\r
+ Values(CV_8UC1, CV_32FC1),\r
+ Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),\r
+ Values(3, 5, 7),\r
+ Values(0, 3, 5, 7)))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ string fileName = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
+ int borderMode = GET_PARAM(2);\r
+ int blockSize = GET_PARAM(3);\r
+ int apertureSize = GET_PARAM(4);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
- \r
- cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);\r
+ cv::Mat img = readImage(fileName, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
-\r
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);\r
\r
- cv::gpu::GpuMat src(img);\r
- cv::gpu::GpuMat dst;\r
- cv::gpu::GpuMat Dx;\r
- cv::gpu::GpuMat Dy;\r
-\r
- int blockSize = 3;\r
- int ksize = 7; \r
double k = 0.5;\r
\r
- TEST_CYCLE(100)\r
+ if (runOnGpu)\r
{\r
- cv::gpu::cornerHarris(src, dst, Dx, Dy, blockSize, ksize, k);\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_Dx;\r
+ cv::gpu::GpuMat d_Dy;\r
+ cv::gpu::GpuMat d_buf;\r
+\r
+ cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);\r
+ }\r
}\r
-}\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CornerHarris, testing::Combine(\r
- ALL_DEVICES, \r
- testing::Values(CV_8UC1, CV_32FC1)));\r
+ TEST_CYCLE()\r
+ {\r
+ cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
// CornerMinEigenVal\r
\r
-GPU_PERF_TEST(CornerMinEigenVal, cv::gpu::DeviceInfo, perf::MatType)\r
+PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerMinEigenVal, Combine(\r
+ Values<string>("gpu/stereobm/aloe-L.png"),\r
+ Values(CV_8UC1, CV_32FC1),\r
+ Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),\r
+ Values(3, 5, 7),\r
+ Values(0, 3, 5, 7)))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ string fileName = GET_PARAM(0);\r
int type = GET_PARAM(1);\r
+ int borderMode = GET_PARAM(2);\r
+ int blockSize = GET_PARAM(3);\r
+ int apertureSize = GET_PARAM(4);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
- \r
- cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);\r
+ cv::Mat img = readImage(fileName, cv::IMREAD_GRAYSCALE);\r
ASSERT_FALSE(img.empty());\r
\r
img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);\r
\r
- cv::gpu::GpuMat src(img);\r
- cv::gpu::GpuMat dst;\r
- cv::gpu::GpuMat Dx;\r
- cv::gpu::GpuMat Dy;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_img(img);\r
+ cv::gpu::GpuMat d_dst;\r
+ cv::gpu::GpuMat d_Dx;\r
+ cv::gpu::GpuMat d_Dy;\r
+ cv::gpu::GpuMat d_buf;\r
+\r
+ cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::Mat dst;\r
\r
- int blockSize = 3;\r
- int ksize = 7; \r
+ cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);\r
\r
- TEST_CYCLE(100)\r
- {\r
- cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, blockSize, ksize);\r
+ TEST_CYCLE()\r
+ {\r
+ cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CornerMinEigenVal, testing::Combine(\r
- ALL_DEVICES, \r
- testing::Values(CV_8UC1, CV_32FC1)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// MulSpectrums\r
+// BuildWarpPlaneMaps\r
\r
-GPU_PERF_TEST(MulSpectrums, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Sz, ImgProc_BuildWarpPlaneMaps, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GetParam();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);\r
+ cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);\r
+ cv::Mat T = cv::Mat::zeros(1, 3, CV_32F);\r
\r
- cv::Mat a_host(size, CV_32FC2);\r
- cv::Mat b_host(size, CV_32FC2);\r
-\r
- declare.in(a_host, b_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_map_x;\r
+ cv::gpu::GpuMat d_map_y;\r
\r
- cv::gpu::GpuMat a(a_host);\r
- cv::gpu::GpuMat b(b_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::mulSpectrums(a, b, dst, 0);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, MulSpectrums, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// Dft\r
+// BuildWarpCylindricalMaps\r
\r
-GPU_PERF_TEST(Dft, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Sz, ImgProc_BuildWarpCylindricalMaps, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GetParam();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);\r
+ cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);\r
\r
- cv::Mat src_host(size, CV_32FC2);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_map_x;\r
+ cv::gpu::GpuMat d_map_y;\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ FAIL();\r
+ }\r
+}\r
\r
- declare.time(2.0);\r
+//////////////////////////////////////////////////////////////////////\r
+// BuildWarpSphericalMaps\r
+\r
+PERF_TEST_P(Sz, ImgProc_BuildWarpSphericalMaps, GPU_TYPICAL_MAT_SIZES)\r
+{\r
+ cv::Size size = GetParam();\r
+\r
+ cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);\r
+ cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_map_x;\r
+ cv::gpu::GpuMat d_map_y;\r
+\r
+ cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::dft(src, dst, size);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Dft, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// Convolve\r
+// Rotate\r
\r
-GPU_PERF_TEST(Convolve, cv::gpu::DeviceInfo, cv::Size, int)\r
-{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int templ_size = GET_PARAM(2);\r
+DEF_PARAM_TEST(Sz_Depth_Cn_Inter, cv::Size, MatDepth, int, Interpolation);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+PERF_TEST_P(Sz_Depth_Cn_Inter, ImgProc_Rotate, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4,\r
+ Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))))\r
+{\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+ int interpolation = GET_PARAM(3);\r
\r
- cv::gpu::GpuMat image = cv::gpu::createContinuous(size, CV_32FC1);\r
- cv::gpu::GpuMat templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- image.setTo(cv::Scalar(1.0));\r
- templ.setTo(cv::Scalar(1.0));\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- cv::gpu::GpuMat dst;\r
- cv::gpu::ConvolveBuf buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- declare.time(2.0);\r
+ cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::convolve(image, templ, dst, false, buf);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Convolve, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(3, 9, 27, 32, 64)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
// PyrDown\r
\r
-GPU_PERF_TEST(PyrDown, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrDown, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::Mat src_host(size, type);\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::pyrDown(d_src, d_dst);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::pyrDown(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::pyrDown(src, dst);\r
+ cv::Mat dst;\r
+\r
+ cv::pyrDown(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::pyrDown(src, dst);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC4, CV_16SC3, CV_32FC1)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
// PyrUp\r
\r
-GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrUp, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ GPU_CHANNELS_1_3_4))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::Mat src_host(size, type);\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::pyrUp(d_src, d_dst);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::pyrUp(d_src, d_dst);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::pyrUp(src, dst);\r
+ cv::Mat dst;\r
+\r
+ cv::pyrUp(src, dst);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::pyrUp(src, dst);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC4, CV_16SC3, CV_32FC1)));\r
+//////////////////////////////////////////////////////////////////////\r
+// CvtColor\r
+\r
+DEF_PARAM_TEST(Sz_Depth_Code, cv::Size, MatDepth, CvtColorInfo);\r
+\r
+PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColor, Combine(\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ Values(CV_8U, CV_16U, CV_32F),\r
+ Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA),\r
+ CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY),\r
+ CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),\r
+ CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ),\r
+ CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR),\r
+ CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb),\r
+ CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR),\r
+ CvtColorInfo(3, 3, cv::COLOR_BGR2YUV),\r
+ CvtColorInfo(3, 3, cv::COLOR_YUV2BGR),\r
+ CvtColorInfo(3, 3, cv::COLOR_BGR2HSV),\r
+ CvtColorInfo(3, 3, cv::COLOR_HSV2BGR),\r
+ CvtColorInfo(3, 3, cv::COLOR_BGR2HLS),\r
+ CvtColorInfo(3, 3, cv::COLOR_HLS2BGR),\r
+ CvtColorInfo(3, 3, cv::COLOR_BGR2Lab),\r
+ CvtColorInfo(3, 3, cv::COLOR_RGB2Lab),\r
+ CvtColorInfo(3, 3, cv::COLOR_BGR2Luv),\r
+ CvtColorInfo(3, 3, cv::COLOR_RGB2Luv),\r
+ CvtColorInfo(3, 3, cv::COLOR_Lab2BGR),\r
+ CvtColorInfo(3, 3, cv::COLOR_Lab2RGB),\r
+ CvtColorInfo(3, 3, cv::COLOR_Luv2BGR),\r
+ CvtColorInfo(3, 3, cv::COLOR_Luv2RGB),\r
+ CvtColorInfo(1, 3, cv::COLOR_BayerBG2BGR),\r
+ CvtColorInfo(1, 3, cv::COLOR_BayerGB2BGR),\r
+ CvtColorInfo(1, 3, cv::COLOR_BayerRG2BGR),\r
+ CvtColorInfo(1, 3, cv::COLOR_BayerGR2BGR),\r
+ CvtColorInfo(4, 4, cv::COLOR_RGBA2mRGBA))))\r
+{\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ CvtColorInfo info = GET_PARAM(2);\r
+\r
+ cv::Mat src(size, CV_MAKETYPE(depth, info.scn));\r
+ fillRandom(src);\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::Mat dst;\r
+\r
+ cv::cvtColor(src, dst, info.code, info.dcn);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::cvtColor(src, dst, info.code, info.dcn);\r
+ }\r
+ }\r
+}\r
\r
//////////////////////////////////////////////////////////////////////\r
-// BlendLinear\r
+// SwapChannels\r
\r
-GPU_PERF_TEST(BlendLinear, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz, ImgProc_SwapChannels, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ cv::Size size = GetParam();\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src(size, CV_8UC4);\r
+ fillRandom(src);\r
\r
- cv::Mat img1_host(size, type);\r
- cv::Mat img2_host(size, type);\r
+ const int dstOrder[] = {2, 1, 0, 3};\r
\r
- declare.in(img1_host, img2_host, WARMUP_RNG);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
\r
- cv::gpu::GpuMat img1(img1_host);\r
- cv::gpu::GpuMat img2(img2_host);\r
- cv::gpu::GpuMat weights1(size, CV_32FC1, cv::Scalar::all(0.5));\r
- cv::gpu::GpuMat weights2(size, CV_32FC1, cv::Scalar::all(0.5));\r
- cv::gpu::GpuMat dst;\r
+ cv::gpu::swapChannels(d_src, dstOrder);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::swapChannels(d_src, dstOrder);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::blendLinear(img1, img2, weights1, weights2, dst);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, BlendLinear, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_32FC1)));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// Canny\r
+// AlphaComp\r
\r
-GPU_PERF_TEST_1(Canny, cv::gpu::DeviceInfo)\r
+CV_ENUM(AlphaOp, cv::gpu::ALPHA_OVER, cv::gpu::ALPHA_IN, cv::gpu::ALPHA_OUT, cv::gpu::ALPHA_ATOP, cv::gpu::ALPHA_XOR, cv::gpu::ALPHA_PLUS, cv::gpu::ALPHA_OVER_PREMUL, cv::gpu::ALPHA_IN_PREMUL, cv::gpu::ALPHA_OUT_PREMUL, cv::gpu::ALPHA_ATOP_PREMUL, cv::gpu::ALPHA_XOR_PREMUL, cv::gpu::ALPHA_PLUS_PREMUL, cv::gpu::ALPHA_PREMUL)\r
+#define ALL_ALPHA_OPS ValuesIn(AlphaOp::all())\r
+\r
+DEF_PARAM_TEST(Sz_Type_Op, cv::Size, MatType, AlphaOp);\r
+\r
+PERF_TEST_P(Sz_Type_Op, ImgProc_AlphaComp, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8UC4, CV_16UC4, CV_32SC4, CV_32FC4), ALL_ALPHA_OPS))\r
{\r
- cv::gpu::DeviceInfo devInfo = GetParam();\r
+ cv::Size size = GET_PARAM(0);\r
+ int type = GET_PARAM(1);\r
+ int alpha_op = GET_PARAM(2);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat img1(size, type);\r
+ fillRandom(img1);\r
\r
- cv::Mat image_host = readImage("perf/1280x1024.jpg", cv::IMREAD_GRAYSCALE);\r
- ASSERT_FALSE(image_host.empty());\r
+ cv::Mat img2(size, type);\r
+ fillRandom(img2);\r
\r
- cv::gpu::GpuMat image(image_host);\r
- cv::gpu::GpuMat dst;\r
- cv::gpu::CannyBuf buf;\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_img1(img1);\r
+ cv::gpu::GpuMat d_img2(img2);\r
+ cv::gpu::GpuMat d_dst;\r
+\r
+ cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::Canny(image, buf, dst, 50.0, 100.0);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, Canny, ALL_DEVICES);\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// CalcHist\r
+// ImagePyramidBuild\r
\r
-GPU_PERF_TEST(CalcHist, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidBuild, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), GPU_CHANNELS_1_3_4))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- cv::Mat src_host(size, CV_8UC1);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::gpu::ImagePyramid d_pyr;\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat hist;\r
- cv::gpu::GpuMat buf;\r
+ d_pyr.build(d_src, 5);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ d_pyr.build(d_src, 5);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::calcHist(src, hist, buf);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, CalcHist, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// EqualizeHist\r
+// ImagePyramidGetLayer\r
\r
-GPU_PERF_TEST(EqualizeHist, cv::gpu::DeviceInfo, cv::Size)\r
+PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidGetLayer, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), GPU_CHANNELS_1_3_4))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
+ cv::Size size = GET_PARAM(0);\r
+ int depth = GET_PARAM(1);\r
+ int channels = GET_PARAM(2);\r
+\r
+ int type = CV_MAKE_TYPE(depth, channels);\r
+\r
+ cv::Mat src(size, type);\r
+ fillRandom(src);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10);\r
\r
- cv::Mat src_host(size, CV_8UC1);\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_dst;\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::gpu::ImagePyramid d_pyr(d_src, 3);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
- cv::gpu::GpuMat hist;\r
- cv::gpu::GpuMat buf;\r
+ d_pyr.getLayer(d_dst, dstSize);\r
\r
- TEST_CYCLE(100)\r
+ TEST_CYCLE()\r
+ {\r
+ d_pyr.getLayer(d_dst, dstSize);\r
+ }\r
+ }\r
+ else\r
{\r
- cv::gpu::equalizeHist(src, dst, hist, buf);\r
+ FAIL();\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, EqualizeHist, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES));\r
-\r
//////////////////////////////////////////////////////////////////////\r
-// ImagePyramid\r
+// HoughLines\r
\r
-GPU_PERF_TEST(ImagePyramid_build, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz, ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES)\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ declare.time(30.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ const cv::Size size = GetParam();\r
\r
- cv::Mat src_host(size, type);\r
+ const float rho = 1.0f;\r
+ const float theta = static_cast<float>(CV_PI / 180.0);\r
+ const int threshold = 300;\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::RNG rng(123456789);\r
\r
- cv::gpu::GpuMat src(src_host);\r
+ cv::Mat src(size, CV_8UC1, cv::Scalar::all(0));\r
\r
- cv::gpu::ImagePyramid pyr;\r
- \r
- TEST_CYCLE(100)\r
+ const int numLines = rng.uniform(100, 300);\r
+ for (int i = 0; i < numLines; ++i)\r
{\r
- pyr.build(src, 5);\r
+ cv::Point p1(rng.uniform(0, src.cols), rng.uniform(0, src.rows));\r
+ cv::Point p2(rng.uniform(0, src.cols), rng.uniform(0, src.rows));\r
+ cv::line(src, p1, p2, cv::Scalar::all(255), 2);\r
+ }\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_lines;\r
+ cv::gpu::HoughLinesBuf d_buf;\r
+\r
+ cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ std::vector<cv::Vec2f> lines;\r
+ cv::HoughLines(src, lines, rho, theta, threshold);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::HoughLines(src, lines, rho, theta, threshold);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_build, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));\r
+//////////////////////////////////////////////////////////////////////\r
+// HoughCircles\r
+\r
+DEF_PARAM_TEST(Sz_Dp_MinDist, cv::Size, float, float);\r
\r
-GPU_PERF_TEST(ImagePyramid_getLayer, cv::gpu::DeviceInfo, cv::Size, perf::MatType)\r
+PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles, Combine(GPU_TYPICAL_MAT_SIZES, Values(1.0f, 2.0f, 4.0f), Values(1.0f, 10.0f)))\r
{\r
- cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
- cv::Size size = GET_PARAM(1);\r
- int type = GET_PARAM(2);\r
+ declare.time(30.0);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
+ const cv::Size size = GET_PARAM(0);\r
+ const float dp = GET_PARAM(1);\r
+ const float minDist = GET_PARAM(2);\r
\r
- cv::Mat src_host(size, type);\r
+ const int minRadius = 10;\r
+ const int maxRadius = 30;\r
+ const int cannyThreshold = 100;\r
+ const int votesThreshold = 15;\r
\r
- declare.in(src_host, WARMUP_RNG);\r
+ cv::RNG rng(123456789);\r
\r
- cv::gpu::GpuMat src(src_host);\r
- cv::gpu::GpuMat dst;\r
+ cv::Mat src(size, CV_8UC1, cv::Scalar::all(0));\r
\r
- cv::gpu::ImagePyramid pyr(src, 3);\r
- \r
- TEST_CYCLE(100)\r
+ const int numCircles = rng.uniform(50, 100);\r
+ for (int i = 0; i < numCircles; ++i)\r
{\r
- pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));\r
+ cv::Point center(rng.uniform(0, src.cols), rng.uniform(0, src.rows));\r
+ const int radius = rng.uniform(minRadius, maxRadius + 1);\r
+\r
+ cv::circle(src, center, radius, cv::Scalar::all(255), -1);\r
+ }\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_src(src);\r
+ cv::gpu::GpuMat d_circles;\r
+ cv::gpu::HoughCirclesBuf d_buf;\r
+\r
+ cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ std::vector<cv::Vec3f> circles;\r
+\r
+ cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);\r
+ }\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_getLayer, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_16UC3, CV_16UC4, CV_32FC1, CV_32FC3, CV_32FC4)));\r
+//////////////////////////////////////////////////////////////////////\r
+// GeneralizedHough\r
+\r
+CV_FLAGS(GHMethod, cv::GHT_POSITION, cv::GHT_SCALE, cv::GHT_ROTATION);\r
+\r
+DEF_PARAM_TEST(Method_Sz, GHMethod, cv::Size);\r
+\r
+PERF_TEST_P(Method_Sz, GeneralizedHough, Combine(\r
+ Values(GHMethod(cv::GHT_POSITION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE), GHMethod(cv::GHT_POSITION | cv::GHT_ROTATION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE | cv::GHT_ROTATION)),\r
+ GPU_TYPICAL_MAT_SIZES))\r
+{\r
+ declare.time(10);\r
+\r
+ const int method = GET_PARAM(0);\r
+ const cv::Size imageSize = GET_PARAM(1);\r
+\r
+ const cv::Mat templ = readImage("cv/shared/templ.png", cv::IMREAD_GRAYSCALE);\r
+ ASSERT_FALSE(templ.empty());\r
+\r
+ cv::Mat image(imageSize, CV_8UC1, cv::Scalar::all(0));\r
+\r
+ cv::RNG rng(123456789);\r
+ const int objCount = rng.uniform(5, 15);\r
+ for (int i = 0; i < objCount; ++i)\r
+ {\r
+ double scale = rng.uniform(0.7, 1.3);\r
+ bool rotate = rng.uniform(0, 2);\r
+\r
+ cv::Mat obj;\r
+ cv::resize(templ, obj, cv::Size(), scale, scale);\r
+ if (rotate)\r
+ obj = obj.t();\r
+\r
+ cv::Point pos;\r
+\r
+ pos.x = rng.uniform(0, image.cols - obj.cols);\r
+ pos.y = rng.uniform(0, image.rows - obj.rows);\r
+\r
+ cv::Mat roi = image(cv::Rect(pos, obj.size()));\r
+ cv::add(roi, obj, roi);\r
+ }\r
+\r
+ cv::Mat edges;\r
+ cv::Canny(image, edges, 50, 100);\r
+\r
+ cv::Mat dx, dy;\r
+ cv::Sobel(image, dx, CV_32F, 1, 0);\r
+ cv::Sobel(image, dy, CV_32F, 0, 1);\r
+\r
+ if (runOnGpu)\r
+ {\r
+ cv::gpu::GpuMat d_edges(edges);\r
+ cv::gpu::GpuMat d_dx(dx);\r
+ cv::gpu::GpuMat d_dy(dy);\r
+ cv::gpu::GpuMat d_position;\r
+\r
+ cv::Ptr<cv::gpu::GeneralizedHough_GPU> d_hough = cv::gpu::GeneralizedHough_GPU::create(method);\r
+ if (method & cv::GHT_ROTATION)\r
+ {\r
+ d_hough->set("maxAngle", 90.0);\r
+ d_hough->set("angleStep", 2.0);\r
+ }\r
+\r
+ d_hough->setTemplate(cv::gpu::GpuMat(templ));\r
+\r
+ d_hough->detect(d_edges, d_dx, d_dy, d_position);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ d_hough->detect(d_edges, d_dx, d_dy, d_position);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ cv::Mat positions;\r
+\r
+ cv::Ptr<cv::GeneralizedHough> hough = cv::GeneralizedHough::create(method);\r
+ if (method & cv::GHT_ROTATION)\r
+ {\r
+ hough->set("maxAngle", 90.0);\r
+ hough->set("angleStep", 2.0);\r
+ }\r
+\r
+ hough->setTemplate(templ);\r
+\r
+ hough->detect(edges, dx, dy, positions);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ hough->detect(edges, dx, dy, positions);\r
+ }\r
+ }\r
+}\r
\r
-#endif\r
+} // namespace\r