1 #include "perf_precomp.hpp"
2
3 using namespace std;
4 using namespace cv;
5 using namespace perf;
6 using std::tr1::make_tuple;
7 using std::tr1::get;
8
PERF_TEST_P(Size_MatType,Mat_Eye,testing::Combine (testing::Values (TYPICAL_MAT_SIZES),testing::Values (TYPICAL_MAT_TYPES)))9 PERF_TEST_P(Size_MatType, Mat_Eye,
10 testing::Combine(testing::Values(TYPICAL_MAT_SIZES),
11 testing::Values(TYPICAL_MAT_TYPES))
12
13 )
14 {
15 Size size = get<0>(GetParam());
16 int type = get<1>(GetParam());
17 Mat diagonalMatrix(size.height, size.width, type);
18
19 declare.out(diagonalMatrix);
20
21 int runs = (size.width <= 640) ? 15 : 5;
22 TEST_CYCLE_MULTIRUN(runs)
23 {
24 diagonalMatrix = Mat::eye(size, type);
25 }
26
27 SANITY_CHECK(diagonalMatrix, 1);
28 }
29
PERF_TEST_P(Size_MatType,Mat_Zeros,testing::Combine (testing::Values (TYPICAL_MAT_SIZES),testing::Values (TYPICAL_MAT_TYPES,CV_32FC3)))30 PERF_TEST_P(Size_MatType, Mat_Zeros,
31 testing::Combine(testing::Values(TYPICAL_MAT_SIZES),
32 testing::Values(TYPICAL_MAT_TYPES, CV_32FC3))
33
34 )
35 {
36 Size size = get<0>(GetParam());
37 int type = get<1>(GetParam());
38 Mat zeroMatrix(size.height, size.width, type);
39
40 declare.out(zeroMatrix);
41
42 int runs = (size.width <= 640) ? 15 : 5;
43 TEST_CYCLE_MULTIRUN(runs)
44 {
45 zeroMatrix = Mat::zeros(size, type);
46 }
47
48 SANITY_CHECK(zeroMatrix, 1);
49 }
50
PERF_TEST_P(Size_MatType,Mat_Clone,testing::Combine (testing::Values (TYPICAL_MAT_SIZES),testing::Values (TYPICAL_MAT_TYPES)))51 PERF_TEST_P(Size_MatType, Mat_Clone,
52 testing::Combine(testing::Values(TYPICAL_MAT_SIZES),
53 testing::Values(TYPICAL_MAT_TYPES))
54
55 )
56 {
57 Size size = get<0>(GetParam());
58 int type = get<1>(GetParam());
59 Mat source(size.height, size.width, type);
60 Mat destination(size.height, size.width, type);;
61
62 declare.in(source, WARMUP_RNG).out(destination);
63
64 TEST_CYCLE()
65 {
66 source.clone();
67 }
68 destination = source.clone();
69
70 SANITY_CHECK(destination, 1);
71 }
72
PERF_TEST_P(Size_MatType,Mat_Clone_Roi,testing::Combine (testing::Values (TYPICAL_MAT_SIZES),testing::Values (TYPICAL_MAT_TYPES)))73 PERF_TEST_P(Size_MatType, Mat_Clone_Roi,
74 testing::Combine(testing::Values(TYPICAL_MAT_SIZES),
75 testing::Values(TYPICAL_MAT_TYPES))
76
77 )
78 {
79 Size size = get<0>(GetParam());
80 int type = get<1>(GetParam());
81
82 unsigned int width = size.width;
83 unsigned int height = size.height;
84 Mat source(height, width, type);
85 Mat destination(size.height/2, size.width/2, type);
86
87 declare.in(source, WARMUP_RNG).out(destination);
88
89 Mat roi(source, Rect(width/4, height/4, 3*width/4, 3*height/4));
90
91 TEST_CYCLE()
92 {
93 roi.clone();
94 }
95 destination = roi.clone();
96
97 SANITY_CHECK(destination, 1);
98 }
99