mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 19:50:38 +08:00
Merge pull request #3545 from jet47:gpu-match-template-tests
This commit is contained in:
commit
ba84eb58f2
@ -692,7 +692,18 @@ GPU_TEST_P(MatchTemplate8U, Accuracy)
|
||||
cv::Mat dst_gold;
|
||||
cv::matchTemplate(image, templ, dst_gold, method);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, templ_size.area() * 1e-1);
|
||||
cv::Mat h_dst(dst);
|
||||
ASSERT_EQ(dst_gold.size(), h_dst.size());
|
||||
ASSERT_EQ(dst_gold.type(), h_dst.type());
|
||||
for (int y = 0; y < h_dst.rows; ++y)
|
||||
{
|
||||
for (int x = 0; x < h_dst.cols; ++x)
|
||||
{
|
||||
float gold_val = dst_gold.at<float>(y, x);
|
||||
float actual_val = dst_gold.at<float>(y, x);
|
||||
ASSERT_FLOAT_EQ(gold_val, actual_val) << y << ", " << x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate8U, testing::Combine(
|
||||
@ -738,7 +749,18 @@ GPU_TEST_P(MatchTemplate32F, Regression)
|
||||
cv::Mat dst_gold;
|
||||
cv::matchTemplate(image, templ, dst_gold, method);
|
||||
|
||||
EXPECT_MAT_NEAR(dst_gold, dst, templ_size.area() * 1e-1);
|
||||
cv::Mat h_dst(dst);
|
||||
ASSERT_EQ(dst_gold.size(), h_dst.size());
|
||||
ASSERT_EQ(dst_gold.type(), h_dst.type());
|
||||
for (int y = 0; y < h_dst.rows; ++y)
|
||||
{
|
||||
for (int x = 0; x < h_dst.cols; ++x)
|
||||
{
|
||||
float gold_val = dst_gold.at<float>(y, x);
|
||||
float actual_val = dst_gold.at<float>(y, x);
|
||||
ASSERT_FLOAT_EQ(gold_val, actual_val) << y << ", " << x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate32F, testing::Combine(
|
||||
|
Loading…
Reference in New Issue
Block a user