Skip to content

Commit 53626e7

Browse files
committed
avoid test failure based on rounding error
1 parent 364e760 commit 53626e7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

modules/ximgproc/test/test_fbs_filter.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ TEST(FastBilateralSolverTest, SplatSurfaceAccuracy)
8686
}
8787
}
8888

89+
#define COUNT_EXCEED(MAT1, MAT2, THRESHOLD, PIXEL_COUNT) \
90+
{ \
91+
Mat diff, count; \
92+
absdiff(MAT1.reshape(1), MAT2.reshape(1), diff); \
93+
cvtest::compare(diff, THRESHOLD, count, CMP_GT); \
94+
PIXEL_COUNT = countNonZero(count.reshape(1)); \
95+
PIXEL_COUNT /= MAT1.channels(); \
96+
}
97+
8998
TEST(FastBilateralSolverTest, ReferenceAccuracy)
9099
{
91100
string dir = getDataDir() + "cv/edgefilter";
@@ -104,7 +113,14 @@ TEST(FastBilateralSolverTest, ReferenceAccuracy)
104113
double totalMaxError = 1.0/64.0*src.total()*src.channels();
105114

106115
EXPECT_LE(cvtest::norm(res, ref, NORM_L2), totalMaxError);
116+
#if defined (__x86_64__) || defined (_M_X64)
107117
EXPECT_LE(cvtest::norm(res, ref, NORM_INF), 1);
118+
#else
119+
// fastBilateralSolverFilter is not bit-exact
120+
int pixelCount = 0;
121+
COUNT_EXCEED(res, ref, 2, pixelCount);
122+
EXPECT_LE(pixelCount, (int)(res.cols*res.rows*1/100));
123+
#endif
108124
}
109125

110126
INSTANTIATE_TEST_CASE_P(FullSet, FastBilateralSolverTest,Combine(Values(szODD, szQVGA), SrcTypes::all(), GuideTypes::all()));

0 commit comments

Comments
 (0)