Skip to content

Commit 36f0f5d

Browse files
committed
perf テスト追加
1 parent 3ffaecb commit 36f0f5d

File tree

1 file changed

+23
-49
lines changed

1 file changed

+23
-49
lines changed

modules/ximgproc/perf/perf_sparse_table_morphology.cpp

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,62 +5,36 @@
55
#include "perf_precomp.hpp"
66

77
namespace opencv_test {
8-
namespace stMorph {
9-
10-
typedef tuple<int, Size, int> STParams;
11-
12-
typedef TestBaseWithParam<STParams> STMorphologyPerfTest;
13-
14-
TEST(Typical_Erode, small)
15-
{
16-
17-
}
18-
19-
PERF_TEST_P(STMorphologyPerfTest, perf, Combine(Values(1,7, 21), Values(sz720p, sz2160p),
20-
Values(MORPH_ERODE, MORPH_DILATE, MORPH_OPEN, MORPH_CLOSE, MORPH_GRADIENT,MORPH_TOPHAT, MORPH_BLACKHAT)))
21-
{
22-
STParams params = GetParam();
23-
int seSize = get<0>(params);
24-
Size sz = get<1>(params);
25-
int op = get<2>(params);
26-
27-
Mat src(sz, CV_8U);
28-
Mat thresholded, dstRLE;
29-
Mat se = rl::getStructuringElement(MORPH_ELLIPSE, cv::Size(2 * seSize + 1, 2 * seSize + 1));
30-
31-
declare.in(src, WARMUP_RNG);
32-
33-
TEST_CYCLE_N(4)
34-
{
35-
rl::threshold(src, thresholded, 100.0, THRESH_BINARY);
36-
rl::morphologyEx(thresholded, dstRLE, op, se);
37-
}
38-
39-
SANITY_CHECK_NOTHING();
40-
}
41-
42-
typedef tuple<int, Size> STErodeParams;
43-
typedef TestBaseWithParam<STErodeParams> STErodePerfTest;
44-
PERF_TEST_P(STErodePerfTest, perf, Combine(Values(1, 7, 21), Values(sz720p, sz2160p)))
8+
namespace {
9+
10+
typedef tuple<MorphTypes, MorphShapes> MorphTypes_MorphShapes_t;
11+
typedef TestBaseWithParam<MorphTypes_MorphShapes_t> SparseTableMorphologyPerfTest;
12+
13+
PERF_TEST_P(SparseTableMorphologyPerfTest, perf,
14+
testing::Combine(
15+
testing::Values(
16+
MORPH_ERODE, MORPH_DILATE, MORPH_OPEN, MORPH_CLOSE,
17+
MORPH_GRADIENT, MORPH_TOPHAT, MORPH_BLACKHAT),
18+
testing::Values(MORPH_RECT, MORPH_CROSS, MORPH_ELLIPSE)
19+
) )
4520
{
46-
STErodeParams params = GetParam();
47-
int seSize = get<0>(params);
48-
Size sz = get<1>(params);
21+
MorphTypes_MorphShapes_t params = GetParam();
22+
int seSize = 51;
23+
Size sz = sz1080p;
24+
MorphTypes op = std::tr1::get<0>(params);
25+
MorphShapes knType = std::tr1::get<1>(params);
4926

50-
Mat src(sz, CV_8U);
51-
Mat thresholded, dstRLE;
52-
Mat se = rl::getStructuringElement(MORPH_ELLIPSE, cv::Size(2 * seSize + 1, 2 * seSize + 1));
27+
Mat src(sz, CV_8UC3), dst(sz, CV_8UC3);
28+
Mat kernel = getStructuringElement(knType, cv::Size(2 * seSize + 1, 2 * seSize + 1));
5329

54-
declare.in(src, WARMUP_RNG);
30+
declare.in(src, WARMUP_RNG).out(dst);
5531

56-
TEST_CYCLE_N(4)
32+
TEST_CYCLE_N(5)
5733
{
58-
rl::threshold(src, thresholded, 100.0, THRESH_BINARY);
59-
rl::erode(thresholded, dstRLE, se);
34+
cv::stMorph::morphologyEx(src, dst, op, kernel);
6035
}
6136

6237
SANITY_CHECK_NOTHING();
6338
}
6439

65-
} // st
66-
} // morphology
40+
}} // opencv_test:: ::

0 commit comments

Comments
 (0)