Skip to content

Commit a08044d

Browse files
committed
Merge pull request opencv#8833 from terfendail:resizenn_perftest
2 parents aea25e7 + 22fcbae commit a08044d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

modules/imgproc/perf/perf_resize.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,31 @@ PERF_TEST_P(MatInfo_Size_Scale_Area, ResizeArea,
120120
//difference equal to 1 is allowed because of different possible rounding modes: round-to-nearest vs bankers' rounding
121121
SANITY_CHECK(dst, 1);
122122
}
123+
124+
typedef MatInfo_Size_Scale_Area MatInfo_Size_Scale_NN;
125+
126+
PERF_TEST_P(MatInfo_Size_Scale_NN, ResizeNN,
127+
testing::Combine(
128+
testing::Values(CV_8UC1, CV_8UC2, CV_8UC4),
129+
testing::Values(szVGA, szqHD, sz720p, sz1080p, sz2160p),
130+
testing::Values(2.4, 3.4, 1.3)
131+
)
132+
)
133+
{
134+
int matType = get<0>(GetParam());
135+
Size from = get<1>(GetParam());
136+
double scale = get<2>(GetParam());
137+
138+
cv::Mat src(from, matType);
139+
140+
Size to(cvRound(from.width * scale), cvRound(from.height * scale));
141+
cv::Mat dst(to, matType);
142+
143+
declare.in(src, WARMUP_RNG).out(dst);
144+
declare.time(100);
145+
146+
TEST_CYCLE() resize(src, dst, dst.size(), 0, 0, INTER_NEAREST);
147+
148+
EXPECT_GT(countNonZero(dst.reshape(1)), 0);
149+
SANITY_CHECK_NOTHING();
150+
}

0 commit comments

Comments
 (0)