diff --git a/modules/xfeatures2d/test/test_features2d.cpp b/modules/xfeatures2d/test/test_features2d.cpp index d0b470d9e..ce1106c51 100644 --- a/modules/xfeatures2d/test/test_features2d.cpp +++ b/modules/xfeatures2d/test/test_features2d.cpp @@ -1054,10 +1054,32 @@ TEST( Features2d_DescriptorExtractor_BRIEF, regression ) test.safe_run(); } +template +struct LUCIDEqualityDistance +{ + typedef unsigned char ValueType; + typedef int ResultType; + + ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const + { + int res = 0; + for (int i = 0; i < size; i++) + { + if (threshold == 0) + res += (a[i] != b[i]) ? 1 : 0; + else + res += abs(a[i] - b[i]) > threshold ? 1 : 0; + } + return res; + } +}; + TEST( Features2d_DescriptorExtractor_LUCID, regression ) { - CV_DescriptorExtractorTest test( "descriptor-lucid", 1, - LUCID::create(1, 2) ); + CV_DescriptorExtractorTest< LUCIDEqualityDistance<1/*used blur is not bit-exact*/> > test( + "descriptor-lucid", 2, + LUCID::create(1, 2) + ); test.safe_run(); } diff --git a/modules/ximgproc/test/test_rolling_guidance_filter.cpp b/modules/ximgproc/test/test_rolling_guidance_filter.cpp index a29f9c4e2..f175118e6 100644 --- a/modules/ximgproc/test/test_rolling_guidance_filter.cpp +++ b/modules/ximgproc/test/test_rolling_guidance_filter.cpp @@ -53,11 +53,8 @@ static std::string getOpenCVExtraDir() static void checkSimilarity(InputArray src, InputArray ref) { - double normInf = cvtest::norm(src, ref, NORM_INF); - double normL2 = cvtest::norm(src, ref, NORM_L2) / (src.total()*src.channels()); - - EXPECT_LE(normInf, 1.0); - EXPECT_LE(normL2, 1.0 / 16); + // Doesn't work with bilateral filter: EXPECT_LE(cvtest::norm(src, ref, NORM_INF), 1.0); + EXPECT_LE(cvtest::norm(src, ref, NORM_L2 | NORM_RELATIVE), 1e-3); } static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize)