mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #18053 from Yosshi999:bit-exact-resizeNN
Bit-exact Nearest Neighbor Resizing * bit exact resizeNN * change the value of method enum * add bitexact-nn to ResizeExactTest * test to compare with non-exact version * add perf for bit-exact resizenn * use cvFloor-equivalent * 1/3 scaling is not stable for floating calculation * stricter test * bugfix: broken data in case of 6 or 12bytes elements * bugfix: broken data in default pix_size * stricter threshold * use raw() for floor * use double instead of int * follow code reviews * fewer cases in perf test * center pixel convention
This commit is contained in:
@@ -254,4 +254,30 @@ PERF_TEST_P(MatInfo_Size_Scale_NN, ResizeNN,
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
PERF_TEST_P(MatInfo_Size_Scale_NN, ResizeNNExact,
|
||||
testing::Combine(
|
||||
testing::Values(CV_8UC1, CV_8UC3, CV_8UC4),
|
||||
testing::Values(sz720p, sz1080p),
|
||||
testing::Values(0.25, 0.5, 2.0)
|
||||
)
|
||||
)
|
||||
{
|
||||
int matType = get<0>(GetParam());
|
||||
Size from = get<1>(GetParam());
|
||||
double scale = get<2>(GetParam());
|
||||
|
||||
cv::Mat src(from, matType);
|
||||
|
||||
Size to(cvRound(from.width * scale), cvRound(from.height * scale));
|
||||
cv::Mat dst(to, matType);
|
||||
|
||||
declare.in(src, WARMUP_RNG).out(dst);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() resize(src, dst, dst.size(), 0, 0, INTER_NEAREST_EXACT);
|
||||
|
||||
EXPECT_GT(countNonZero(dst.reshape(1)), 0);
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user