Skip to content

Commit 49ea864

Browse files
committed
Merge pull request #3095 from JulieBar:remap_overflow
2 parents 939129d + ab13816 commit 49ea864

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

modules/cudawarping/test/test_remap.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
//M*/
4242

4343
#include "test_precomp.hpp"
44+
#include "opencv2/core/matx.hpp"
45+
#include "nppdefs.h"
4446

4547
#ifdef HAVE_CUDA
4648

@@ -178,5 +180,29 @@ INSTANTIATE_TEST_CASE_P(CUDA_Warping, Remap, testing::Combine(
178180
WHOLE_SUBMAT));
179181

180182

183+
class RemapOutOfScope : public Remap {};
184+
CUDA_TEST_P(RemapOutOfScope, Regression_18224)
185+
{
186+
cv::Mat src = randomMat(size, type);
187+
cv::cuda::GpuMat dst = createMat(xmap.size(), type, useRoi);
188+
randu(xmap, NPP_MAX_32S, NPP_MAXABS_32F);
189+
randu(ymap, NPP_MAX_32S, NPP_MAXABS_32F);
190+
191+
cv::cuda::remap(loadMat(src, useRoi), dst, loadMat(xmap, useRoi), loadMat(ymap, useRoi), interpolation, borderType, 0.);
192+
193+
cv::Mat dst_gold;
194+
remapGold(src, xmap, ymap, dst_gold, interpolation, borderType, 0.);
195+
196+
EXPECT_MAT_NEAR(dst_gold, dst, src.depth() == CV_32F ? 1e-3 : 1.0);
197+
}
198+
199+
INSTANTIATE_TEST_CASE_P(CUDA_Warping, RemapOutOfScope, testing::Combine(
200+
ALL_DEVICES,
201+
DIFFERENT_SIZES,
202+
testing::Values(MatType(CV_8UC1), MatType(CV_8UC3), MatType(CV_8UC4), MatType(CV_32FC1), MatType(CV_32FC3), MatType(CV_32FC4)),
203+
testing::Values(Interpolation(cv::INTER_NEAREST), Interpolation(cv::INTER_LINEAR)),
204+
testing::Values(BorderType(cv::BORDER_CONSTANT)),
205+
WHOLE_SUBMAT));
206+
181207
}} // namespace
182208
#endif // HAVE_CUDA

0 commit comments

Comments
 (0)