1 #include "perf_precomp.hpp"
6 using std::tr1::make_tuple;
9 typedef tr1::tuple<MatType, Size, Size> MatInfo_Size_Size_t;
10 typedef TestBaseWithParam<MatInfo_Size_Size_t> MatInfo_Size_Size;
12 PERF_TEST_P(MatInfo_Size_Size, resizeUpLinear,
14 MatInfo_Size_Size_t(CV_8UC1, szVGA, szqHD),
15 MatInfo_Size_Size_t(CV_8UC1, szVGA, sz720p),
16 MatInfo_Size_Size_t(CV_8UC4, szVGA, sz720p)
20 int matType = get<0>(GetParam());
21 Size from = get<1>(GetParam());
22 Size to = get<2>(GetParam());
24 cv::Mat src(from, matType), dst(to, matType);
25 cvtest::fillGradient(src);
26 declare.in(src).out(dst);
28 TEST_CYCLE_MULTIRUN(10) resize(src, dst, to);
33 SANITY_CHECK(dst, 1 + 1e-6);
37 PERF_TEST_P(MatInfo_Size_Size, resizeDownLinear,
39 MatInfo_Size_Size_t(CV_8UC1, szVGA, szQVGA),
40 MatInfo_Size_Size_t(CV_8UC4, szqHD, szVGA),
41 MatInfo_Size_Size_t(CV_8UC1, sz720p, Size(120 * sz720p.width / sz720p.height, 120)),//face detection min_face_size = 20%
42 MatInfo_Size_Size_t(CV_8UC4, sz720p, szVGA),
43 MatInfo_Size_Size_t(CV_8UC4, sz720p, szQVGA)
47 int matType = get<0>(GetParam());
48 Size from = get<1>(GetParam());
49 Size to = get<2>(GetParam());
51 cv::Mat src(from, matType), dst(to, matType);
52 cvtest::fillGradient(src);
53 declare.in(src).out(dst);
55 TEST_CYCLE_MULTIRUN(10) resize(src, dst, to);
60 SANITY_CHECK(dst, 1 + 1e-6);
65 typedef tr1::tuple<MatType, Size, int> MatInfo_Size_Scale_t;
66 typedef TestBaseWithParam<MatInfo_Size_Scale_t> MatInfo_Size_Scale;
68 PERF_TEST_P(MatInfo_Size_Scale, ResizeAreaFast,
70 testing::Values(CV_8UC1, CV_8UC4),
71 testing::Values(szVGA, szqHD, sz720p, sz1080p),
76 int matType = get<0>(GetParam());
77 Size from = get<1>(GetParam());
78 int scale = get<2>(GetParam());
80 from.width = (from.width/scale)*scale;
81 from.height = (from.height/scale)*scale;
83 cv::Mat src(from, matType);
84 cv::Mat dst(from.height / scale, from.width / scale, matType);
86 declare.in(src, WARMUP_RNG).out(dst);
89 TEST_CYCLE_MULTIRUN(runs) resize(src, dst, dst.size(), 0, 0, INTER_AREA);
91 //difference equal to 1 is allowed because of different possible rounding modes: round-to-nearest vs bankers' rounding
96 typedef TestBaseWithParam<tr1::tuple<MatType, Size, double> > MatInfo_Size_Scale_Area;
98 PERF_TEST_P(MatInfo_Size_Scale_Area, ResizeArea,
100 testing::Values(CV_8UC1, CV_8UC4),
101 testing::Values(szVGA, szqHD, sz720p),
102 testing::Values(2.4, 3.4, 1.3)
106 int matType = get<0>(GetParam());
107 Size from = get<1>(GetParam());
108 double scale = get<2>(GetParam());
110 cv::Mat src(from, matType);
112 Size to(cvRound(from.width * scale), cvRound(from.height * scale));
113 cv::Mat dst(to, matType);
115 declare.in(src, WARMUP_RNG).out(dst);
118 TEST_CYCLE() resize(src, dst, dst.size(), 0, 0, INTER_AREA);
120 //difference equal to 1 is allowed because of different possible rounding modes: round-to-nearest vs bankers' rounding
121 SANITY_CHECK(dst, 1);