\r
#ifdef HAVE_CUDA\r
\r
+IMPLEMENT_PARAM_CLASS(KernelSize, int)\r
+\r
//////////////////////////////////////////////////////////////////////\r
-// BoxFilter\r
+// Blur\r
\r
-GPU_PERF_TEST(BoxFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)\r
+GPU_PERF_TEST(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
{\r
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ cv::gpu::setDevice(devInfo.deviceID());\r
+\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
int ksize = GET_PARAM(3);\r
\r
- cv::gpu::setDevice(devInfo.deviceID());\r
-\r
cv::Mat src_host(size, type);\r
\r
declare.in(src_host, WARMUP_RNG);\r
cv::gpu::GpuMat src(src_host);\r
cv::gpu::GpuMat dst;\r
\r
- cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createBoxFilter_GPU(type, type, cv::Size(ksize, ksize));\r
-\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst);\r
+ cv::gpu::blur(src, dst, cv::Size(ksize, ksize));\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, BoxFilter, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4),\r
- testing::Values(3, 5)));\r
+INSTANTIATE_TEST_CASE_P(Filter, Blur, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7))));\r
\r
//////////////////////////////////////////////////////////////////////\r
-// MorphologyFilter\r
+// Sobel\r
\r
-GPU_PERF_TEST(MorphologyFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, MorphOp, int)\r
+GPU_PERF_TEST(Sobel, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
{\r
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ cv::gpu::setDevice(devInfo.deviceID());\r
+\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
- int op = GET_PARAM(3);\r
- int ksize = GET_PARAM(4);\r
+ int ksize = GET_PARAM(3);\r
+\r
+ cv::Mat src_host(size, type);\r
+\r
+ declare.in(src_host, WARMUP_RNG);\r
+\r
+ cv::gpu::GpuMat src(src_host);\r
+ cv::gpu::GpuMat dst;\r
+ cv::gpu::GpuMat buf;\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::Sobel(src, dst, -1, 1, 1, buf, ksize);\r
+ }\r
+}\r
\r
+INSTANTIATE_TEST_CASE_P(Filter, Sobel, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// Scharr\r
+\r
+GPU_PERF_TEST(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType)\r
+{\r
+ cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+\r
cv::Mat src_host(size, type);\r
\r
declare.in(src_host, WARMUP_RNG);\r
\r
cv::gpu::GpuMat src(src_host);\r
cv::gpu::GpuMat dst;\r
-\r
- cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createMorphologyFilter_GPU(op, type, cv::Mat::ones(ksize, ksize, CV_8U));\r
+ cv::gpu::GpuMat buf;\r
\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst);\r
+ cv::gpu::Scharr(src, dst, -1, 1, 0, buf);\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, MorphologyFilter, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4),\r
- testing::Values((int) cv::MORPH_ERODE, (int) cv::MORPH_DILATE),\r
- testing::Values(3, 5)));\r
+INSTANTIATE_TEST_CASE_P(Filter, Scharr, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1))));\r
\r
//////////////////////////////////////////////////////////////////////\r
-// LinearFilter\r
+// GaussianBlur\r
\r
-GPU_PERF_TEST(LinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)\r
+GPU_PERF_TEST(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
{\r
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ cv::gpu::setDevice(devInfo.deviceID());\r
+\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
int ksize = GET_PARAM(3);\r
\r
+ cv::Mat src_host(size, type);\r
+\r
+ declare.in(src_host, WARMUP_RNG);\r
+\r
+ cv::gpu::GpuMat src(src_host);\r
+ cv::gpu::GpuMat dst;\r
+ cv::gpu::GpuMat buf;\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::GaussianBlur(src, dst, cv::Size(ksize, ksize), buf, 0.5);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// Laplacian\r
+\r
+GPU_PERF_TEST(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
+{\r
+ cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+ int ksize = GET_PARAM(3);\r
+\r
cv::Mat src_host(size, type);\r
\r
declare.in(src_host, WARMUP_RNG);\r
cv::gpu::GpuMat src(src_host);\r
cv::gpu::GpuMat dst;\r
\r
- cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createLinearFilter_GPU(type, type, cv::Mat::ones(ksize, ksize, CV_8U));\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::Laplacian(src, dst, -1, ksize);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, Laplacian, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),\r
+ testing::Values(KernelSize(1), KernelSize(3))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// Erode\r
+\r
+GPU_PERF_TEST(Erode, cv::gpu::DeviceInfo, cv::Size, MatType)\r
+{\r
+ cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ cv::gpu::setDevice(devInfo.deviceID());\r
+\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
\r
- declare.time(1.0);\r
+ cv::Mat src_host(size, type);\r
+\r
+ declare.in(src_host, WARMUP_RNG);\r
+\r
+ cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
+\r
+ cv::gpu::GpuMat src(src_host);\r
+ cv::gpu::GpuMat dst;\r
+ cv::gpu::GpuMat buf;\r
\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst);\r
+ cv::gpu::erode(src, dst, ker, buf);\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, LinearFilter, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),\r
- testing::Values(3, 5, 7, 9)));\r
+INSTANTIATE_TEST_CASE_P(Filter, Erode, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));\r
\r
//////////////////////////////////////////////////////////////////////\r
-// SeparableLinearFilter\r
+// Dilate\r
\r
-GPU_PERF_TEST(SeparableLinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)\r
+GPU_PERF_TEST(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType)\r
{\r
cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ cv::gpu::setDevice(devInfo.deviceID());\r
+\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
- int ksize = GET_PARAM(3);\r
\r
+ cv::Mat src_host(size, type);\r
+\r
+ declare.in(src_host, WARMUP_RNG);\r
+\r
+ cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
+\r
+ cv::gpu::GpuMat src(src_host);\r
+ cv::gpu::GpuMat dst;\r
+ cv::gpu::GpuMat buf;\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::dilate(src, dst, ker, buf);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, Dilate, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// MorphologyEx\r
+\r
+CV_ENUM(MorphOp, cv::MORPH_OPEN, cv::MORPH_CLOSE, cv::MORPH_GRADIENT, cv::MORPH_TOPHAT, cv::MORPH_BLACKHAT)\r
+#define ALL_MORPH_OPS testing::Values(MorphOp(cv::MORPH_OPEN), MorphOp(cv::MORPH_CLOSE), MorphOp(cv::MORPH_GRADIENT), MorphOp(cv::MORPH_TOPHAT), MorphOp(cv::MORPH_BLACKHAT))\r
+\r
+GPU_PERF_TEST(MorphologyEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp)\r
+{\r
+ cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
cv::gpu::setDevice(devInfo.deviceID());\r
\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+ int morphOp = GET_PARAM(3);\r
+\r
cv::Mat src_host(size, type);\r
\r
declare.in(src_host, WARMUP_RNG);\r
\r
+ cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
+\r
cv::gpu::GpuMat src(src_host);\r
cv::gpu::GpuMat dst;\r
+ cv::gpu::GpuMat buf1;\r
+ cv::gpu::GpuMat buf2;\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::gpu::morphologyEx(src, dst, morphOp, ker, buf1, buf2);\r
+ }\r
+}\r
\r
- cv::Mat kernel = cv::getGaussianKernel(ksize, 0.5, CV_32F);\r
- cv::Ptr<cv::gpu::FilterEngine_GPU> filter = cv::gpu::createSeparableLinearFilter_GPU(type, type, kernel, kernel);\r
+INSTANTIATE_TEST_CASE_P(Filter, MorphologyEx, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),\r
+ ALL_MORPH_OPS));\r
\r
- declare.time(1.0);\r
+//////////////////////////////////////////////////////////////////////\r
+// Filter2D\r
+\r
+GPU_PERF_TEST(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
+{\r
+ cv::gpu::DeviceInfo devInfo = GET_PARAM(0);\r
+ cv::gpu::setDevice(devInfo.deviceID());\r
+\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+ int ksize = GET_PARAM(3);\r
+\r
+ cv::Mat src_host(size, type);\r
+ cv::Mat kernel(ksize, ksize, CV_32FC1);\r
+\r
+ declare.in(src_host, kernel, WARMUP_RNG);\r
+\r
+ cv::gpu::GpuMat src(src_host);\r
+ cv::gpu::GpuMat dst;\r
\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst, cv::Rect(0, 0, src.cols, src.rows));\r
+ cv::gpu::filter2D(src, dst, -1, kernel);\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, SeparableLinearFilter, testing::Combine(\r
- ALL_DEVICES, \r
- GPU_TYPICAL_MAT_SIZES, \r
- testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),\r
- testing::Values(3, 5, 7, 9, 11, 13, 15)));\r
+INSTANTIATE_TEST_CASE_P(Filter, Filter2D, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
\r
#endif\r
\r
enum {HORIZONTAL_AXIS = 0, VERTICAL_AXIS = 1, BOTH_AXIS = -1};\r
\r
-CV_ENUM(MorphOp, cv::MORPH_ERODE, cv::MORPH_DILATE)\r
+using perf::MatType;\r
+using perf::MatDepth;\r
+\r
CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)\r
CV_ENUM(FlipCode, HORIZONTAL_AXIS, VERTICAL_AXIS, BOTH_AXIS)\r
CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC)\r
CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2)\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
\r
+#define IMPLEMENT_PARAM_CLASS(name, type) \\r
+ class name \\r
+ { \\r
+ public: \\r
+ name ( type arg = type ()) : val_(arg) {} \\r
+ operator type () const {return val_;} \\r
+ private: \\r
+ type val_; \\r
+ }; \\r
+ inline void PrintTo( name param, std::ostream* os) \\r
+ { \\r
+ *os << #name << "(" << testing::PrintToString(static_cast< type >(param)) << ")"; \\r
+ }\r
+\r
struct CvtColorInfo\r
{\r
int scn;\r
\r
#ifdef HAVE_CUDA\r
\r
+IMPLEMENT_PARAM_CLASS(KernelSize, int)\r
+\r
//////////////////////////////////////////////////////////////////////\r
-// BoxFilter\r
+// Blur\r
\r
-GPU_PERF_TEST(BoxFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)\r
+GPU_PERF_TEST(Blur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
{\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
\r
declare.in(src, WARMUP_RNG);\r
\r
- cv::Mat dst(src.size(), src.type());\r
+ cv::Mat dst;\r
\r
- cv::Ptr<cv::FilterEngine> filter = cv::createBoxFilter(type, type, cv::Size(ksize, ksize));\r
+ declare.time(20.0);\r
\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst);\r
+ cv::blur(src, dst, cv::Size(ksize, ksize));\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, BoxFilter, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC4),\r
- testing::Values(3, 5)));\r
+INSTANTIATE_TEST_CASE_P(Filter, Blur, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7))));\r
\r
//////////////////////////////////////////////////////////////////////\r
-// MorphologyFilter\r
+// Sobel\r
\r
-GPU_PERF_TEST(MorphologyFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, MorphOp, int)\r
+GPU_PERF_TEST(Sobel, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
{\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
- int op = GET_PARAM(3);\r
- int ksize = GET_PARAM(4);\r
+ int ksize = GET_PARAM(3);\r
\r
cv::Mat src(size, type);\r
\r
declare.in(src, WARMUP_RNG);\r
\r
- cv::Mat dst(src.size(), src.type());\r
+ cv::Mat dst;\r
\r
- cv::Ptr<cv::FilterEngine> filter = cv::createMorphologyFilter(op, type, cv::Mat::ones(ksize, ksize, CV_8U));\r
+ declare.time(20.0);\r
\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst);\r
+ cv::Sobel(src, dst, -1, 1, 1, ksize);\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, MorphologyFilter, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC4),\r
- testing::Values((int) cv::MORPH_ERODE, (int) cv::MORPH_DILATE),\r
- testing::Values(3, 5)));\r
+INSTANTIATE_TEST_CASE_P(Filter, Sobel, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
\r
//////////////////////////////////////////////////////////////////////\r
-// LinearFilter\r
+// Scharr\r
\r
-GPU_PERF_TEST(LinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)\r
+GPU_PERF_TEST(Scharr, cv::gpu::DeviceInfo, cv::Size, MatType)\r
{\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
- int ksize = GET_PARAM(3);\r
\r
cv::Mat src(size, type);\r
\r
declare.in(src, WARMUP_RNG);\r
\r
- cv::Mat dst(src.size(), src.type());\r
+ cv::Mat dst;\r
+\r
+ declare.time(20.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::Scharr(src, dst, -1, 1, 0);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, Scharr, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// GaussianBlur\r
+\r
+GPU_PERF_TEST(GaussianBlur, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
+{\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+ int ksize = GET_PARAM(3);\r
+\r
+ cv::Mat src(size, type);\r
+\r
+ declare.in(src, WARMUP_RNG);\r
\r
- cv::Ptr<cv::FilterEngine> filter = cv::createLinearFilter(type, type, cv::Mat::ones(ksize, ksize, CV_8U));\r
+ cv::Mat dst;\r
\r
- declare.time(10.0);\r
+ declare.time(20.0);\r
\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst);\r
+ cv::GaussianBlur(src, dst, cv::Size(ksize, ksize), 0.5);\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, LinearFilter, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),\r
- testing::Values(3, 5, 7, 9)));\r
+INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
\r
//////////////////////////////////////////////////////////////////////\r
-// SeparableLinearFilter\r
+// Laplacian\r
\r
-GPU_PERF_TEST(SeparableLinearFilter, cv::gpu::DeviceInfo, cv::Size, perf::MatType, int)\r
+GPU_PERF_TEST(Laplacian, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
{\r
cv::Size size = GET_PARAM(1);\r
int type = GET_PARAM(2);\r
\r
declare.in(src, WARMUP_RNG);\r
\r
- cv::Mat dst(src.size(), src.type());\r
+ cv::Mat dst;\r
+\r
+ declare.time(20.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::Laplacian(src, dst, -1, ksize);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, Laplacian, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),\r
+ testing::Values(KernelSize(1), KernelSize(3))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// Erode\r
+\r
+GPU_PERF_TEST(Erode, cv::gpu::DeviceInfo, cv::Size, MatType)\r
+{\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+\r
+ cv::Mat src(size, type);\r
+\r
+ declare.in(src, WARMUP_RNG);\r
+\r
+ cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
+\r
+ cv::Mat dst;\r
+\r
+ declare.time(20.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::erode(src, dst, ker);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, Erode, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// Dilate\r
+\r
+GPU_PERF_TEST(Dilate, cv::gpu::DeviceInfo, cv::Size, MatType)\r
+{\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+\r
+ cv::Mat src(size, type);\r
+\r
+ declare.in(src, WARMUP_RNG);\r
+\r
+ cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
+\r
+ cv::Mat dst;\r
+\r
+ declare.time(20.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::dilate(src, dst, ker);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, Dilate, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4))));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// MorphologyEx\r
+\r
+CV_ENUM(MorphOp, cv::MORPH_OPEN, cv::MORPH_CLOSE, cv::MORPH_GRADIENT, cv::MORPH_TOPHAT, cv::MORPH_BLACKHAT)\r
+#define ALL_MORPH_OPS testing::Values(MorphOp(cv::MORPH_OPEN), MorphOp(cv::MORPH_CLOSE), MorphOp(cv::MORPH_GRADIENT), MorphOp(cv::MORPH_TOPHAT), MorphOp(cv::MORPH_BLACKHAT))\r
+\r
+GPU_PERF_TEST(MorphologyEx, cv::gpu::DeviceInfo, cv::Size, MatType, MorphOp)\r
+{\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+ int morphOp = GET_PARAM(3);\r
+\r
+ cv::Mat src(size, type);\r
+\r
+ declare.in(src, WARMUP_RNG);\r
+\r
+ cv::Mat dst;\r
+\r
+ cv::Mat ker = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(3, 3));\r
+\r
+ declare.time(20.0);\r
+\r
+ TEST_CYCLE()\r
+ {\r
+ cv::morphologyEx(src, dst, morphOp, ker);\r
+ }\r
+}\r
+\r
+INSTANTIATE_TEST_CASE_P(Filter, MorphologyEx, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4)),\r
+ ALL_MORPH_OPS));\r
+\r
+//////////////////////////////////////////////////////////////////////\r
+// Filter2D\r
+\r
+GPU_PERF_TEST(Filter2D, cv::gpu::DeviceInfo, cv::Size, MatType, KernelSize)\r
+{\r
+ cv::Size size = GET_PARAM(1);\r
+ int type = GET_PARAM(2);\r
+ int ksize = GET_PARAM(3);\r
+\r
+ cv::Mat src(size, type);\r
+ cv::Mat kernel(ksize, ksize, CV_32FC1);\r
+\r
+ declare.in(src, kernel, WARMUP_RNG);\r
\r
- cv::Mat kernel = cv::getGaussianKernel(ksize, 0.5, CV_32F);\r
- cv::Ptr<cv::FilterEngine> filter = cv::createSeparableLinearFilter(type, type, kernel, kernel);\r
+ cv::Mat dst;\r
\r
- declare.time(10.0);\r
+ declare.time(20.0);\r
\r
TEST_CYCLE()\r
{\r
- filter->apply(src, dst);\r
+ cv::filter2D(src, dst, -1, kernel);\r
}\r
}\r
\r
-INSTANTIATE_TEST_CASE_P(Filter, SeparableLinearFilter, testing::Combine(\r
- ALL_DEVICES,\r
- GPU_TYPICAL_MAT_SIZES,\r
- testing::Values(CV_8UC1, CV_8UC4, CV_32FC1),\r
- testing::Values(3, 5, 7, 9, 11, 13, 15)));\r
+INSTANTIATE_TEST_CASE_P(Filter, Filter2D, testing::Combine(\r
+ ALL_DEVICES,\r
+ GPU_TYPICAL_MAT_SIZES,\r
+ testing::Values(MatType(CV_8UC1), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC4)),\r
+ testing::Values(KernelSize(3), KernelSize(5), KernelSize(7), KernelSize(9), KernelSize(11), KernelSize(13), KernelSize(15))));\r
\r
#endif\r
\r
enum {HORIZONTAL_AXIS = 0, VERTICAL_AXIS = 1, BOTH_AXIS = -1};\r
\r
-CV_ENUM(MorphOp, cv::MORPH_ERODE, cv::MORPH_DILATE)\r
+using perf::MatType;\r
+using perf::MatDepth;\r
+\r
CV_ENUM(BorderMode, cv::BORDER_REFLECT101, cv::BORDER_REPLICATE, cv::BORDER_CONSTANT, cv::BORDER_REFLECT, cv::BORDER_WRAP)\r
CV_ENUM(FlipCode, HORIZONTAL_AXIS, VERTICAL_AXIS, BOTH_AXIS)\r
CV_ENUM(Interpolation, cv::INTER_NEAREST, cv::INTER_LINEAR, cv::INTER_CUBIC)\r
CV_ENUM(NormType, cv::NORM_INF, cv::NORM_L1, cv::NORM_L2)\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
\r
+#define IMPLEMENT_PARAM_CLASS(name, type) \\r
+ class name \\r
+ { \\r
+ public: \\r
+ name ( type arg = type ()) : val_(arg) {} \\r
+ operator type () const {return val_;} \\r
+ private: \\r
+ type val_; \\r
+ }; \\r
+ inline void PrintTo( name param, std::ostream* os) \\r
+ { \\r
+ *os << #name << "(" << testing::PrintToString(static_cast< type >(param)) << ")"; \\r
+ }\r
+\r
struct CvtColorInfo\r
{\r
int scn;\r