1 #include "perf_precomp.hpp"
\r
4 using namespace testing;
\r
8 //////////////////////////////////////////////////////////////////////
\r
11 enum{HALF_SIZE=0, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH};
\r
12 CV_ENUM(RemapMode, HALF_SIZE, UPSIDE_DOWN, REFLECTION_X, REFLECTION_BOTH);
\r
13 #define ALL_REMAP_MODES ValuesIn(RemapMode::all())
\r
15 void generateMap(cv::Mat& map_x, cv::Mat& map_y, int remapMode)
\r
17 for (int j = 0; j < map_x.rows; ++j)
\r
19 for (int i = 0; i < map_x.cols; ++i)
\r
24 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
26 map_x.at<float>(j,i) = 2.f * (i - map_x.cols * 0.25f) + 0.5f;
\r
27 map_y.at<float>(j,i) = 2.f * (j - map_x.rows * 0.25f) + 0.5f;
\r
31 map_x.at<float>(j,i) = 0.f;
\r
32 map_y.at<float>(j,i) = 0.f;
\r
36 map_x.at<float>(j,i) = static_cast<float>(i);
\r
37 map_y.at<float>(j,i) = static_cast<float>(map_x.rows - j);
\r
40 map_x.at<float>(j,i) = static_cast<float>(map_x.cols - i);
\r
41 map_y.at<float>(j,i) = static_cast<float>(j);
\r
43 case REFLECTION_BOTH:
\r
44 map_x.at<float>(j,i) = static_cast<float>(map_x.cols - i);
\r
45 map_y.at<float>(j,i) = static_cast<float>(map_x.rows - j);
\r
52 DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border_Mode, cv::Size, MatDepth, int, Interpolation, BorderMode, RemapMode);
\r
54 PERF_TEST_P(Sz_Depth_Cn_Inter_Border_Mode, ImgProc_Remap, Combine(
\r
55 GPU_TYPICAL_MAT_SIZES,
\r
56 Values(CV_8U, CV_16U, CV_32F),
\r
58 Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
\r
64 cv::Size size = GET_PARAM(0);
\r
65 int depth = GET_PARAM(1);
\r
66 int channels = GET_PARAM(2);
\r
67 int interpolation = GET_PARAM(3);
\r
68 int borderMode = GET_PARAM(4);
\r
69 int remapMode = GET_PARAM(5);
\r
71 int type = CV_MAKE_TYPE(depth, channels);
\r
73 cv::Mat src(size, type);
\r
76 cv::Mat xmap(size, CV_32FC1);
\r
77 cv::Mat ymap(size, CV_32FC1);
\r
79 generateMap(xmap, ymap, remapMode);
\r
83 cv::gpu::GpuMat d_src(src);
\r
84 cv::gpu::GpuMat d_xmap(xmap);
\r
85 cv::gpu::GpuMat d_ymap(ymap);
\r
86 cv::gpu::GpuMat d_dst;
\r
88 cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
\r
92 cv::gpu::remap(d_src, d_dst, d_xmap, d_ymap, interpolation, borderMode);
\r
99 cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
\r
103 cv::remap(src, dst, xmap, ymap, interpolation, borderMode);
\r
108 //////////////////////////////////////////////////////////////////////
\r
111 DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Scale, cv::Size, MatDepth, int, Interpolation, double);
\r
113 PERF_TEST_P(Sz_Depth_Cn_Inter_Scale, ImgProc_Resize, Combine(
\r
114 GPU_TYPICAL_MAT_SIZES,
\r
115 Values(CV_8U, CV_16U, CV_32F),
\r
117 ALL_INTERPOLATIONS,
\r
118 Values(0.5, 0.3, 2.0)))
\r
120 declare.time(20.0);
\r
122 cv::Size size = GET_PARAM(0);
\r
123 int depth = GET_PARAM(1);
\r
124 int channels = GET_PARAM(2);
\r
125 int interpolation = GET_PARAM(3);
\r
126 double f = GET_PARAM(4);
\r
128 int type = CV_MAKE_TYPE(depth, channels);
\r
130 cv::Mat src(size, type);
\r
135 cv::gpu::GpuMat d_src(src);
\r
136 cv::gpu::GpuMat d_dst;
\r
138 cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
\r
142 cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
\r
149 cv::resize(src, dst, cv::Size(), f, f, interpolation);
\r
153 cv::resize(src, dst, cv::Size(), f, f, interpolation);
\r
158 //////////////////////////////////////////////////////////////////////
\r
161 DEF_PARAM_TEST(Sz_Depth_Cn_Scale, cv::Size, MatDepth, int, double);
\r
163 PERF_TEST_P(Sz_Depth_Cn_Scale, ImgProc_ResizeArea, Combine(
\r
164 GPU_TYPICAL_MAT_SIZES,
\r
165 Values(CV_8U, CV_16U, CV_32F),
\r
167 Values(0.2, 0.1, 0.05)))
\r
171 cv::Size size = GET_PARAM(0);
\r
172 int depth = GET_PARAM(1);
\r
173 int channels = GET_PARAM(2);
\r
174 int interpolation = cv::INTER_AREA;
\r
175 double f = GET_PARAM(3);
\r
177 int type = CV_MAKE_TYPE(depth, channels);
\r
179 cv::Mat src(size, type);
\r
184 cv::gpu::GpuMat d_src(src);
\r
185 cv::gpu::GpuMat d_dst;
\r
187 cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
\r
191 cv::gpu::resize(d_src, d_dst, cv::Size(), f, f, interpolation);
\r
198 cv::resize(src, dst, cv::Size(), f, f, interpolation);
\r
202 cv::resize(src, dst, cv::Size(), f, f, interpolation);
\r
207 //////////////////////////////////////////////////////////////////////
\r
210 DEF_PARAM_TEST(Sz_Depth_Cn_Inter_Border, cv::Size, MatDepth, int, Interpolation, BorderMode);
\r
212 PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpAffine, Combine(
\r
213 GPU_TYPICAL_MAT_SIZES,
\r
214 Values(CV_8U, CV_16U, CV_32F),
\r
216 Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
\r
219 declare.time(20.0);
\r
221 cv::Size size = GET_PARAM(0);
\r
222 int depth = GET_PARAM(1);
\r
223 int channels = GET_PARAM(2);
\r
224 int interpolation = GET_PARAM(3);
\r
225 int borderMode = GET_PARAM(4);
\r
227 int type = CV_MAKE_TYPE(depth, channels);
\r
229 cv::Mat src(size, type);
\r
232 const double aplha = CV_PI / 4;
\r
233 double mat[2][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},
\r
234 {std::sin(aplha), std::cos(aplha), 0}};
\r
235 cv::Mat M(2, 3, CV_64F, (void*) mat);
\r
239 cv::gpu::GpuMat d_src(src);
\r
240 cv::gpu::GpuMat d_dst;
\r
242 cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);
\r
246 cv::gpu::warpAffine(d_src, d_dst, M, size, interpolation, borderMode);
\r
253 cv::warpAffine(src, dst, M, size, interpolation, borderMode);
\r
257 cv::warpAffine(src, dst, M, size, interpolation, borderMode);
\r
262 //////////////////////////////////////////////////////////////////////
\r
265 PERF_TEST_P(Sz_Depth_Cn_Inter_Border, ImgProc_WarpPerspective, Combine(
\r
266 GPU_TYPICAL_MAT_SIZES,
\r
267 Values(CV_8U, CV_16U, CV_32F),
\r
269 Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC)),
\r
272 declare.time(20.0);
\r
274 cv::Size size = GET_PARAM(0);
\r
275 int depth = GET_PARAM(1);
\r
276 int channels = GET_PARAM(2);
\r
277 int interpolation = GET_PARAM(3);
\r
278 int borderMode = GET_PARAM(4);
\r
280 int type = CV_MAKE_TYPE(depth, channels);
\r
282 cv::Mat src(size, type);
\r
285 const double aplha = CV_PI / 4;
\r
286 double mat[3][3] = { {std::cos(aplha), -std::sin(aplha), src.cols / 2},
\r
287 {std::sin(aplha), std::cos(aplha), 0},
\r
289 cv::Mat M(3, 3, CV_64F, (void*) mat);
\r
293 cv::gpu::GpuMat d_src(src);
\r
294 cv::gpu::GpuMat d_dst;
\r
296 cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);
\r
300 cv::gpu::warpPerspective(d_src, d_dst, M, size, interpolation, borderMode);
\r
307 cv::warpPerspective(src, dst, M, size, interpolation, borderMode);
\r
311 cv::warpPerspective(src, dst, M, size, interpolation, borderMode);
\r
316 //////////////////////////////////////////////////////////////////////
\r
319 DEF_PARAM_TEST(Sz_Depth_Cn_Border, cv::Size, MatDepth, int, BorderMode);
\r
321 PERF_TEST_P(Sz_Depth_Cn_Border, ImgProc_CopyMakeBorder, Combine(
\r
322 GPU_TYPICAL_MAT_SIZES,
\r
323 Values(CV_8U, CV_16U, CV_32F),
\r
327 cv::Size size = GET_PARAM(0);
\r
328 int depth = GET_PARAM(1);
\r
329 int channels = GET_PARAM(2);
\r
330 int borderMode = GET_PARAM(3);
\r
332 int type = CV_MAKE_TYPE(depth, channels);
\r
334 cv::Mat src(size, type);
\r
339 cv::gpu::GpuMat d_src(src);
\r
340 cv::gpu::GpuMat d_dst;
\r
342 cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);
\r
346 cv::gpu::copyMakeBorder(d_src, d_dst, 5, 5, 5, 5, borderMode);
\r
353 cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);
\r
357 cv::copyMakeBorder(src, dst, 5, 5, 5, 5, borderMode);
\r
362 //////////////////////////////////////////////////////////////////////
\r
365 CV_ENUM(ThreshOp, cv::THRESH_BINARY, cv::THRESH_BINARY_INV, cv::THRESH_TRUNC, cv::THRESH_TOZERO, cv::THRESH_TOZERO_INV)
\r
366 #define ALL_THRESH_OPS ValuesIn(ThreshOp::all())
\r
368 DEF_PARAM_TEST(Sz_Depth_Op, cv::Size, MatDepth, ThreshOp);
\r
370 PERF_TEST_P(Sz_Depth_Op, ImgProc_Threshold, Combine(
\r
371 GPU_TYPICAL_MAT_SIZES,
\r
372 Values(CV_8U, CV_16U, CV_32F, CV_64F),
\r
375 cv::Size size = GET_PARAM(0);
\r
376 int depth = GET_PARAM(1);
\r
377 int threshOp = GET_PARAM(2);
\r
379 cv::Mat src(size, depth);
\r
384 cv::gpu::GpuMat d_src(src);
\r
385 cv::gpu::GpuMat d_dst;
\r
387 cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);
\r
391 cv::gpu::threshold(d_src, d_dst, 100.0, 255.0, threshOp);
\r
398 cv::threshold(src, dst, 100.0, 255.0, threshOp);
\r
402 cv::threshold(src, dst, 100.0, 255.0, threshOp);
\r
407 //////////////////////////////////////////////////////////////////////
\r
410 PERF_TEST_P(Sz, ImgProc_Integral, GPU_TYPICAL_MAT_SIZES)
\r
412 cv::Size size = GetParam();
\r
414 cv::Mat src(size, CV_8UC1);
\r
419 cv::gpu::GpuMat d_src(src);
\r
420 cv::gpu::GpuMat d_dst;
\r
421 cv::gpu::GpuMat d_buf;
\r
423 cv::gpu::integralBuffered(d_src, d_dst, d_buf);
\r
427 cv::gpu::integralBuffered(d_src, d_dst, d_buf);
\r
434 cv::integral(src, dst);
\r
438 cv::integral(src, dst);
\r
443 //////////////////////////////////////////////////////////////////////
\r
446 PERF_TEST_P(Sz, ImgProc_IntegralSqr, GPU_TYPICAL_MAT_SIZES)
\r
448 cv::Size size = GetParam();
\r
450 cv::Mat src(size, CV_8UC1);
\r
455 cv::gpu::GpuMat d_src(src);
\r
456 cv::gpu::GpuMat d_dst;
\r
458 cv::gpu::sqrIntegral(d_src, d_dst);
\r
462 cv::gpu::sqrIntegral(d_src, d_dst);
\r
471 //////////////////////////////////////////////////////////////////////
\r
474 PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC1, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S)))
\r
476 cv::Size size = GET_PARAM(0);
\r
477 int depth = GET_PARAM(1);
\r
479 cv::Mat src(size, depth);
\r
484 cv::gpu::GpuMat d_src(src);
\r
485 cv::gpu::GpuMat d_hist;
\r
486 cv::gpu::GpuMat d_buf;
\r
488 cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);
\r
492 cv::gpu::histEven(d_src, d_hist, d_buf, 30, 0, 180);
\r
498 float hranges[] = {0.0f, 180.0f};
\r
499 int histSize[] = {hbins};
\r
500 const float* ranges[] = {hranges};
\r
501 int channels[] = {0};
\r
505 cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);
\r
509 cv::calcHist(&src, 1, channels, cv::Mat(), hist, 1, histSize, ranges);
\r
514 //////////////////////////////////////////////////////////////////////
\r
517 PERF_TEST_P(Sz_Depth, ImgProc_HistEvenC4, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_16S)))
\r
519 cv::Size size = GET_PARAM(0);
\r
520 int depth = GET_PARAM(1);
\r
522 cv::Mat src(size, CV_MAKE_TYPE(depth, 4));
\r
525 int histSize[] = {30, 30, 30, 30};
\r
526 int lowerLevel[] = {0, 0, 0, 0};
\r
527 int upperLevel[] = {180, 180, 180, 180};
\r
531 cv::gpu::GpuMat d_src(src);
\r
532 cv::gpu::GpuMat d_hist[4];
\r
533 cv::gpu::GpuMat d_buf;
\r
535 cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);
\r
539 cv::gpu::histEven(d_src, d_hist, d_buf, histSize, lowerLevel, upperLevel);
\r
548 //////////////////////////////////////////////////////////////////////
\r
551 PERF_TEST_P(Sz, ImgProc_CalcHist, GPU_TYPICAL_MAT_SIZES)
\r
553 cv::Size size = GetParam();
\r
555 cv::Mat src(size, CV_8UC1);
\r
560 cv::gpu::GpuMat d_src(src);
\r
561 cv::gpu::GpuMat d_hist;
\r
562 cv::gpu::GpuMat d_buf;
\r
564 cv::gpu::calcHist(d_src, d_hist, d_buf);
\r
568 cv::gpu::calcHist(d_src, d_hist, d_buf);
\r
577 //////////////////////////////////////////////////////////////////////
\r
580 PERF_TEST_P(Sz, ImgProc_EqualizeHist, GPU_TYPICAL_MAT_SIZES)
\r
582 cv::Size size = GetParam();
\r
584 cv::Mat src(size, CV_8UC1);
\r
589 cv::gpu::GpuMat d_src(src);
\r
590 cv::gpu::GpuMat d_dst;
\r
591 cv::gpu::GpuMat d_hist;
\r
592 cv::gpu::GpuMat d_buf;
\r
594 cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);
\r
598 cv::gpu::equalizeHist(d_src, d_dst, d_hist, d_buf);
\r
605 cv::equalizeHist(src, dst);
\r
609 cv::equalizeHist(src, dst);
\r
614 //////////////////////////////////////////////////////////////////////
\r
617 PERF_TEST_P(Sz, ImgProc_ColumnSum, GPU_TYPICAL_MAT_SIZES)
\r
619 cv::Size size = GetParam();
\r
621 cv::Mat src(size, CV_32FC1);
\r
626 cv::gpu::GpuMat d_src(src);
\r
627 cv::gpu::GpuMat d_dst;
\r
629 cv::gpu::columnSum(d_src, d_dst);
\r
633 cv::gpu::columnSum(d_src, d_dst);
\r
642 //////////////////////////////////////////////////////////////////////
\r
645 DEF_PARAM_TEST(Image_AppertureSz_L2gradient, string, int, bool);
\r
647 PERF_TEST_P(Image_AppertureSz_L2gradient, ImgProc_Canny, Combine(
\r
648 Values("perf/800x600.jpg", "perf/1280x1024.jpg", "perf/1680x1050.jpg"),
\r
652 string fileName = GET_PARAM(0);
\r
653 int apperture_size = GET_PARAM(1);
\r
654 bool useL2gradient = GET_PARAM(2);
\r
656 cv::Mat image = readImage(fileName, cv::IMREAD_GRAYSCALE);
\r
657 ASSERT_FALSE(image.empty());
\r
661 cv::gpu::GpuMat d_image(image);
\r
662 cv::gpu::GpuMat d_dst;
\r
663 cv::gpu::CannyBuf d_buf;
\r
665 cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);
\r
669 cv::gpu::Canny(d_image, d_buf, d_dst, 50.0, 100.0, apperture_size, useL2gradient);
\r
676 cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);
\r
680 cv::Canny(image, dst, 50.0, 100.0, apperture_size, useL2gradient);
\r
685 //////////////////////////////////////////////////////////////////////
\r
686 // MeanShiftFiltering
\r
688 DEF_PARAM_TEST_1(Image, string);
\r
690 PERF_TEST_P(Image, ImgProc_MeanShiftFiltering, Values<string>("gpu/meanshift/cones.png"))
\r
692 declare.time(15.0);
\r
694 cv::Mat img = readImage(GetParam());
\r
695 ASSERT_FALSE(img.empty());
\r
698 cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
\r
702 cv::gpu::GpuMat d_src(rgba);
\r
703 cv::gpu::GpuMat d_dst;
\r
705 cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);
\r
709 cv::gpu::meanShiftFiltering(d_src, d_dst, 50, 50);
\r
716 cv::pyrMeanShiftFiltering(img, dst, 50, 50);
\r
720 cv::pyrMeanShiftFiltering(img, dst, 50, 50);
\r
725 //////////////////////////////////////////////////////////////////////
\r
728 PERF_TEST_P(Image, ImgProc_MeanShiftProc, Values<string>("gpu/meanshift/cones.png"))
\r
732 cv::Mat img = readImage(GetParam());
\r
733 ASSERT_FALSE(img.empty());
\r
736 cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
\r
740 cv::gpu::GpuMat d_src(rgba);
\r
741 cv::gpu::GpuMat d_dstr;
\r
742 cv::gpu::GpuMat d_dstsp;
\r
744 cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);
\r
748 cv::gpu::meanShiftProc(d_src, d_dstr, d_dstsp, 50, 50);
\r
757 //////////////////////////////////////////////////////////////////////
\r
758 // MeanShiftSegmentation
\r
760 PERF_TEST_P(Image, ImgProc_MeanShiftSegmentation, Values<string>("gpu/meanshift/cones.png"))
\r
764 cv::Mat img = readImage(GetParam());
\r
765 ASSERT_FALSE(img.empty());
\r
768 cv::cvtColor(img, rgba, cv::COLOR_BGR2BGRA);
\r
774 cv::gpu::GpuMat d_src(rgba);
\r
776 cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);
\r
780 cv::gpu::meanShiftSegmentation(d_src, dst, 10, 10, 20);
\r
789 //////////////////////////////////////////////////////////////////////
\r
792 PERF_TEST_P(Sz_Depth_Cn, ImgProc_BlendLinear, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_32F), Values(1, 3, 4)))
\r
794 cv::Size size = GET_PARAM(0);
\r
795 int depth = GET_PARAM(1);
\r
796 int channels = GET_PARAM(2);
\r
798 int type = CV_MAKE_TYPE(depth, channels);
\r
800 cv::Mat img1(size, type);
\r
803 cv::Mat img2(size, type);
\r
808 cv::gpu::GpuMat d_img1(img1);
\r
809 cv::gpu::GpuMat d_img2(img2);
\r
810 cv::gpu::GpuMat d_weights1(size, CV_32FC1, cv::Scalar::all(0.5));
\r
811 cv::gpu::GpuMat d_weights2(size, CV_32FC1, cv::Scalar::all(0.5));
\r
812 cv::gpu::GpuMat d_dst;
\r
814 cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);
\r
818 cv::gpu::blendLinear(d_img1, d_img2, d_weights1, d_weights2, d_dst);
\r
827 //////////////////////////////////////////////////////////////////////
\r
830 DEF_PARAM_TEST(Sz_KernelSz_Ccorr, cv::Size, int, bool);
\r
832 PERF_TEST_P(Sz_KernelSz_Ccorr, ImgProc_Convolve, Combine(GPU_TYPICAL_MAT_SIZES, Values(17, 27, 32, 64), Bool()))
\r
834 declare.time(10.0);
\r
836 cv::Size size = GET_PARAM(0);
\r
837 int templ_size = GET_PARAM(1);
\r
838 bool ccorr = GET_PARAM(2);
\r
840 cv::Mat image(size, CV_32FC1);
\r
843 cv::Mat templ(templ_size, templ_size, CV_32FC1);
\r
848 cv::gpu::GpuMat d_image = cv::gpu::createContinuous(size, CV_32FC1);
\r
849 d_image.upload(image);
\r
851 cv::gpu::GpuMat d_templ = cv::gpu::createContinuous(templ_size, templ_size, CV_32FC1);
\r
852 d_templ.upload(templ);
\r
854 cv::gpu::GpuMat d_dst;
\r
855 cv::gpu::ConvolveBuf d_buf;
\r
857 cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);
\r
861 cv::gpu::convolve(d_image, d_templ, d_dst, ccorr, d_buf);
\r
866 ASSERT_FALSE(ccorr);
\r
870 cv::filter2D(image, dst, image.depth(), templ);
\r
874 cv::filter2D(image, dst, image.depth(), templ);
\r
879 ////////////////////////////////////////////////////////////////////////////////
\r
882 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
883 #define ALL_TEMPLATE_METHODS ValuesIn(TemplateMethod::all())
\r
885 DEF_PARAM_TEST(Sz_TemplateSz_Cn_Method, cv::Size, cv::Size, int, TemplateMethod);
\r
887 PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate8U, Combine(
\r
888 GPU_TYPICAL_MAT_SIZES,
\r
889 Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)),
\r
891 ALL_TEMPLATE_METHODS))
\r
893 cv::Size size = GET_PARAM(0);
\r
894 cv::Size templ_size = GET_PARAM(1);
\r
895 int cn = GET_PARAM(2);
\r
896 int method = GET_PARAM(3);
\r
898 cv::Mat image(size, CV_MAKE_TYPE(CV_8U, cn));
\r
901 cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_8U, cn));
\r
906 cv::gpu::GpuMat d_image(image);
\r
907 cv::gpu::GpuMat d_templ(templ);
\r
908 cv::gpu::GpuMat d_dst;
\r
910 cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
\r
914 cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
\r
921 cv::matchTemplate(image, templ, dst, method);
\r
925 cv::matchTemplate(image, templ, dst, method);
\r
930 ////////////////////////////////////////////////////////////////////////////////
\r
931 // MatchTemplate32F
\r
933 PERF_TEST_P(Sz_TemplateSz_Cn_Method, ImgProc_MatchTemplate32F, Combine(
\r
934 GPU_TYPICAL_MAT_SIZES,
\r
935 Values(cv::Size(5, 5), cv::Size(16, 16), cv::Size(30, 30)),
\r
937 Values(TemplateMethod(cv::TM_SQDIFF), TemplateMethod(cv::TM_CCORR))))
\r
939 cv::Size size = GET_PARAM(0);
\r
940 cv::Size templ_size = GET_PARAM(1);
\r
941 int cn = GET_PARAM(2);
\r
942 int method = GET_PARAM(3);
\r
944 cv::Mat image(size, CV_MAKE_TYPE(CV_32F, cn));
\r
947 cv::Mat templ(templ_size, CV_MAKE_TYPE(CV_32F, cn));
\r
952 cv::gpu::GpuMat d_image(image);
\r
953 cv::gpu::GpuMat d_templ(templ);
\r
954 cv::gpu::GpuMat d_dst;
\r
956 cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
\r
960 cv::gpu::matchTemplate(d_image, d_templ, d_dst, method);
\r
967 cv::matchTemplate(image, templ, dst, method);
\r
971 cv::matchTemplate(image, templ, dst, method);
\r
976 //////////////////////////////////////////////////////////////////////
\r
979 CV_FLAGS(DftFlags, 0, cv::DFT_INVERSE, cv::DFT_SCALE, cv::DFT_ROWS, cv::DFT_COMPLEX_OUTPUT, cv::DFT_REAL_OUTPUT)
\r
981 DEF_PARAM_TEST(Sz_Flags, cv::Size, DftFlags);
\r
983 PERF_TEST_P(Sz_Flags, ImgProc_MulSpectrums, Combine(
\r
984 GPU_TYPICAL_MAT_SIZES,
\r
985 Values(0, DftFlags(cv::DFT_ROWS))))
\r
987 cv::Size size = GET_PARAM(0);
\r
988 int flag = GET_PARAM(1);
\r
990 cv::Mat a(size, CV_32FC2);
\r
991 fillRandom(a, 0, 100);
\r
993 cv::Mat b(size, CV_32FC2);
\r
994 fillRandom(b, 0, 100);
\r
998 cv::gpu::GpuMat d_a(a);
\r
999 cv::gpu::GpuMat d_b(b);
\r
1000 cv::gpu::GpuMat d_dst;
\r
1002 cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);
\r
1006 cv::gpu::mulSpectrums(d_a, d_b, d_dst, flag);
\r
1013 cv::mulSpectrums(a, b, dst, flag);
\r
1017 cv::mulSpectrums(a, b, dst, flag);
\r
1022 //////////////////////////////////////////////////////////////////////
\r
1023 // MulAndScaleSpectrums
\r
1025 PERF_TEST_P(Sz, ImgProc_MulAndScaleSpectrums, GPU_TYPICAL_MAT_SIZES)
\r
1027 cv::Size size = GetParam();
\r
1029 float scale = 1.f / size.area();
\r
1031 cv::Mat src1(size, CV_32FC2);
\r
1032 fillRandom(src1, 0, 100);
\r
1034 cv::Mat src2(size, CV_32FC2);
\r
1035 fillRandom(src2, 0, 100);
\r
1039 cv::gpu::GpuMat d_src1(src1);
\r
1040 cv::gpu::GpuMat d_src2(src2);
\r
1041 cv::gpu::GpuMat d_dst;
\r
1043 cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);
\r
1047 cv::gpu::mulAndScaleSpectrums(d_src1, d_src2, d_dst, cv::DFT_ROWS, scale, false);
\r
1056 //////////////////////////////////////////////////////////////////////
\r
1059 PERF_TEST_P(Sz_Flags, ImgProc_Dft, Combine(
\r
1060 GPU_TYPICAL_MAT_SIZES,
\r
1061 Values(0, DftFlags(cv::DFT_ROWS), DftFlags(cv::DFT_INVERSE))))
\r
1063 declare.time(10.0);
\r
1065 cv::Size size = GET_PARAM(0);
\r
1066 int flag = GET_PARAM(1);
\r
1068 cv::Mat src(size, CV_32FC2);
\r
1069 fillRandom(src, 0, 100);
\r
1073 cv::gpu::GpuMat d_src(src);
\r
1074 cv::gpu::GpuMat d_dst;
\r
1076 cv::gpu::dft(d_src, d_dst, size, flag);
\r
1080 cv::gpu::dft(d_src, d_dst, size, flag);
\r
1087 cv::dft(src, dst, flag);
\r
1091 cv::dft(src, dst, flag);
\r
1096 //////////////////////////////////////////////////////////////////////
\r
1099 DEF_PARAM_TEST(Image_Type_Border_BlockSz_ApertureSz, string, MatType, BorderMode, int, int);
\r
1101 PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerHarris, Combine(
\r
1102 Values<string>("gpu/stereobm/aloe-L.png"),
\r
1103 Values(CV_8UC1, CV_32FC1),
\r
1104 Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
\r
1106 Values(0, 3, 5, 7)))
\r
1108 string fileName = GET_PARAM(0);
\r
1109 int type = GET_PARAM(1);
\r
1110 int borderMode = GET_PARAM(2);
\r
1111 int blockSize = GET_PARAM(3);
\r
1112 int apertureSize = GET_PARAM(4);
\r
1114 cv::Mat img = readImage(fileName, cv::IMREAD_GRAYSCALE);
\r
1115 ASSERT_FALSE(img.empty());
\r
1116 img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
\r
1122 cv::gpu::GpuMat d_img(img);
\r
1123 cv::gpu::GpuMat d_dst;
\r
1124 cv::gpu::GpuMat d_Dx;
\r
1125 cv::gpu::GpuMat d_Dy;
\r
1126 cv::gpu::GpuMat d_buf;
\r
1128 cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);
\r
1132 cv::gpu::cornerHarris(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, k, borderMode);
\r
1139 cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);
\r
1143 cv::cornerHarris(img, dst, blockSize, apertureSize, k, borderMode);
\r
1148 //////////////////////////////////////////////////////////////////////
\r
1149 // CornerMinEigenVal
\r
1151 PERF_TEST_P(Image_Type_Border_BlockSz_ApertureSz, ImgProc_CornerMinEigenVal, Combine(
\r
1152 Values<string>("gpu/stereobm/aloe-L.png"),
\r
1153 Values(CV_8UC1, CV_32FC1),
\r
1154 Values(BorderMode(cv::BORDER_REFLECT101), BorderMode(cv::BORDER_REPLICATE), BorderMode(cv::BORDER_REFLECT)),
\r
1156 Values(0, 3, 5, 7)))
\r
1158 string fileName = GET_PARAM(0);
\r
1159 int type = GET_PARAM(1);
\r
1160 int borderMode = GET_PARAM(2);
\r
1161 int blockSize = GET_PARAM(3);
\r
1162 int apertureSize = GET_PARAM(4);
\r
1164 cv::Mat img = readImage(fileName, cv::IMREAD_GRAYSCALE);
\r
1165 ASSERT_FALSE(img.empty());
\r
1167 img.convertTo(img, type, type == CV_32F ? 1.0 / 255.0 : 1.0);
\r
1171 cv::gpu::GpuMat d_img(img);
\r
1172 cv::gpu::GpuMat d_dst;
\r
1173 cv::gpu::GpuMat d_Dx;
\r
1174 cv::gpu::GpuMat d_Dy;
\r
1175 cv::gpu::GpuMat d_buf;
\r
1177 cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);
\r
1181 cv::gpu::cornerMinEigenVal(d_img, d_dst, d_Dx, d_Dy, d_buf, blockSize, apertureSize, borderMode);
\r
1188 cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);
\r
1192 cv::cornerMinEigenVal(img, dst, blockSize, apertureSize, borderMode);
\r
1197 //////////////////////////////////////////////////////////////////////
\r
1198 // BuildWarpPlaneMaps
\r
1200 PERF_TEST_P(Sz, ImgProc_BuildWarpPlaneMaps, GPU_TYPICAL_MAT_SIZES)
\r
1202 cv::Size size = GetParam();
\r
1204 cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
\r
1205 cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
\r
1206 cv::Mat T = cv::Mat::zeros(1, 3, CV_32F);
\r
1210 cv::gpu::GpuMat d_map_x;
\r
1211 cv::gpu::GpuMat d_map_y;
\r
1213 cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);
\r
1217 cv::gpu::buildWarpPlaneMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, T, 1.0, d_map_x, d_map_y);
\r
1226 //////////////////////////////////////////////////////////////////////
\r
1227 // BuildWarpCylindricalMaps
\r
1229 PERF_TEST_P(Sz, ImgProc_BuildWarpCylindricalMaps, GPU_TYPICAL_MAT_SIZES)
\r
1231 cv::Size size = GetParam();
\r
1233 cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
\r
1234 cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
\r
1238 cv::gpu::GpuMat d_map_x;
\r
1239 cv::gpu::GpuMat d_map_y;
\r
1241 cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);
\r
1245 cv::gpu::buildWarpCylindricalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);
\r
1254 //////////////////////////////////////////////////////////////////////
\r
1255 // BuildWarpSphericalMaps
\r
1257 PERF_TEST_P(Sz, ImgProc_BuildWarpSphericalMaps, GPU_TYPICAL_MAT_SIZES)
\r
1259 cv::Size size = GetParam();
\r
1261 cv::Mat K = cv::Mat::eye(3, 3, CV_32FC1);
\r
1262 cv::Mat R = cv::Mat::ones(3, 3, CV_32FC1);
\r
1266 cv::gpu::GpuMat d_map_x;
\r
1267 cv::gpu::GpuMat d_map_y;
\r
1269 cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);
\r
1273 cv::gpu::buildWarpSphericalMaps(size, cv::Rect(0, 0, size.width, size.height), K, R, 1.0, d_map_x, d_map_y);
\r
1282 //////////////////////////////////////////////////////////////////////
\r
1285 DEF_PARAM_TEST(Sz_Depth_Cn_Inter, cv::Size, MatDepth, int, Interpolation);
\r
1287 PERF_TEST_P(Sz_Depth_Cn_Inter, ImgProc_Rotate, Combine(
\r
1288 GPU_TYPICAL_MAT_SIZES,
\r
1289 Values(CV_8U, CV_16U, CV_32F),
\r
1291 Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR), Interpolation(cv::INTER_CUBIC))))
\r
1293 cv::Size size = GET_PARAM(0);
\r
1294 int depth = GET_PARAM(1);
\r
1295 int channels = GET_PARAM(2);
\r
1296 int interpolation = GET_PARAM(3);
\r
1298 int type = CV_MAKE_TYPE(depth, channels);
\r
1300 cv::Mat src(size, type);
\r
1305 cv::gpu::GpuMat d_src(src);
\r
1306 cv::gpu::GpuMat d_dst;
\r
1308 cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);
\r
1312 cv::gpu::rotate(d_src, d_dst, size, 30.0, 0, 0, interpolation);
\r
1321 //////////////////////////////////////////////////////////////////////
\r
1324 PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrDown, Combine(
\r
1325 GPU_TYPICAL_MAT_SIZES,
\r
1326 Values(CV_8U, CV_16U, CV_32F),
\r
1329 cv::Size size = GET_PARAM(0);
\r
1330 int depth = GET_PARAM(1);
\r
1331 int channels = GET_PARAM(2);
\r
1333 int type = CV_MAKE_TYPE(depth, channels);
\r
1335 cv::Mat src(size, type);
\r
1340 cv::gpu::GpuMat d_src(src);
\r
1341 cv::gpu::GpuMat d_dst;
\r
1343 cv::gpu::pyrDown(d_src, d_dst);
\r
1347 cv::gpu::pyrDown(d_src, d_dst);
\r
1354 cv::pyrDown(src, dst);
\r
1358 cv::pyrDown(src, dst);
\r
1363 //////////////////////////////////////////////////////////////////////
\r
1366 PERF_TEST_P(Sz_Depth_Cn, ImgProc_PyrUp, Combine(
\r
1367 GPU_TYPICAL_MAT_SIZES,
\r
1368 Values(CV_8U, CV_16U, CV_32F),
\r
1371 cv::Size size = GET_PARAM(0);
\r
1372 int depth = GET_PARAM(1);
\r
1373 int channels = GET_PARAM(2);
\r
1375 int type = CV_MAKE_TYPE(depth, channels);
\r
1377 cv::Mat src(size, type);
\r
1382 cv::gpu::GpuMat d_src(src);
\r
1383 cv::gpu::GpuMat d_dst;
\r
1385 cv::gpu::pyrUp(d_src, d_dst);
\r
1389 cv::gpu::pyrUp(d_src, d_dst);
\r
1396 cv::pyrUp(src, dst);
\r
1400 cv::pyrUp(src, dst);
\r
1405 //////////////////////////////////////////////////////////////////////
\r
1408 DEF_PARAM_TEST(Sz_Depth_Code, cv::Size, MatDepth, CvtColorInfo);
\r
1410 PERF_TEST_P(Sz_Depth_Code, ImgProc_CvtColor, Combine(
\r
1411 GPU_TYPICAL_MAT_SIZES,
\r
1412 Values(CV_8U, CV_16U, CV_32F),
\r
1413 Values(CvtColorInfo(4, 4, cv::COLOR_RGBA2BGRA),
\r
1414 CvtColorInfo(4, 1, cv::COLOR_BGRA2GRAY),
\r
1415 CvtColorInfo(1, 4, cv::COLOR_GRAY2BGRA),
\r
1416 CvtColorInfo(3, 3, cv::COLOR_BGR2XYZ),
\r
1417 CvtColorInfo(3, 3, cv::COLOR_XYZ2BGR),
\r
1418 CvtColorInfo(3, 3, cv::COLOR_BGR2YCrCb),
\r
1419 CvtColorInfo(3, 3, cv::COLOR_YCrCb2BGR),
\r
1420 CvtColorInfo(3, 3, cv::COLOR_BGR2YUV),
\r
1421 CvtColorInfo(3, 3, cv::COLOR_YUV2BGR),
\r
1422 CvtColorInfo(3, 3, cv::COLOR_BGR2HSV),
\r
1423 CvtColorInfo(3, 3, cv::COLOR_HSV2BGR),
\r
1424 CvtColorInfo(3, 3, cv::COLOR_BGR2HLS),
\r
1425 CvtColorInfo(3, 3, cv::COLOR_HLS2BGR),
\r
1426 CvtColorInfo(3, 3, cv::COLOR_BGR2Lab),
\r
1427 CvtColorInfo(3, 3, cv::COLOR_RGB2Lab),
\r
1428 CvtColorInfo(3, 3, cv::COLOR_BGR2Luv),
\r
1429 CvtColorInfo(3, 3, cv::COLOR_RGB2Luv),
\r
1430 CvtColorInfo(3, 3, cv::COLOR_Lab2BGR),
\r
1431 CvtColorInfo(3, 3, cv::COLOR_Lab2RGB),
\r
1432 CvtColorInfo(3, 3, cv::COLOR_Luv2BGR),
\r
1433 CvtColorInfo(3, 3, cv::COLOR_Luv2RGB),
\r
1434 CvtColorInfo(1, 3, cv::COLOR_BayerBG2BGR),
\r
1435 CvtColorInfo(1, 3, cv::COLOR_BayerGB2BGR),
\r
1436 CvtColorInfo(1, 3, cv::COLOR_BayerRG2BGR),
\r
1437 CvtColorInfo(1, 3, cv::COLOR_BayerGR2BGR),
\r
1438 CvtColorInfo(4, 4, cv::COLOR_RGBA2mRGBA))))
\r
1440 cv::Size size = GET_PARAM(0);
\r
1441 int depth = GET_PARAM(1);
\r
1442 CvtColorInfo info = GET_PARAM(2);
\r
1444 cv::Mat src(size, CV_MAKETYPE(depth, info.scn));
\r
1449 cv::gpu::GpuMat d_src(src);
\r
1450 cv::gpu::GpuMat d_dst;
\r
1452 cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);
\r
1456 cv::gpu::cvtColor(d_src, d_dst, info.code, info.dcn);
\r
1463 cv::cvtColor(src, dst, info.code, info.dcn);
\r
1467 cv::cvtColor(src, dst, info.code, info.dcn);
\r
1472 //////////////////////////////////////////////////////////////////////
\r
1475 PERF_TEST_P(Sz, ImgProc_SwapChannels, GPU_TYPICAL_MAT_SIZES)
\r
1477 cv::Size size = GetParam();
\r
1479 cv::Mat src(size, CV_8UC4);
\r
1482 const int dstOrder[] = {2, 1, 0, 3};
\r
1486 cv::gpu::GpuMat d_src(src);
\r
1488 cv::gpu::swapChannels(d_src, dstOrder);
\r
1492 cv::gpu::swapChannels(d_src, dstOrder);
\r
1501 //////////////////////////////////////////////////////////////////////
\r
1504 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
1505 #define ALL_ALPHA_OPS ValuesIn(AlphaOp::all())
\r
1507 DEF_PARAM_TEST(Sz_Type_Op, cv::Size, MatType, AlphaOp);
\r
1509 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
1511 cv::Size size = GET_PARAM(0);
\r
1512 int type = GET_PARAM(1);
\r
1513 int alpha_op = GET_PARAM(2);
\r
1515 cv::Mat img1(size, type);
\r
1518 cv::Mat img2(size, type);
\r
1523 cv::gpu::GpuMat d_img1(img1);
\r
1524 cv::gpu::GpuMat d_img2(img2);
\r
1525 cv::gpu::GpuMat d_dst;
\r
1527 cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);
\r
1531 cv::gpu::alphaComp(d_img1, d_img2, d_dst, alpha_op);
\r
1540 //////////////////////////////////////////////////////////////////////
\r
1541 // ImagePyramidBuild
\r
1543 PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidBuild, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), Values(1, 3, 4)))
\r
1545 cv::Size size = GET_PARAM(0);
\r
1546 int depth = GET_PARAM(1);
\r
1547 int channels = GET_PARAM(2);
\r
1549 int type = CV_MAKE_TYPE(depth, channels);
\r
1551 cv::Mat src(size, type);
\r
1556 cv::gpu::GpuMat d_src(src);
\r
1558 cv::gpu::ImagePyramid d_pyr;
\r
1560 d_pyr.build(d_src, 5);
\r
1564 d_pyr.build(d_src, 5);
\r
1573 //////////////////////////////////////////////////////////////////////
\r
1574 // ImagePyramidGetLayer
\r
1576 PERF_TEST_P(Sz_Depth_Cn, ImgProc_ImagePyramidGetLayer, Combine(GPU_TYPICAL_MAT_SIZES, Values(CV_8U, CV_16U, CV_32F), Values(1, 3, 4)))
\r
1578 cv::Size size = GET_PARAM(0);
\r
1579 int depth = GET_PARAM(1);
\r
1580 int channels = GET_PARAM(2);
\r
1582 int type = CV_MAKE_TYPE(depth, channels);
\r
1584 cv::Mat src(size, type);
\r
1587 cv::Size dstSize(size.width / 2 + 10, size.height / 2 + 10);
\r
1591 cv::gpu::GpuMat d_src(src);
\r
1592 cv::gpu::GpuMat d_dst;
\r
1594 cv::gpu::ImagePyramid d_pyr(d_src, 3);
\r
1596 d_pyr.getLayer(d_dst, dstSize);
\r
1600 d_pyr.getLayer(d_dst, dstSize);
\r
1609 //////////////////////////////////////////////////////////////////////
\r
1612 PERF_TEST_P(Sz, ImgProc_HoughLines, GPU_TYPICAL_MAT_SIZES)
\r
1614 declare.time(30.0);
\r
1616 const cv::Size size = GetParam();
\r
1618 const float rho = 1.0f;
\r
1619 const float theta = static_cast<float>(CV_PI / 180.0);
\r
1620 const int threshold = 300;
\r
1622 cv::RNG rng(123456789);
\r
1624 cv::Mat src(size, CV_8UC1, cv::Scalar::all(0));
\r
1626 const int numLines = rng.uniform(100, 300);
\r
1627 for (int i = 0; i < numLines; ++i)
\r
1629 cv::Point p1(rng.uniform(0, src.cols), rng.uniform(0, src.rows));
\r
1630 cv::Point p2(rng.uniform(0, src.cols), rng.uniform(0, src.rows));
\r
1631 cv::line(src, p1, p2, cv::Scalar::all(255), 2);
\r
1636 cv::gpu::GpuMat d_src(src);
\r
1637 cv::gpu::GpuMat d_lines;
\r
1638 cv::gpu::HoughLinesBuf d_buf;
\r
1640 cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold);
\r
1644 cv::gpu::HoughLines(d_src, d_lines, d_buf, rho, theta, threshold);
\r
1649 std::vector<cv::Vec2f> lines;
\r
1650 cv::HoughLines(src, lines, rho, theta, threshold);
\r
1654 cv::HoughLines(src, lines, rho, theta, threshold);
\r
1659 //////////////////////////////////////////////////////////////////////
\r
1662 DEF_PARAM_TEST(Sz_Dp_MinDist, cv::Size, float, float);
\r
1664 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
1666 declare.time(30.0);
\r
1668 const cv::Size size = GET_PARAM(0);
\r
1669 const float dp = GET_PARAM(1);
\r
1670 const float minDist = GET_PARAM(2);
\r
1672 const int minRadius = 10;
\r
1673 const int maxRadius = 30;
\r
1674 const int cannyThreshold = 100;
\r
1675 const int votesThreshold = 15;
\r
1677 cv::RNG rng(123456789);
\r
1679 cv::Mat src(size, CV_8UC1, cv::Scalar::all(0));
\r
1681 const int numCircles = rng.uniform(50, 100);
\r
1682 for (int i = 0; i < numCircles; ++i)
\r
1684 cv::Point center(rng.uniform(0, src.cols), rng.uniform(0, src.rows));
\r
1685 const int radius = rng.uniform(minRadius, maxRadius + 1);
\r
1687 cv::circle(src, center, radius, cv::Scalar::all(255), -1);
\r
1692 cv::gpu::GpuMat d_src(src);
\r
1693 cv::gpu::GpuMat d_circles;
\r
1694 cv::gpu::HoughCirclesBuf d_buf;
\r
1696 cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
\r
1700 cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
\r
1705 std::vector<cv::Vec3f> circles;
\r
1707 cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
\r
1711 cv::HoughCircles(src, circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
\r