1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #23754 from dkurt:remap_linear_transparent

Keep inliers for linear remap with BORDER_TRANSPARENT #23754

Address https://github.com/opencv/opencv/issues/23562

### Pull Request Readiness Checklist

resolves https://github.com/opencv/opencv/issues/23562

I do think that this is a bug because with `INTER_CUBIC + BORDER_TRANSPARENT` the last column and row are preserved. So same should be done for `INTER_LINEAR`

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Dmitry Kurtaev
2023-06-16 18:30:21 +03:00
committed by GitHub
parent 003d048b0d
commit ec95efca10
2 changed files with 29 additions and 7 deletions
+16
View File
@@ -1658,5 +1658,21 @@ TEST(Imgproc_warpPolar, identity)
#endif
}
TEST(Imgproc_Remap, issue_23562)
{
cv::RNG rng(17);
Mat_<float> mapx({3, 3}, {0, 1, 2, 0, 1, 2, 0, 1, 2});
Mat_<float> mapy({3, 3}, {0, 0, 0, 1, 1, 1, 2, 2, 2});
for (int cn = 1; cn <= 4; ++cn) {
Mat src(3, 3, CV_32FC(cn));
rng.fill(src, cv::RNG::UNIFORM, -1, 1);
Mat dst = Mat::zeros(3, 3, CV_32FC(cn));
Mat ref = src.clone();
remap(src, dst, mapx, mapy, INTER_LINEAR, BORDER_TRANSPARENT);
ASSERT_EQ(0.0, cvtest::norm(ref, dst, NORM_INF)) << "channels=" << cn;
}
}
}} // namespace
/* End of file. */