Merge pull request #1141 from alalek:fix_tests

pull/1117/head
Alexander Alekhin 8 years ago
commit 32b3b4d256
  1. 26
      modules/xfeatures2d/test/test_features2d.cpp
  2. 7
      modules/ximgproc/test/test_rolling_guidance_filter.cpp

@ -1054,10 +1054,32 @@ TEST( Features2d_DescriptorExtractor_BRIEF, regression )
test.safe_run();
}
template <int threshold = 0>
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<Hamming> 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();
}

@ -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)

Loading…
Cancel
Save