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 
9 typedef std::tr1::tuple<Size, MatType, MatDepth> Size_MatType_OutMatDepth_t;
10 typedef perf::TestBaseWithParam<Size_MatType_OutMatDepth_t> Size_MatType_OutMatDepth;
11 
PERF_TEST_P(Size_MatType_OutMatDepth,integral,testing::Combine (testing::Values (TYPICAL_MAT_SIZES),testing::Values (CV_8UC1,CV_8UC4),testing::Values (CV_32S,CV_32F,CV_64F)))12 PERF_TEST_P(Size_MatType_OutMatDepth, integral,
13             testing::Combine(
14                 testing::Values(TYPICAL_MAT_SIZES),
15                 testing::Values(CV_8UC1, CV_8UC4),
16                 testing::Values(CV_32S, CV_32F, CV_64F)
17                 )
18             )
19 {
20     Size sz = get<0>(GetParam());
21     int matType = get<1>(GetParam());
22     int sdepth = get<2>(GetParam());
23 
24     Mat src(sz, matType);
25     Mat sum(sz, sdepth);
26 
27     declare.in(src, WARMUP_RNG).out(sum);
28 
29     TEST_CYCLE() integral(src, sum, sdepth);
30 
31     SANITY_CHECK(sum, 1e-6);
32 }
33 
PERF_TEST_P(Size_MatType_OutMatDepth,integral_sqsum,testing::Combine (testing::Values (::perf::szVGA,::perf::sz1080p),testing::Values (CV_8UC1,CV_8UC4),testing::Values (CV_32S,CV_32F)))34 PERF_TEST_P(Size_MatType_OutMatDepth, integral_sqsum,
35             testing::Combine(
36                 testing::Values(::perf::szVGA, ::perf::sz1080p),
37                 testing::Values(CV_8UC1, CV_8UC4),
38                 testing::Values(CV_32S, CV_32F)
39                 )
40             )
41 {
42     Size sz = get<0>(GetParam());
43     int matType = get<1>(GetParam());
44     int sdepth = get<2>(GetParam());
45 
46     Mat src(sz, matType);
47     Mat sum(sz, sdepth);
48     Mat sqsum(sz, sdepth);
49 
50     declare.in(src, WARMUP_RNG).out(sum, sqsum);
51     declare.time(100);
52 
53     TEST_CYCLE() integral(src, sum, sqsum, sdepth);
54 
55     SANITY_CHECK(sum, 1e-6);
56     SANITY_CHECK(sqsum, 1e-6);
57 }
58 
PERF_TEST_P(Size_MatType_OutMatDepth,integral_sqsum_tilted,testing::Combine (testing::Values (::perf::szVGA,::perf::szODD,::perf::sz1080p),testing::Values (CV_8UC1,CV_8UC4),testing::Values (CV_32S,CV_32F)))59 PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,
60              testing::Combine(
61                  testing::Values( ::perf::szVGA, ::perf::szODD , ::perf::sz1080p ),
62                  testing::Values( CV_8UC1, CV_8UC4 ),
63                  testing::Values( CV_32S, CV_32F )
64                  )
65              )
66 {
67     Size sz = get<0>(GetParam());
68     int matType = get<1>(GetParam());
69     int sdepth = get<2>(GetParam());
70 
71     Mat src(sz, matType);
72     Mat sum(sz, sdepth);
73     Mat sqsum(sz, sdepth);
74     Mat tilted(sz, sdepth);
75 
76     declare.in(src, WARMUP_RNG).out(sum, sqsum, tilted);
77     declare.time(100);
78 
79     TEST_CYCLE() integral(src, sum, sqsum, tilted, sdepth);
80 
81     SANITY_CHECK(sum, 1e-6);
82     SANITY_CHECK(sqsum, 1e-6);
83     SANITY_CHECK(tilted, 1e-6, tilted.depth() > CV_32S ? ERROR_RELATIVE : ERROR_ABSOLUTE);
84 }
85