ASSERT_TRUE(!img_l.empty() && !img_r.empty() && !img_template.empty());\r
\r
PRINT_PARAM(devInfo);\r
+ \r
+ cv::Mat disp;\r
\r
- cv::gpu::GpuMat disp;\r
- cv::gpu::StereoBM_GPU bm(0, 128, 19);\r
+ ASSERT_NO_THROW(\r
+ cv::gpu::GpuMat dev_disp;\r
+ cv::gpu::StereoBM_GPU bm(0, 128, 19);\r
\r
- bm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp);\r
+ bm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), dev_disp);\r
+ \r
+ dev_disp.download(disp);\r
+ );\r
\r
disp.convertTo(disp, img_template.type());\r
-\r
- ASSERT_EQ(img_template.size(), disp.size());\r
- double norm = cv::norm(img_template, (cv::Mat)disp, cv::NORM_INF);\r
- ASSERT_EQ(0.0, norm);\r
+ \r
+ EXPECT_MAT_NEAR(img_template, disp, 0.0);\r
}\r
\r
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBlockMatching, testing::ValuesIn(devices()));\r
\r
PRINT_PARAM(devInfo);\r
\r
- cv::gpu::GpuMat disp;\r
- cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S);\r
+ cv::Mat disp;\r
\r
- bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp);\r
+ ASSERT_NO_THROW(\r
+ cv::gpu::GpuMat dev_disp;\r
+ cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S);\r
\r
- disp.convertTo(disp, img_template.type());\r
+ bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), dev_disp);\r
+ \r
+ dev_disp.download(disp);\r
+ );\r
\r
- ASSERT_EQ(img_template.size(), disp.size());\r
- double norm = cv::norm(img_template, (cv::Mat)disp, cv::NORM_INF);\r
- ASSERT_EQ(0.0, norm);\r
+ disp.convertTo(disp, img_template.type());\r
+ \r
+ EXPECT_MAT_NEAR(img_template, disp, 0.0);\r
}\r
\r
INSTANTIATE_TEST_CASE_P(Calib3D, StereoBeliefPropagation, testing::ValuesIn(devices()));\r
\r
PRINT_PARAM(devInfo);\r
\r
- cv::gpu::GpuMat disp;\r
- cv::gpu::StereoConstantSpaceBP bpm(128, 16, 4, 4);\r
+ cv::Mat disp;\r
\r
- bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp);\r
+ ASSERT_NO_THROW(\r
+ cv::gpu::GpuMat dev_disp;\r
+ cv::gpu::StereoConstantSpaceBP bpm(128, 16, 4, 4);\r
\r
- disp.convertTo(disp, img_template.type());\r
+ bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), dev_disp);\r
+ \r
+ dev_disp.download(disp);\r
+ );\r
\r
- ASSERT_EQ(img_template.size(), disp.size());\r
- double norm = cv::norm(img_template, (cv::Mat)disp, cv::NORM_INF);\r
- ASSERT_EQ(0.0, norm);\r
+ disp.convertTo(disp, img_template.type());\r
+ \r
+ EXPECT_MAT_NEAR(img_template, disp, 1.0);\r
}\r
\r
INSTANTIATE_TEST_CASE_P(Calib3D, StereoConstantSpaceBP, testing::ValuesIn(devices()));\r
\r
cv::RNG& rng = cvtest::TS::ptr()->get_rng();\r
\r
- cv::Mat mask = cvtest::randomMat(rng, src.size(), CV_8UC1, 0.0, 1.5, false);\r
+ cv::Mat mask = cvtest::randomMat(rng, src.size(), CV_8UC1, 0.0, 2.0, false);\r
\r
- cv::Mat dst_gold;\r
+ cv::Mat dst_gold(src.size(), src.type(), cv::Scalar::all(0));\r
src.copyTo(dst_gold, mask);\r
\r
cv::Mat dst;\r
ASSERT_NO_THROW(\r
cv::gpu::GpuMat dev_src(src);\r
\r
- cv::gpu::GpuMat dev_dst;\r
+ cv::gpu::GpuMat dev_dst(src.size(), src.type(), cv::Scalar::all(0));\r
\r
dev_src.copyTo(dev_dst, cv::gpu::GpuMat(mask));\r
\r