1 #include "perf_precomp.hpp"
\r
5 //////////////////////////////////////////////////////////////////////
\r
8 GPU_PERF_TEST(Remap, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
\r
10 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
11 cv::gpu::setDevice(devInfo.deviceID());
\r
13 cv::Size size = GET_PARAM(1);
\r
14 int type = GET_PARAM(2);
\r
15 int interpolation = GET_PARAM(3);
\r
16 int borderMode = GET_PARAM(4);
\r
18 cv::Mat src_host(size, type);
\r
19 fill(src_host, 0, 255);
\r
21 cv::Mat xmap_host(size, CV_32FC1);
\r
22 fill(xmap_host, 0, size.width);
\r
24 cv::Mat ymap_host(size, CV_32FC1);
\r
25 fill(ymap_host, 0, size.height);
\r
27 cv::gpu::GpuMat src(src_host);
\r
28 cv::gpu::GpuMat xmap(xmap_host);
\r
29 cv::gpu::GpuMat ymap(ymap_host);
\r
30 cv::gpu::GpuMat dst;
\r
32 cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode);
\r
38 cv::gpu::remap(src, dst, xmap, ymap, interpolation, borderMode);
\r
42 INSTANTIATE_TEST_CASE_P(ImgProc, Remap, testing::Combine(
\r
44 GPU_TYPICAL_MAT_SIZES,
\r
45 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
46 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
47 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
\r
48 testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
\r
49 testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
\r
52 //////////////////////////////////////////////////////////////////////
\r
55 IMPLEMENT_PARAM_CLASS(Scale, double)
\r
57 GPU_PERF_TEST(Resize, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, Scale)
\r
59 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
60 cv::gpu::setDevice(devInfo.deviceID());
\r
62 cv::Size size = GET_PARAM(1);
\r
63 int type = GET_PARAM(2);
\r
64 int interpolation = GET_PARAM(3);
\r
65 double f = GET_PARAM(4);
\r
67 cv::Mat src_host(size, type);
\r
68 fill(src_host, 0, 255);
\r
70 cv::gpu::GpuMat src(src_host);
\r
71 cv::gpu::GpuMat dst;
\r
73 cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
\r
79 cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
\r
83 INSTANTIATE_TEST_CASE_P(ImgProc, Resize, testing::Combine(
\r
85 GPU_TYPICAL_MAT_SIZES,
\r
86 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
87 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
88 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
\r
89 testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR),
\r
90 Interpolation(cv::INTER_CUBIC), Interpolation(cv::INTER_AREA)),
\r
91 testing::Values(Scale(0.5), Scale(0.3), Scale(2.0))));
\r
93 GPU_PERF_TEST(ResizeArea, cv::gpu::DeviceInfo, cv::Size, MatType, Scale)
\r
95 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
96 cv::gpu::setDevice(devInfo.deviceID());
\r
98 cv::Size size = GET_PARAM(1);
\r
99 int type = GET_PARAM(2);
\r
100 int interpolation = cv::INTER_AREA;
\r
101 double f = GET_PARAM(3);
\r
103 cv::Mat src_host(size, type);
\r
104 fill(src_host, 0, 255);
\r
106 cv::gpu::GpuMat src(src_host);
\r
107 cv::gpu::GpuMat dst;
\r
109 cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
\r
115 cv::gpu::resize(src, dst, cv::Size(), f, f, interpolation);
\r
119 INSTANTIATE_TEST_CASE_P(ImgProc, ResizeArea, testing::Combine(
\r
121 testing::Values(perf::sz1080p, cv::Size(4096, 2048)),
\r
122 testing::Values(MatType(CV_8UC1)/*, MatType(CV_8UC3), MatType(CV_8UC4),
\r
123 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
124 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)*/),
\r
125 testing::Values(Scale(0.2),Scale(0.1),Scale(0.05))));
\r
127 //////////////////////////////////////////////////////////////////////
\r
130 GPU_PERF_TEST(WarpAffine, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
\r
132 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
133 cv::gpu::setDevice(devInfo.deviceID());
\r
135 cv::Size size = GET_PARAM(1);
\r
136 int type = GET_PARAM(2);
\r
137 int interpolation = GET_PARAM(3);
\r
138 int borderMode = GET_PARAM(4);
\r
140 cv::Mat src_host(size, type);
\r
141 fill(src_host, 0, 255);
\r
143 cv::gpu::GpuMat src(src_host);
\r
144 cv::gpu::GpuMat dst;
\r
146 const double aplha = CV_PI / 4;
\r
147 double mat[2][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},
\r
148 {std::sin(aplha), std::cos(aplha), 0}};
\r
149 cv::Mat M(2, 3, CV_64F, (void*) mat);
\r
151 cv::gpu::warpAffine(src, dst, M, size, interpolation, borderMode);
\r
155 cv::gpu::warpAffine(src, dst, M, size, interpolation, borderMode);
\r
159 INSTANTIATE_TEST_CASE_P(ImgProc, WarpAffine, testing::Combine(
\r
161 GPU_TYPICAL_MAT_SIZES,
\r
162 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
163 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
164 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
\r
165 testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
\r
166 testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
\r
168 //////////////////////////////////////////////////////////////////////
\r
171 GPU_PERF_TEST(WarpPerspective, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation, BorderMode)
\r
173 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
174 cv::gpu::setDevice(devInfo.deviceID());
\r
176 cv::Size size = GET_PARAM(1);
\r
177 int type = GET_PARAM(2);
\r
178 int interpolation = GET_PARAM(3);
\r
179 int borderMode = GET_PARAM(4);
\r
181 cv::Mat src_host(size, type);
\r
182 fill(src_host, 0, 255);
\r
184 cv::gpu::GpuMat src(src_host);
\r
185 cv::gpu::GpuMat dst;
\r
187 const double aplha = CV_PI / 4;
\r
188 double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},
\r
189 {std::sin(aplha), std::cos(aplha), 0},
\r
191 cv::Mat M(3, 3, CV_64F, (void*) mat);
\r
193 cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode);
\r
197 cv::gpu::warpPerspective(src, dst, M, size, interpolation, borderMode);
\r
201 INSTANTIATE_TEST_CASE_P(ImgProc, WarpPerspective, testing::Combine(
\r
203 GPU_TYPICAL_MAT_SIZES,
\r
204 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
205 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
206 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
\r
207 testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
\r
208 testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
\r
210 //////////////////////////////////////////////////////////////////////
\r
213 GPU_PERF_TEST(CopyMakeBorder, cv::gpu::DeviceInfo, cv::Size, MatType, BorderMode)
\r
215 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
216 cv::gpu::setDevice(devInfo.deviceID());
\r
218 cv::Size size = GET_PARAM(1);
\r
219 int type = GET_PARAM(2);
\r
220 int borderType = GET_PARAM(3);
\r
222 cv::Mat src_host(size, type);
\r
223 fill(src_host, 0, 255);
\r
225 cv::gpu::GpuMat src(src_host);
\r
226 cv::gpu::GpuMat dst;
\r
228 cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);
\r
232 cv::gpu::copyMakeBorder(src, dst, 5, 5, 5, 5, borderType);
\r
236 INSTANTIATE_TEST_CASE_P(ImgProc, CopyMakeBorder, testing::Combine(
\r
238 GPU_TYPICAL_MAT_SIZES,
\r
239 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
240 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
241 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
\r
242 testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_CONSTANT), BorderMode(cv::BORDER_REFLECT), BorderMode(cv::BORDER_WRAP))));
\r
244 //////////////////////////////////////////////////////////////////////
\r
247 CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)
\r
248 #define ALL_THRESH_OPS testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV))
\r
250 GPU_PERF_TEST(Threshold, cv::gpu::DeviceInfo, cv::Size, MatDepth, ThreshOp)
\r
252 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
253 cv::gpu::setDevice(devInfo.deviceID());
\r
255 cv::Size size = GET_PARAM(1);
\r
256 int depth = GET_PARAM(2);
\r
257 int threshOp = GET_PARAM(3);
\r
259 cv::Mat src_host(size, depth);
\r
260 fill(src_host, 0, 255);
\r
262 cv::gpu::GpuMat src(src_host);
\r
263 cv::gpu::GpuMat dst;
\r
265 cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp);
\r
269 cv::gpu::threshold(src, dst, 100.0, 255.0, threshOp);
\r
273 INSTANTIATE_TEST_CASE_P(ImgProc, Threshold, testing::Combine(
\r
275 GPU_TYPICAL_MAT_SIZES,
\r
276 testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F), MatDepth(CV_64F)),
\r
279 //////////////////////////////////////////////////////////////////////
\r
282 GPU_PERF_TEST(Integral, cv::gpu::DeviceInfo, cv::Size)
\r
284 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
285 cv::gpu::setDevice(devInfo.deviceID());
\r
287 cv::Size size = GET_PARAM(1);
\r
289 cv::Mat src_host(size, CV_8UC1);
\r
290 fill(src_host, 0, 255);
\r
292 cv::gpu::GpuMat src(src_host);
\r
293 cv::gpu::GpuMat dst;
\r
294 cv::gpu::GpuMat buf;
\r
296 cv::gpu::integralBuffered(src, dst, buf);
\r
300 cv::gpu::integralBuffered(src, dst, buf);
\r
304 INSTANTIATE_TEST_CASE_P(ImgProc, Integral, testing::Combine(
\r
306 GPU_TYPICAL_MAT_SIZES));
\r
308 //////////////////////////////////////////////////////////////////////
\r
311 GPU_PERF_TEST(Integral_Sqr, cv::gpu::DeviceInfo, cv::Size)
\r
313 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
314 cv::gpu::setDevice(devInfo.deviceID());
\r
316 cv::Size size = GET_PARAM(1);
\r
318 cv::Mat src_host(size, CV_8UC1);
\r
319 fill(src_host, 0, 255);
\r
321 cv::gpu::GpuMat src(src_host);
\r
322 cv::gpu::GpuMat dst;
\r
324 cv::gpu::sqrIntegral(src, dst);
\r
328 cv::gpu::sqrIntegral(src, dst);
\r
332 INSTANTIATE_TEST_CASE_P(ImgProc, Integral_Sqr, testing::Combine(
\r
334 GPU_TYPICAL_MAT_SIZES));
\r
336 //////////////////////////////////////////////////////////////////////
\r
337 // HistEven_OneChannel
\r
339 GPU_PERF_TEST(HistEven_OneChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth)
\r
341 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
342 cv::gpu::setDevice(devInfo.deviceID());
\r
344 cv::Size size = GET_PARAM(1);
\r
345 int depth = GET_PARAM(2);
\r
347 cv::Mat src_host(size, depth);
\r
348 fill(src_host, 0, 255);
\r
350 cv::gpu::GpuMat src(src_host);
\r
351 cv::gpu::GpuMat hist;
\r
352 cv::gpu::GpuMat buf;
\r
354 cv::gpu::histEven(src, hist, buf, 30, 0, 180);
\r
358 cv::gpu::histEven(src, hist, buf, 30, 0, 180);
\r
362 INSTANTIATE_TEST_CASE_P(ImgProc, HistEven_OneChannel, testing::Combine(
\r
364 GPU_TYPICAL_MAT_SIZES,
\r
365 testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S))));
\r
367 //////////////////////////////////////////////////////////////////////
\r
368 // HistEven_FourChannel
\r
370 GPU_PERF_TEST(HistEven_FourChannel, cv::gpu::DeviceInfo, cv::Size, MatDepth)
\r
372 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
373 cv::gpu::setDevice(devInfo.deviceID());
\r
375 cv::Size size = GET_PARAM(1);
\r
376 int depth = GET_PARAM(2);
\r
378 cv::Mat src_host(size, CV_MAKE_TYPE(depth, 4));
\r
379 fill(src_host, 0, 255);
\r
381 cv::gpu::GpuMat src(src_host);
\r
382 cv::gpu::GpuMat hist[4];
\r
383 cv::gpu::GpuMat buf;
\r
384 int histSize[] = {30, 30, 30, 30};
\r
385 int lowerLevel[] = {0, 0, 0, 0};
\r
386 int upperLevel[] = {180, 180, 180, 180};
\r
388 cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel);
\r
392 cv::gpu::histEven(src, hist, buf, histSize, lowerLevel, upperLevel);
\r
396 INSTANTIATE_TEST_CASE_P(ImgProc, HistEven_FourChannel, testing::Combine(
\r
398 GPU_TYPICAL_MAT_SIZES,
\r
399 testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_16S))));
\r
401 //////////////////////////////////////////////////////////////////////
\r
404 GPU_PERF_TEST(CalcHist, cv::gpu::DeviceInfo, cv::Size)
\r
406 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
407 cv::gpu::setDevice(devInfo.deviceID());
\r
409 cv::Size size = GET_PARAM(1);
\r
411 cv::Mat src_host(size, CV_8UC1);
\r
412 fill(src_host, 0, 255);
\r
414 cv::gpu::GpuMat src(src_host);
\r
415 cv::gpu::GpuMat hist;
\r
416 cv::gpu::GpuMat buf;
\r
418 cv::gpu::calcHist(src, hist, buf);
\r
422 cv::gpu::calcHist(src, hist, buf);
\r
426 INSTANTIATE_TEST_CASE_P(ImgProc, CalcHist, testing::Combine(
\r
428 GPU_TYPICAL_MAT_SIZES));
\r
430 //////////////////////////////////////////////////////////////////////
\r
433 GPU_PERF_TEST(EqualizeHist, cv::gpu::DeviceInfo, cv::Size)
\r
435 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
436 cv::gpu::setDevice(devInfo.deviceID());
\r
438 cv::Size size = GET_PARAM(1);
\r
440 cv::Mat src_host(size, CV_8UC1);
\r
441 fill(src_host, 0, 255);
\r
443 cv::gpu::GpuMat src(src_host);
\r
444 cv::gpu::GpuMat dst;
\r
445 cv::gpu::GpuMat hist;
\r
446 cv::gpu::GpuMat buf;
\r
448 cv::gpu::equalizeHist(src, dst, hist, buf);
\r
452 cv::gpu::equalizeHist(src, dst, hist, buf);
\r
456 INSTANTIATE_TEST_CASE_P(ImgProc, EqualizeHist, testing::Combine(
\r
458 GPU_TYPICAL_MAT_SIZES));
\r
460 //////////////////////////////////////////////////////////////////////
\r
463 GPU_PERF_TEST(ColumnSum, cv::gpu::DeviceInfo, cv::Size)
\r
465 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
466 cv::gpu::setDevice(devInfo.deviceID());
\r
468 cv::Size size = GET_PARAM(1);
\r
470 cv::Mat src_host(size, CV_32FC1);
\r
471 fill(src_host, 0, 255);
\r
473 cv::gpu::GpuMat src(src_host);
\r
474 cv::gpu::GpuMat dst;
\r
476 cv::gpu::columnSum(src, dst);
\r
480 cv::gpu::columnSum(src, dst);
\r
484 INSTANTIATE_TEST_CASE_P(ImgProc, ColumnSum, testing::Combine(
\r
486 GPU_TYPICAL_MAT_SIZES));
\r
488 //////////////////////////////////////////////////////////////////////
\r
491 IMPLEMENT_PARAM_CLASS(AppertureSize, int)
\r
492 IMPLEMENT_PARAM_CLASS(L2gradient, bool)
\r
494 GPU_PERF_TEST(Canny, cv::gpu::DeviceInfo, AppertureSize, L2gradient)
\r
496 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
497 cv::gpu::setDevice(devInfo.deviceID());
\r
499 int apperture_size = GET_PARAM(1);
\r
500 bool useL2gradient = GET_PARAM(2);
\r
502 cv::Mat image_host = readImage("perf/1280x1024.jpg", cv::IMREAD_GRAYSCALE);
\r
503 ASSERT_FALSE(image_host.empty());
\r
505 cv::gpu::GpuMat image(image_host);
\r
506 cv::gpu::GpuMat dst;
\r
507 cv::gpu::CannyBuf buf;
\r
509 cv::gpu::Canny(image, buf, dst, 50.0, 100.0, apperture_size, useL2gradient);
\r
513 cv::gpu::Canny(image, buf, dst, 50.0, 100.0, apperture_size, useL2gradient);
\r
517 INSTANTIATE_TEST_CASE_P(ImgProc, Canny, testing::Combine(
\r
519 testing::Values(AppertureSize(3), AppertureSize(5)),
\r
520 testing::Values(L2gradient(false), L2gradient(true))));
\r
522 //////////////////////////////////////////////////////////////////////
\r
523 // MeanShiftFiltering
\r
525 GPU_PERF_TEST_1(MeanShiftFiltering, cv::gpu::DeviceInfo)
\r
527 cv::gpu::DeviceInfo devInfo = GetParam();
\r
528 cv::gpu::setDevice(devInfo.deviceID());
\r
530 cv::Mat img = readImage("gpu/meanshift/cones.png");
\r
531 ASSERT_FALSE(img.empty());
\r
534 cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
\r
536 cv::gpu::GpuMat src(rgba);
\r
537 cv::gpu::GpuMat dst;
\r
539 cv::gpu::meanShiftFiltering(src, dst, 50, 50);
\r
545 cv::gpu::meanShiftFiltering(src, dst, 50, 50);
\r
549 INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftFiltering, ALL_DEVICES);
\r
551 //////////////////////////////////////////////////////////////////////
\r
554 GPU_PERF_TEST_1(MeanShiftProc, cv::gpu::DeviceInfo)
\r
556 cv::gpu::DeviceInfo devInfo = GetParam();
\r
557 cv::gpu::setDevice(devInfo.deviceID());
\r
559 cv::Mat img = readImage("gpu/meanshift/cones.png");
\r
560 ASSERT_FALSE(img.empty());
\r
563 cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
\r
565 cv::gpu::GpuMat src(rgba);
\r
566 cv::gpu::GpuMat dstr;
\r
567 cv::gpu::GpuMat dstsp;
\r
569 cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);
\r
575 cv::gpu::meanShiftProc(src, dstr, dstsp, 50, 50);
\r
579 INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftProc, ALL_DEVICES);
\r
581 //////////////////////////////////////////////////////////////////////
\r
582 // MeanShiftSegmentation
\r
584 GPU_PERF_TEST_1(MeanShiftSegmentation, cv::gpu::DeviceInfo)
\r
586 cv::gpu::DeviceInfo devInfo = GetParam();
\r
587 cv::gpu::setDevice(devInfo.deviceID());
\r
589 cv::Mat img = readImage("gpu/meanshift/cones.png");
\r
590 ASSERT_FALSE(img.empty());
\r
593 cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
\r
595 cv::gpu::GpuMat src(rgba);
\r
598 meanShiftSegmentation(src, dst, 10, 10, 20);
\r
604 meanShiftSegmentation(src, dst, 10, 10, 20);
\r
608 INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftSegmentation, ALL_DEVICES);
\r
610 //////////////////////////////////////////////////////////////////////
\r
613 GPU_PERF_TEST(BlendLinear, cv::gpu::DeviceInfo, cv::Size, MatType)
\r
615 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
616 cv::gpu::setDevice(devInfo.deviceID());
\r
618 cv::Size size = GET_PARAM(1);
\r
619 int type = GET_PARAM(2);
\r
621 cv::Mat img1_host(size, type);
\r
622 fill(img1_host, 0, 255);
\r
624 cv::Mat img2_host(size, type);
\r
625 fill(img2_host, 0, 255);
\r
627 cv::gpu::GpuMat img1(img1_host);
\r
628 cv::gpu::GpuMat img2(img2_host);
\r
629 cv::gpu::GpuMat weights1(size, CV_32FC1, cv::Scalar::all(0.5));
\r
630 cv::gpu::GpuMat weights2(size, CV_32FC1, cv::Scalar::all(0.5));
\r
631 cv::gpu::GpuMat dst;
\r
633 cv::gpu::blendLinear(img1, img2, weights1, weights2, dst);
\r
637 cv::gpu::blendLinear(img1, img2, weights1, weights2, dst);
\r
641 INSTANTIATE_TEST_CASE_P(ImgProc, BlendLinear, testing::Combine(
\r
643 GPU_TYPICAL_MAT_SIZES,
\r
644 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
645 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
\r
647 //////////////////////////////////////////////////////////////////////
\r
650 IMPLEMENT_PARAM_CLASS(KSize, int)
\r
651 IMPLEMENT_PARAM_CLASS(Ccorr, bool)
\r
653 GPU_PERF_TEST(Convolve, cv::gpu::DeviceInfo, cv::Size, KSize, Ccorr)
\r
655 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
656 cv::gpu::setDevice(devInfo.deviceID());
\r
658 cv::Size size = GET_PARAM(1);
\r
659 int templ_size = GET_PARAM(2);
\r
660 bool ccorr = GET_PARAM(3);
\r
662 cv::gpu::GpuMat image = cv::gpu::createContinuous(size, CV_32FC1);
\r
663 image.setTo(cv::Scalar(1.0));
\r
665 cv::gpu::GpuMat templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);
\r
666 templ.setTo(cv::Scalar(1.0));
\r
668 cv::gpu::GpuMat dst;
\r
669 cv::gpu::ConvolveBuf buf;
\r
671 cv::gpu::convolve(image, templ, dst, ccorr, buf);
\r
677 cv::gpu::convolve(image, templ, dst, ccorr, buf);
\r
681 INSTANTIATE_TEST_CASE_P(ImgProc, Convolve, testing::Combine(
\r
683 GPU_TYPICAL_MAT_SIZES,
\r
684 testing::Values(KSize(3), KSize(9), KSize(17), KSize(27), KSize(32), KSize(64)),
\r
685 testing::Values(Ccorr(false), Ccorr(true))));
\r
687 ////////////////////////////////////////////////////////////////////////////////
\r
688 // MatchTemplate_8U
\r
690 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
691 #define ALL_TEMPLATE_METHODS testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_SQDIFF_NORMED), TemplateMethod(cv::TM_CCORR), TemplateMethod(cv::TM_CCORR_NORMED), TemplateMethod(cv::TM_CCOEFF), TemplateMethod(cv::TM_CCOEFF_NORMED))
\r
693 IMPLEMENT_PARAM_CLASS(TemplateSize, cv::Size)
\r
695 GPU_PERF_TEST(MatchTemplate_8U, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)
\r
697 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
698 cv::gpu::setDevice(devInfo.deviceID());
\r
700 cv::Size size = GET_PARAM(1);
\r
701 cv::Size templ_size = GET_PARAM(2);
\r
702 int cn = GET_PARAM(3);
\r
703 int method = GET_PARAM(4);
\r
705 cv::Mat image_host(size, CV_MAKE_TYPE(CV_8U, cn));
\r
706 fill(image_host, 0, 255);
\r
708 cv::Mat templ_host(templ_size, CV_MAKE_TYPE(CV_8U, cn));
\r
709 fill(templ_host, 0, 255);
\r
711 cv::gpu::GpuMat image(image_host);
\r
712 cv::gpu::GpuMat templ(templ_host);
\r
713 cv::gpu::GpuMat dst;
\r
715 cv::gpu::matchTemplate(image, templ, dst, method);
\r
719 cv::gpu::matchTemplate(image, templ, dst, method);
\r
723 INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_8U, testing::Combine(
\r
725 GPU_TYPICAL_MAT_SIZES,
\r
726 testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),
\r
727 testing::Values(Channels(1), Channels(3), Channels(4)),
\r
728 ALL_TEMPLATE_METHODS));
\r
730 ////////////////////////////////////////////////////////////////////////////////
\r
731 // MatchTemplate_32F
\r
733 GPU_PERF_TEST(MatchTemplate_32F, cv::gpu::DeviceInfo, cv::Size, TemplateSize, Channels, TemplateMethod)
\r
735 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
736 cv::gpu::setDevice(devInfo.deviceID());
\r
738 cv::Size size = GET_PARAM(1);
\r
739 cv::Size templ_size = GET_PARAM(2);
\r
740 int cn = GET_PARAM(3);
\r
741 int method = GET_PARAM(4);
\r
743 cv::Mat image_host(size, CV_MAKE_TYPE(CV_32F, cn));
\r
744 fill(image_host, 0, 255);
\r
746 cv::Mat templ_host(templ_size, CV_MAKE_TYPE(CV_32F, cn));
\r
747 fill(templ_host, 0, 255);
\r
749 cv::gpu::GpuMat image(image_host);
\r
750 cv::gpu::GpuMat templ(templ_host);
\r
751 cv::gpu::GpuMat dst;
\r
753 cv::gpu::matchTemplate(image, templ, dst, method);
\r
757 cv::gpu::matchTemplate(image, templ, dst, method);
\r
761 INSTANTIATE_TEST_CASE_P(ImgProc, MatchTemplate_32F, testing::Combine(
\r
763 GPU_TYPICAL_MAT_SIZES,
\r
764 testing::Values(TemplateSize(cv::Size(5, 5)), TemplateSize(cv::Size(16, 16)), TemplateSize(cv::Size(30, 30))),
\r
765 testing::Values(Channels(1), Channels(3), Channels(4)),
\r
766 testing::Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR))));
\r
768 //////////////////////////////////////////////////////////////////////
\r
771 CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT)
\r
773 GPU_PERF_TEST(MulSpectrums, cv::gpu::DeviceInfo, cv::Size, DftFlags)
\r
775 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
776 cv::gpu::setDevice(devInfo.deviceID());
\r
778 cv::Size size = GET_PARAM(1);
\r
779 int flag = GET_PARAM(2);
\r
781 cv::Mat a_host(size, CV_32FC2);
\r
782 fill(a_host, 0, 100);
\r
784 cv::Mat b_host(size, CV_32FC2);
\r
785 fill(b_host, 0, 100);
\r
787 cv::gpu::GpuMat a(a_host);
\r
788 cv::gpu::GpuMat b(b_host);
\r
789 cv::gpu::GpuMat dst;
\r
791 cv::gpu::mulSpectrums(a, b, dst, flag);
\r
795 cv::gpu::mulSpectrums(a, b, dst, flag);
\r
799 INSTANTIATE_TEST_CASE_P(ImgProc, MulSpectrums, testing::Combine(
\r
801 GPU_TYPICAL_MAT_SIZES,
\r
802 testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS))));
\r
804 //////////////////////////////////////////////////////////////////////
\r
805 // MulAndScaleSpectrums
\r
807 GPU_PERF_TEST(MulAndScaleSpectrums, cv::gpu::DeviceInfo, cv::Size)
\r
809 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
810 cv::gpu::setDevice(devInfo.deviceID());
\r
812 cv::Size size = GET_PARAM(1);
\r
814 float scale = 1.f / size.area();
\r
816 cv::Mat src1_host(size, CV_32FC2);
\r
817 fill(src1_host, 0, 100);
\r
819 cv::Mat src2_host(size, CV_32FC2);
\r
820 fill(src2_host, 0, 100);
\r
822 cv::gpu::GpuMat src1(src1_host);
\r
823 cv::gpu::GpuMat src2(src2_host);
\r
824 cv::gpu::GpuMat dst;
\r
826 cv::gpu::mulAndScaleSpectrums(src1, src2, dst, cv::DFT_ROWS, scale, false);
\r
830 cv::gpu::mulAndScaleSpectrums(src1, src2, dst, cv::DFT_ROWS, scale, false);
\r
834 INSTANTIATE_TEST_CASE_P(ImgProc, MulAndScaleSpectrums, testing::Combine(
\r
836 GPU_TYPICAL_MAT_SIZES));
\r
838 //////////////////////////////////////////////////////////////////////
\r
841 GPU_PERF_TEST(Dft, cv::gpu::DeviceInfo, cv::Size, DftFlags)
\r
843 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
844 cv::gpu::setDevice(devInfo.deviceID());
\r
846 cv::Size size = GET_PARAM(1);
\r
847 int flag = GET_PARAM(2);
\r
849 cv::Mat src_host(size, CV_32FC2);
\r
850 fill(src_host, 0, 100);
\r
852 cv::gpu::GpuMat src(src_host);
\r
853 cv::gpu::GpuMat dst;
\r
855 cv::gpu::dft(src, dst, size, flag);
\r
861 cv::gpu::dft(src, dst, size, flag);
\r
865 INSTANTIATE_TEST_CASE_P(ImgProc, Dft, testing::Combine(
\r
867 GPU_TYPICAL_MAT_SIZES,
\r
868 testing::Values(DftFlags(0), DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))));
\r
870 //////////////////////////////////////////////////////////////////////
\r
873 IMPLEMENT_PARAM_CLASS(BlockSize, int)
\r
874 IMPLEMENT_PARAM_CLASS(ApertureSize, int)
\r
876 GPU_PERF_TEST(CornerHarris, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)
\r
878 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
879 cv::gpu::setDevice(devInfo.deviceID());
\r
881 int type = GET_PARAM(1);
\r
882 int borderType = GET_PARAM(2);
\r
883 int blockSize = GET_PARAM(3);
\r
884 int apertureSize = GET_PARAM(4);
\r
886 cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
\r
887 ASSERT_FALSE(img.empty());
\r
889 img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
\r
891 cv::gpu::GpuMat src(img);
\r
892 cv::gpu::GpuMat dst;
\r
893 cv::gpu::GpuMat Dx;
\r
894 cv::gpu::GpuMat Dy;
\r
895 cv::gpu::GpuMat buf;
\r
899 cv::gpu::cornerHarris(src, dst, Dx, Dy, buf, blockSize, apertureSize, k, borderType);
\r
903 cv::gpu::cornerHarris(src, dst, Dx, Dy, buf, blockSize, apertureSize, k, borderType);
\r
907 INSTANTIATE_TEST_CASE_P(ImgProc, CornerHarris, testing::Combine(
\r
909 testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
\r
910 testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
\r
911 testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
\r
912 testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
\r
914 //////////////////////////////////////////////////////////////////////
\r
915 // CornerMinEigenVal
\r
917 GPU_PERF_TEST(CornerMinEigenVal, cv::gpu::DeviceInfo, MatType, BorderMode, BlockSize, ApertureSize)
\r
919 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
920 cv::gpu::setDevice(devInfo.deviceID());
\r
922 int type = GET_PARAM(1);
\r
923 int borderType = GET_PARAM(2);
\r
924 int blockSize = GET_PARAM(3);
\r
925 int apertureSize = GET_PARAM(4);
\r
927 cv::Mat img = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE);
\r
928 ASSERT_FALSE(img.empty());
\r
930 img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
\r
932 cv::gpu::GpuMat src(img);
\r
933 cv::gpu::GpuMat dst;
\r
934 cv::gpu::GpuMat Dx;
\r
935 cv::gpu::GpuMat Dy;
\r
936 cv::gpu::GpuMat buf;
\r
938 cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, buf, blockSize, apertureSize, borderType);
\r
942 cv::gpu::cornerMinEigenVal(src, dst, Dx, Dy, buf, blockSize, apertureSize, borderType);
\r
946 INSTANTIATE_TEST_CASE_P(ImgProc, CornerMinEigenVal, testing::Combine(
\r
948 testing::Values(MatType(CV_8UC1), MatType(CV_32FC1)),
\r
949 testing::Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
\r
950 testing::Values(BlockSize(3), BlockSize(5), BlockSize(7)),
\r
951 testing::Values(ApertureSize(0), ApertureSize(3), ApertureSize(5), ApertureSize(7))));
\r
953 //////////////////////////////////////////////////////////////////////
\r
954 // BuildWarpPlaneMaps
\r
956 GPU_PERF_TEST(BuildWarpPlaneMaps, cv::gpu::DeviceInfo, cv::Size)
\r
958 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
959 cv::gpu::setDevice(devInfo.deviceID());
\r
961 cv::Size size = GET_PARAM(1);
\r
963 cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
\r
964 cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
\r
965 cv::Mat T = cv::Mat::zeros(1, 3, CV_32F);
\r
966 cv::gpu::GpuMat map_x;
\r
967 cv::gpu::GpuMat map_y;
\r
969 cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, map_x, map_y);
\r
973 cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, map_x, map_y);
\r
977 INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpPlaneMaps, testing::Combine(
\r
979 GPU_TYPICAL_MAT_SIZES));
\r
981 //////////////////////////////////////////////////////////////////////
\r
982 // BuildWarpCylindricalMaps
\r
984 GPU_PERF_TEST(BuildWarpCylindricalMaps, cv::gpu::DeviceInfo, cv::Size)
\r
986 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
987 cv::gpu::setDevice(devInfo.deviceID());
\r
989 cv::Size size = GET_PARAM(1);
\r
991 cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
\r
992 cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
\r
993 cv::gpu::GpuMat map_x;
\r
994 cv::gpu::GpuMat map_y;
\r
996 cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
\r
1000 cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
\r
1004 INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpCylindricalMaps, testing::Combine(
\r
1006 GPU_TYPICAL_MAT_SIZES));
\r
1008 //////////////////////////////////////////////////////////////////////
\r
1009 // BuildWarpSphericalMaps
\r
1011 GPU_PERF_TEST(BuildWarpSphericalMaps, cv::gpu::DeviceInfo, cv::Size)
\r
1013 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1014 cv::gpu::setDevice(devInfo.deviceID());
\r
1016 cv::Size size = GET_PARAM(1);
\r
1018 cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
\r
1019 cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
\r
1020 cv::gpu::GpuMat map_x;
\r
1021 cv::gpu::GpuMat map_y;
\r
1023 cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
\r
1027 cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, map_x, map_y);
\r
1031 INSTANTIATE_TEST_CASE_P(ImgProc, BuildWarpSphericalMaps, testing::Combine(
\r
1033 GPU_TYPICAL_MAT_SIZES));
\r
1035 //////////////////////////////////////////////////////////////////////
\r
1038 GPU_PERF_TEST(Rotate, cv::gpu::DeviceInfo, cv::Size, MatType, Interpolation)
\r
1040 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1041 cv::gpu::setDevice(devInfo.deviceID());
\r
1043 cv::Size size = GET_PARAM(1);
\r
1044 int type = GET_PARAM(2);
\r
1045 int interpolation = GET_PARAM(3);
\r
1047 cv::Mat src_host(size, type);
\r
1048 fill(src_host, 0, 255);
\r
1050 cv::gpu::GpuMat src(src_host);
\r
1051 cv::gpu::GpuMat dst;
\r
1053 cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation);
\r
1057 cv::gpu::rotate(src, dst, size, 30.0, 0, 0, interpolation);
\r
1061 INSTANTIATE_TEST_CASE_P(ImgProc, Rotate, testing::Combine(
\r
1063 GPU_TYPICAL_MAT_SIZES,
\r
1064 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
1065 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
1066 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
\r
1067 testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))));
\r
1069 //////////////////////////////////////////////////////////////////////
\r
1072 GPU_PERF_TEST(PyrDown, cv::gpu::DeviceInfo, cv::Size, MatType)
\r
1074 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1075 cv::gpu::setDevice(devInfo.deviceID());
\r
1077 cv::Size size = GET_PARAM(1);
\r
1078 int type = GET_PARAM(2);
\r
1080 cv::Mat src_host(size, type);
\r
1081 fill(src_host, 0, 255);
\r
1083 cv::gpu::GpuMat src(src_host);
\r
1084 cv::gpu::GpuMat dst;
\r
1086 cv::gpu::pyrDown(src, dst);
\r
1090 cv::gpu::pyrDown(src, dst);
\r
1094 INSTANTIATE_TEST_CASE_P(ImgProc, PyrDown, testing::Combine(
\r
1096 GPU_TYPICAL_MAT_SIZES,
\r
1097 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
1098 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
1099 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
\r
1101 //////////////////////////////////////////////////////////////////////
\r
1104 GPU_PERF_TEST(PyrUp, cv::gpu::DeviceInfo, cv::Size, MatType)
\r
1106 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1107 cv::gpu::setDevice(devInfo.deviceID());
\r
1109 cv::Size size = GET_PARAM(1);
\r
1110 int type = GET_PARAM(2);
\r
1112 cv::Mat src_host(size, type);
\r
1113 fill(src_host, 0, 255);
\r
1115 cv::gpu::GpuMat src(src_host);
\r
1116 cv::gpu::GpuMat dst;
\r
1118 cv::gpu::pyrUp(src, dst);
\r
1122 cv::gpu::pyrUp(src, dst);
\r
1126 INSTANTIATE_TEST_CASE_P(ImgProc, PyrUp, testing::Combine(
\r
1128 GPU_TYPICAL_MAT_SIZES,
\r
1129 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
1130 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
1131 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
\r
1133 //////////////////////////////////////////////////////////////////////
\r
1136 GPU_PERF_TEST(CvtColor, cv::gpu::DeviceInfo, cv::Size, MatDepth, CvtColorInfo)
\r
1138 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1139 cv::gpu::setDevice(devInfo.deviceID());
\r
1141 cv::Size size = GET_PARAM(1);
\r
1142 int depth = GET_PARAM(2);
\r
1143 CvtColorInfo info = GET_PARAM(3);
\r
1145 cv::Mat src_host(size, CV_MAKETYPE(depth, info.scn));
\r
1146 fill(src_host, 0, 255);
\r
1148 cv::gpu::GpuMat src(src_host);
\r
1149 cv::gpu::GpuMat dst;
\r
1151 cv::gpu::cvtColor(src, dst, info.code, info.dcn);
\r
1155 cv::gpu::cvtColor(src, dst, info.code, info.dcn);
\r
1159 INSTANTIATE_TEST_CASE_P(ImgProc, CvtColor, testing::Combine(
\r
1161 GPU_TYPICAL_MAT_SIZES,
\r
1162 testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)),
\r
1163 testing::Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA),
\r
1164 CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY),
\r
1165 CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),
\r
1166 CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ),
\r
1167 CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR),
\r
1168 CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb),
\r
1169 CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR),
\r
1170 CvtColorInfo(3, 3, cv::COLOR_BGR2YUV),
\r
1171 CvtColorInfo(3, 3, cv::COLOR_YUV2BGR),
\r
1172 CvtColorInfo(3, 3, cv::COLOR_BGR2HSV),
\r
1173 CvtColorInfo(3, 3, cv::COLOR_HSV2BGR),
\r
1174 CvtColorInfo(3, 3, cv::COLOR_BGR2HLS),
\r
1175 CvtColorInfo(3, 3, cv::COLOR_HLS2BGR))));
\r
1177 //////////////////////////////////////////////////////////////////////
\r
1180 GPU_PERF_TEST(SwapChannels, cv::gpu::DeviceInfo, cv::Size)
\r
1182 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1183 cv::gpu::setDevice(devInfo.deviceID());
\r
1185 cv::Size size = GET_PARAM(1);
\r
1187 cv::Mat src_host(size, CV_8UC4);
\r
1188 fill(src_host, 0, 255);
\r
1190 cv::gpu::GpuMat src(src_host);
\r
1192 const int dstOrder[] = {2, 1, 0, 3};
\r
1194 cv::gpu::swapChannels(src, dstOrder);
\r
1198 cv::gpu::swapChannels(src, dstOrder);
\r
1202 INSTANTIATE_TEST_CASE_P(ImgProc, SwapChannels, testing::Combine(ALL_DEVICES, GPU_TYPICAL_MAT_SIZES));
\r
1204 //////////////////////////////////////////////////////////////////////
\r
1207 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
1209 GPU_PERF_TEST(AlphaComp, cv::gpu::DeviceInfo, cv::Size, MatType, AlphaOp)
\r
1211 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1212 cv::gpu::setDevice(devInfo.deviceID());
\r
1214 cv::Size size = GET_PARAM(1);
\r
1215 int type = GET_PARAM(2);
\r
1216 int alpha_op = GET_PARAM(3);
\r
1218 cv::Mat img1_host(size, type);
\r
1219 fill(img1_host, 0, 255);
\r
1221 cv::Mat img2_host(size, type);
\r
1222 fill(img2_host, 0, 255);
\r
1224 cv::gpu::GpuMat img1(img1_host);
\r
1225 cv::gpu::GpuMat img2(img2_host);
\r
1226 cv::gpu::GpuMat dst;
\r
1228 cv::gpu::alphaComp(img1, img2, dst, alpha_op);
\r
1232 cv::gpu::alphaComp(img1, img2, dst, alpha_op);
\r
1236 INSTANTIATE_TEST_CASE_P(ImgProc, AlphaComp, testing::Combine(
\r
1238 GPU_TYPICAL_MAT_SIZES,
\r
1239 testing::Values(MatType(CV_8UC4), MatType(CV_16UC4), MatType(CV_32SC4), MatType(CV_32FC4)),
\r
1240 testing::Values(AlphaOp(cv::gpu::ALPHA_OVER),
\r
1241 AlphaOp(cv::gpu::ALPHA_IN),
\r
1242 AlphaOp(cv::gpu::ALPHA_OUT),
\r
1243 AlphaOp(cv::gpu::ALPHA_ATOP),
\r
1244 AlphaOp(cv::gpu::ALPHA_XOR),
\r
1245 AlphaOp(cv::gpu::ALPHA_PLUS),
\r
1246 AlphaOp(cv::gpu::ALPHA_OVER_PREMUL),
\r
1247 AlphaOp(cv::gpu::ALPHA_IN_PREMUL),
\r
1248 AlphaOp(cv::gpu::ALPHA_OUT_PREMUL),
\r
1249 AlphaOp(cv::gpu::ALPHA_ATOP_PREMUL),
\r
1250 AlphaOp(cv::gpu::ALPHA_XOR_PREMUL),
\r
1251 AlphaOp(cv::gpu::ALPHA_PLUS_PREMUL),
\r
1252 AlphaOp(cv::gpu::ALPHA_PREMUL))));
\r
1254 //////////////////////////////////////////////////////////////////////
\r
1257 GPU_PERF_TEST(ImagePyramid_build, cv::gpu::DeviceInfo, cv::Size, MatType)
\r
1259 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1260 cv::gpu::setDevice(devInfo.deviceID());
\r
1262 cv::Size size = GET_PARAM(1);
\r
1263 int type = GET_PARAM(2);
\r
1265 cv::Mat src_host(size, type);
\r
1266 fill(src_host, 0, 255);
\r
1268 cv::gpu::GpuMat src(src_host);
\r
1270 cv::gpu::ImagePyramid pyr;
\r
1272 pyr.build(src, 5);
\r
1276 pyr.build(src, 5);
\r
1280 INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_build, testing::Combine(
\r
1282 GPU_TYPICAL_MAT_SIZES,
\r
1283 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
1284 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
1285 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
\r
1287 GPU_PERF_TEST(ImagePyramid_getLayer, cv::gpu::DeviceInfo, cv::Size, MatType)
\r
1289 cv::gpu::DeviceInfo devInfo = GET_PARAM(0);
\r
1290 cv::gpu::setDevice(devInfo.deviceID());
\r
1292 cv::Size size = GET_PARAM(1);
\r
1293 int type = GET_PARAM(2);
\r
1295 cv::Mat src_host(size, type);
\r
1296 fill(src_host, 0, 255);
\r
1298 cv::gpu::GpuMat src(src_host);
\r
1299 cv::gpu::GpuMat dst;
\r
1301 cv::gpu::ImagePyramid pyr(src, 3);
\r
1303 pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));
\r
1307 pyr.getLayer(dst, cv::Size(size.width / 2 + 10, size.height / 2 + 10));
\r
1311 INSTANTIATE_TEST_CASE_P(ImgProc, ImagePyramid_getLayer, testing::Combine(
\r
1313 GPU_TYPICAL_MAT_SIZES,
\r
1314 testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4),
\r
1315 MatType(CV_16UC1), MatType(CV_16UC3), MatType(CV_16UC4),
\r
1316 MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4))));
\r