diff --git a/modules/gpu/test/test_calib3d.cpp b/modules/gpu/test/test_calib3d.cpp index 45404b26f5b463926d526a90d8952759d74077c8..bee814d183a7472a89734c9d34c7f46d7fd5bdbe 100644 --- a/modules/gpu/test/test_calib3d.cpp +++ b/modules/gpu/test/test_calib3d.cpp @@ -88,17 +88,21 @@ TEST_P(StereoBlockMatching, Regression) ASSERT_TRUE(!img_l.empty() && !img_r.empty() && !img_template.empty()); PRINT_PARAM(devInfo); + + cv::Mat disp; - cv::gpu::GpuMat disp; - cv::gpu::StereoBM_GPU bm(0, 128, 19); + ASSERT_NO_THROW( + cv::gpu::GpuMat dev_disp; + cv::gpu::StereoBM_GPU bm(0, 128, 19); - bm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp); + bm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), dev_disp); + + dev_disp.download(disp); + ); disp.convertTo(disp, img_template.type()); - - ASSERT_EQ(img_template.size(), disp.size()); - double norm = cv::norm(img_template, (cv::Mat)disp, cv::NORM_INF); - ASSERT_EQ(0.0, norm); + + EXPECT_MAT_NEAR(img_template, disp, 0.0); } INSTANTIATE_TEST_CASE_P(Calib3D, StereoBlockMatching, testing::ValuesIn(devices())); @@ -122,16 +126,20 @@ TEST_P(StereoBeliefPropagation, Regression) PRINT_PARAM(devInfo); - cv::gpu::GpuMat disp; - cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S); + cv::Mat disp; - bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp); + ASSERT_NO_THROW( + cv::gpu::GpuMat dev_disp; + cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S); - disp.convertTo(disp, img_template.type()); + bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), dev_disp); + + dev_disp.download(disp); + ); - ASSERT_EQ(img_template.size(), disp.size()); - double norm = cv::norm(img_template, (cv::Mat)disp, cv::NORM_INF); - ASSERT_EQ(0.0, norm); + disp.convertTo(disp, img_template.type()); + + EXPECT_MAT_NEAR(img_template, disp, 0.0); } INSTANTIATE_TEST_CASE_P(Calib3D, StereoBeliefPropagation, testing::ValuesIn(devices())); @@ -164,16 +172,20 @@ TEST_P(StereoConstantSpaceBP, Regression) PRINT_PARAM(devInfo); - cv::gpu::GpuMat disp; - cv::gpu::StereoConstantSpaceBP bpm(128, 16, 4, 4); + cv::Mat disp; - bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp); + ASSERT_NO_THROW( + cv::gpu::GpuMat dev_disp; + cv::gpu::StereoConstantSpaceBP bpm(128, 16, 4, 4); - disp.convertTo(disp, img_template.type()); + bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), dev_disp); + + dev_disp.download(disp); + ); - ASSERT_EQ(img_template.size(), disp.size()); - double norm = cv::norm(img_template, (cv::Mat)disp, cv::NORM_INF); - ASSERT_EQ(0.0, norm); + disp.convertTo(disp, img_template.type()); + + EXPECT_MAT_NEAR(img_template, disp, 1.0); } INSTANTIATE_TEST_CASE_P(Calib3D, StereoConstantSpaceBP, testing::ValuesIn(devices())); diff --git a/modules/gpu/test/test_imgproc.cpp b/modules/gpu/test/test_imgproc.cpp index 219b73e4abaaed2284f65f7ece9b5c76dcfc403e..836f2de426956fa3ff37a26a0b55fc3b3623764d 100644 --- a/modules/gpu/test/test_imgproc.cpp +++ b/modules/gpu/test/test_imgproc.cpp @@ -1629,7 +1629,7 @@ TEST_P(MeanShiftSegmentation, Regression) cv::Mat dst_rgb; cv::cvtColor(dst, dst_rgb, CV_BGRA2BGR); - EXPECT_MAT_SIMILAR(dst_gold, dst_rgb, 1e-5); + EXPECT_MAT_SIMILAR(dst_gold, dst_rgb, 1e-3); } INSTANTIATE_TEST_CASE_P(ImgProc, MeanShiftSegmentation, testing::Combine( diff --git a/modules/gpu/test/test_matop.cpp b/modules/gpu/test/test_matop.cpp index 470306d5150bd6a3daedd3858d83dd0d76d6fdf1..8b16a9a9dcdf7d0d8687ee6a9e8eadfe5908aed6 100644 --- a/modules/gpu/test/test_matop.cpp +++ b/modules/gpu/test/test_matop.cpp @@ -421,9 +421,9 @@ TEST_P(CopyTo, Masked) cv::RNG& rng = cvtest::TS::ptr()->get_rng(); - cv::Mat mask = cvtest::randomMat(rng, src.size(), CV_8UC1, 0.0, 1.5, false); + cv::Mat mask = cvtest::randomMat(rng, src.size(), CV_8UC1, 0.0, 2.0, false); - cv::Mat dst_gold; + cv::Mat dst_gold(src.size(), src.type(), cv::Scalar::all(0)); src.copyTo(dst_gold, mask); cv::Mat dst; @@ -431,7 +431,7 @@ TEST_P(CopyTo, Masked) ASSERT_NO_THROW( cv::gpu::GpuMat dev_src(src); - cv::gpu::GpuMat dev_dst; + cv::gpu::GpuMat dev_dst(src.size(), src.type(), cv::Scalar::all(0)); dev_src.copyTo(dev_dst, cv::gpu::GpuMat(mask));