Merge pull request #16497 from keeper121:master

* Fix NN resize with dimentions > 4

* add test check for nn resize with channels > 4

* Change types from float to double

* Del unnecessary test file. Move nn test to test_imgwarp. Add 5 channels test only.
This commit is contained in:
keeper121 2020-02-16 19:33:25 +03:00 committed by GitHub
parent f81fdd58da
commit d84360e7f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -1045,7 +1045,7 @@ public:
{
const int* _tS = (const int*)(S + x_ofs[x]);
int* _tD = (int*)D;
for( int k = 0; k < pix_size4; k++ )
for( int k = 0; k <= pix_size4; k++ )
_tD[k] = _tS[k];
}
}

View File

@ -1721,6 +1721,21 @@ TEST(Resize, lanczos4_regression_16192)
EXPECT_EQ(cvtest::norm(dst, expected, NORM_INF), 0) << dst(Rect(0,0,8,8));
}
TEST(Resize, nearest_regression_15075)
{
const int C = 5;
const int i1 = 5, j1 = 5;
Size src_size(12, 12);
Size dst_size(11, 11);
cv::Mat src = cv::Mat::zeros(src_size, CV_8UC(C)), dst;
for (int j = 0; j < C; j++)
src.col(i1).row(j1).data[j] = 1;
cv::resize(src, dst, dst_size, 0, 0, INTER_NEAREST);
EXPECT_EQ(C, cvtest::norm(dst, NORM_L1)) << src.size;
}
TEST(Imgproc_Warp, multichannel)
{
static const int inter_types[] = {INTER_NEAREST, INTER_AREA, INTER_CUBIC,