1 #include "perf_precomp.hpp"
6 using namespace testing;
7 using std::tr1::make_tuple;
10 typedef tr1::tuple<Size, MatType> Size_Source_t;
11 typedef TestBaseWithParam<Size_Source_t> Size_Source;
12 typedef TestBaseWithParam<Size> MatSize;
14 static const float rangeHight = 256.0f;
15 static const float rangeLow = 0.0f;
17 PERF_TEST_P(Size_Source, calcHist1d,
18 testing::Combine(testing::Values(sz3MP, sz5MP),
19 testing::Values(CV_8U, CV_16U, CV_32F) )
22 Size size = get<0>(GetParam());
23 MatType type = get<1>(GetParam());
24 Mat source(size.height, size.width, type);
26 int channels [] = {0};
27 int histSize [] = {256};
29 int numberOfImages = 1;
31 const float range[] = {rangeLow, rangeHight};
32 const float* ranges[] = {range};
34 randu(source, rangeLow, rangeHight);
38 TEST_CYCLE_MULTIRUN(3)
40 calcHist(&source, numberOfImages, channels, Mat(), hist, dims, histSize, ranges);
46 PERF_TEST_P(Size_Source, calcHist2d,
47 testing::Combine(testing::Values(sz3MP, sz5MP),
48 testing::Values(CV_8UC2, CV_16UC2, CV_32FC2) )
51 Size size = get<0>(GetParam());
52 MatType type = get<1>(GetParam());
53 Mat source(size.height, size.width, type);
55 int channels [] = {0, 1};
56 int histSize [] = {256, 256};
58 int numberOfImages = 1;
60 const float r[] = {rangeLow, rangeHight};
61 const float* ranges[] = {r, r};
63 randu(source, rangeLow, rangeHight);
68 calcHist(&source, numberOfImages, channels, Mat(), hist, dims, histSize, ranges);
74 PERF_TEST_P(Size_Source, calcHist3d,
75 testing::Combine(testing::Values(sz3MP, sz5MP),
76 testing::Values(CV_8UC3, CV_16UC3, CV_32FC3) )
79 Size size = get<0>(GetParam());
80 MatType type = get<1>(GetParam());
82 int channels [] = {0, 1, 2};
83 int histSize [] = {32, 32, 32};
85 int numberOfImages = 1;
86 Mat source(size.height, size.width, type);
88 const float r[] = {rangeLow, rangeHight};
89 const float* ranges[] = {r, r, r};
91 randu(source, rangeLow, rangeHight);
96 calcHist(&source, numberOfImages, channels, Mat(), hist, dims, histSize, ranges);
102 PERF_TEST_P(MatSize, equalizeHist,
103 testing::Values(TYPICAL_MAT_SIZES)
106 Size size = GetParam();
107 Mat source(size.height, size.width, CV_8U);
109 declare.in(source, WARMUP_RNG);
113 equalizeHist(source, destination);
116 SANITY_CHECK(destination);
119 typedef tr1::tuple<Size, double> Sz_ClipLimit_t;
120 typedef TestBaseWithParam<Sz_ClipLimit_t> Sz_ClipLimit;
122 PERF_TEST_P(Sz_ClipLimit, CLAHE,
123 testing::Combine(testing::Values(::perf::szVGA, ::perf::sz720p, ::perf::sz1080p),
124 testing::Values(0.0, 40.0))
127 const Size size = get<0>(GetParam());
128 const double clipLimit = get<1>(GetParam());
130 Mat src(size, CV_8UC1);
131 declare.in(src, WARMUP_RNG);
133 Ptr<CLAHE> clahe = createCLAHE(clipLimit);
136 TEST_CYCLE() clahe->apply(src, dst);