Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/core/perf/perf_merge.cpp
16344 views
1
#include "perf_precomp.hpp"
2
3
namespace opencv_test
4
{
5
using namespace perf;
6
7
typedef tuple<Size, MatType, int> Size_SrcDepth_DstChannels_t;
8
typedef perf::TestBaseWithParam<Size_SrcDepth_DstChannels_t> Size_SrcDepth_DstChannels;
9
10
PERF_TEST_P( Size_SrcDepth_DstChannels, merge,
11
testing::Combine
12
(
13
testing::Values(TYPICAL_MAT_SIZES),
14
testing::Values(CV_8U, CV_16S, CV_32S, CV_32F, CV_64F),
15
testing::Values(2, 3, 4)
16
)
17
)
18
{
19
Size sz = get<0>(GetParam());
20
int srcDepth = get<1>(GetParam());
21
int dstChannels = get<2>(GetParam());
22
23
int maxValue = 255;
24
25
vector<Mat> mv;
26
for( int i = 0; i < dstChannels; ++i )
27
{
28
mv.push_back( Mat(sz, CV_MAKETYPE(srcDepth, 1)) );
29
randu(mv[i], 0, maxValue);
30
}
31
32
Mat dst;
33
int runs = (sz.width <= 640) ? 8 : 1;
34
TEST_CYCLE_MULTIRUN(runs) merge( (vector<Mat> &)mv, dst );
35
36
double eps = srcDepth <= CV_32S ? 1e-12 : (FLT_EPSILON * maxValue);
37
SANITY_CHECK(dst, eps);
38
}
39
40
} // namespace
41
42