Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/imgproc/perf/perf_integral.cpp
16344 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
#include "perf_precomp.hpp"
5
6
namespace opencv_test {
7
8
typedef tuple<Size, MatType, MatDepth> Size_MatType_OutMatDepth_t;
9
typedef perf::TestBaseWithParam<Size_MatType_OutMatDepth_t> Size_MatType_OutMatDepth;
10
11
PERF_TEST_P(Size_MatType_OutMatDepth, integral,
12
testing::Combine(
13
testing::Values(TYPICAL_MAT_SIZES),
14
testing::Values(CV_8UC1, CV_8UC4),
15
testing::Values(CV_32S, CV_32F, CV_64F)
16
)
17
)
18
{
19
Size sz = get<0>(GetParam());
20
int matType = get<1>(GetParam());
21
int sdepth = get<2>(GetParam());
22
23
Mat src(sz, matType);
24
Mat sum(sz, sdepth);
25
26
declare.in(src, WARMUP_RNG).out(sum);
27
28
TEST_CYCLE() integral(src, sum, sdepth);
29
30
SANITY_CHECK(sum, 1e-6);
31
}
32
33
PERF_TEST_P(Size_MatType_OutMatDepth, integral_sqsum,
34
testing::Combine(
35
testing::Values(::perf::szVGA, ::perf::sz1080p),
36
testing::Values(CV_8UC1, CV_8UC4),
37
testing::Values(CV_32S, CV_32F)
38
)
39
)
40
{
41
Size sz = get<0>(GetParam());
42
int matType = get<1>(GetParam());
43
int sdepth = get<2>(GetParam());
44
45
Mat src(sz, matType);
46
Mat sum(sz, sdepth);
47
Mat sqsum(sz, sdepth);
48
49
declare.in(src, WARMUP_RNG).out(sum, sqsum);
50
declare.time(100);
51
52
TEST_CYCLE() integral(src, sum, sqsum, sdepth);
53
54
SANITY_CHECK(sum, 1e-6);
55
SANITY_CHECK(sqsum, 1e-6);
56
}
57
58
PERF_TEST_P( Size_MatType_OutMatDepth, integral_sqsum_tilted,
59
testing::Combine(
60
testing::Values( ::perf::szVGA, ::perf::szODD , ::perf::sz1080p ),
61
testing::Values( CV_8UC1, CV_8UC4 ),
62
testing::Values( CV_32S, CV_32F )
63
)
64
)
65
{
66
Size sz = get<0>(GetParam());
67
int matType = get<1>(GetParam());
68
int sdepth = get<2>(GetParam());
69
70
Mat src(sz, matType);
71
Mat sum(sz, sdepth);
72
Mat sqsum(sz, sdepth);
73
Mat tilted(sz, sdepth);
74
75
declare.in(src, WARMUP_RNG).out(sum, sqsum, tilted);
76
declare.time(100);
77
78
TEST_CYCLE() integral(src, sum, sqsum, tilted, sdepth);
79
80
SANITY_CHECK(sum, 1e-6);
81
SANITY_CHECK(sqsum, 1e-6);
82
SANITY_CHECK(tilted, 1e-6, tilted.depth() > CV_32S ? ERROR_RELATIVE : ERROR_ABSOLUTE);
83
}
84
85
} // namespace
86
87