Commit b6313951 authored by yao's avatar yao

use clean EXPECT_MAT_NEAR (no string output)

parent 35c6860f
This diff is collapsed.
...@@ -109,7 +109,7 @@ TEST_P(Blend, Accuracy) ...@@ -109,7 +109,7 @@ TEST_P(Blend, Accuracy)
else else
blendLinearGold<float>(img1, img2, weights1, weights2, result_gold); blendLinearGold<float>(img1, img2, weights1, weights2, result_gold);
EXPECT_MAT_NEAR(result_gold, result, CV_MAT_DEPTH(type) == CV_8U ? 1.f : 1e-5f, 0); EXPECT_MAT_NEAR(result_gold, result, CV_MAT_DEPTH(type) == CV_8U ? 1.f : 1e-5f);
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Blend, Combine( INSTANTIATE_TEST_CASE_P(GPU_ImgProc, Blend, Combine(
......
...@@ -129,7 +129,7 @@ TEST_P(StereoMatchBP, Regression) ...@@ -129,7 +129,7 @@ TEST_P(StereoMatchBP, Regression)
bp(d_left, d_right, d_disp); bp(d_left, d_right, d_disp);
d_disp.download(disp); d_disp.download(disp);
disp.convertTo(disp, disp_gold.depth()); disp.convertTo(disp, disp_gold.depth());
EXPECT_MAT_NEAR(disp_gold, disp, 0.0, ""); EXPECT_MAT_NEAR(disp_gold, disp, 0.0);
} }
INSTANTIATE_TEST_CASE_P(OCL_Calib3D, StereoMatchBP, testing::Combine(testing::Values(64), INSTANTIATE_TEST_CASE_P(OCL_Calib3D, StereoMatchBP, testing::Combine(testing::Values(64),
testing::Values(8),testing::Values(2),testing::Values(25.0f), testing::Values(8),testing::Values(2),testing::Values(25.0f),
......
...@@ -100,7 +100,7 @@ PARAM_TEST_CASE(CvtColor, cv::Size, MatDepth) ...@@ -100,7 +100,7 @@ PARAM_TEST_CASE(CvtColor, cv::Size, MatDepth)
cv::cvtColor(src, dst_gold, CVTCODE(name));\ cv::cvtColor(src, dst_gold, CVTCODE(name));\
cv::Mat dst_mat;\ cv::Mat dst_mat;\
dst.download(dst_mat);\ dst.download(dst_mat);\
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5, "");\ EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5);\
} }
//add new ones here using macro //add new ones here using macro
...@@ -141,7 +141,7 @@ TEST_P(CvtColor_Gray2RGB, Accuracy) ...@@ -141,7 +141,7 @@ TEST_P(CvtColor_Gray2RGB, Accuracy)
cv::cvtColor(src, dst_gold, code); cv::cvtColor(src, dst_gold, code);
cv::Mat dst_mat; cv::Mat dst_mat;
dst.download(dst_mat); dst.download(dst_mat);
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5, ""); EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5);
} }
...@@ -171,7 +171,7 @@ TEST_P(CvtColor_YUV420, Accuracy) ...@@ -171,7 +171,7 @@ TEST_P(CvtColor_YUV420, Accuracy)
cv::Mat dst_mat; cv::Mat dst_mat;
dst.download(dst_mat); dst.download(dst_mat);
MAT_DIFF(dst_mat, dst_gold); MAT_DIFF(dst_mat, dst_gold);
EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5, ""); EXPECT_MAT_NEAR(dst_gold, dst_mat, 1e-5);
} }
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor, testing::Combine(
......
...@@ -127,7 +127,7 @@ PARAM_TEST_CASE(FilterTestBase, ...@@ -127,7 +127,7 @@ PARAM_TEST_CASE(FilterTestBase,
{ {
cv::Mat cpu_dst; cv::Mat cpu_dst;
gdst_whole.download(cpu_dst); gdst_whole.download(cpu_dst);
EXPECT_MAT_NEAR(dst, cpu_dst, threshold, ""); EXPECT_MAT_NEAR(dst, cpu_dst, threshold);
} }
}; };
......
...@@ -240,8 +240,7 @@ TEST_P(HOG, Detect) ...@@ -240,8 +240,7 @@ TEST_P(HOG, Detect)
} }
} }
char s[100] = {0}; EXPECT_MAT_NEAR(cv::Mat(d_comp), cv::Mat(comp), 3);
EXPECT_MAT_NEAR(cv::Mat(d_comp), cv::Mat(comp), 3, s);
} }
......
This diff is collapsed.
...@@ -76,20 +76,20 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2); ...@@ -76,20 +76,20 @@ double checkSimilarity(const cv::Mat &m1, const cv::Mat &m2);
EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \ EXPECT_LE(checkNorm(cv::Mat(mat)), eps) \
} }
/*#define EXPECT_MAT_NEAR(mat1, mat2, eps) \ #define EXPECT_MAT_NEAR(mat1, mat2, eps) \
{ \ { \
ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.size(), mat2.size()); \ ASSERT_EQ(mat1.size(), mat2.size()); \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \ EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps); \
}*/ }
/*
#define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \ #define EXPECT_MAT_NEAR(mat1, mat2, eps,s) \
{ \ { \
ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
ASSERT_EQ(mat1.size(), mat2.size()); \ ASSERT_EQ(mat1.size(), mat2.size()); \
EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps)<<s; \ EXPECT_LE(checkNorm(cv::Mat(mat1), cv::Mat(mat2)), eps)<<s; \
} }
*/
#define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \ #define EXPECT_MAT_SIMILAR(mat1, mat2, eps) \
{ \ { \
ASSERT_EQ(mat1.type(), mat2.type()); \ ASSERT_EQ(mat1.type(), mat2.type()); \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment