mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 11:21:39 +08:00
fix tests
This commit is contained in:
@@ -1054,10 +1054,32 @@ TEST( Features2d_DescriptorExtractor_BRIEF, regression )
|
|||||||
test.safe_run();
|
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 )
|
TEST( Features2d_DescriptorExtractor_LUCID, regression )
|
||||||
{
|
{
|
||||||
CV_DescriptorExtractorTest<Hamming> test( "descriptor-lucid", 1,
|
CV_DescriptorExtractorTest< LUCIDEqualityDistance<1/*used blur is not bit-exact*/> > test(
|
||||||
LUCID::create(1, 2) );
|
"descriptor-lucid", 2,
|
||||||
|
LUCID::create(1, 2)
|
||||||
|
);
|
||||||
test.safe_run();
|
test.safe_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,11 +53,8 @@ static std::string getOpenCVExtraDir()
|
|||||||
|
|
||||||
static void checkSimilarity(InputArray src, InputArray ref)
|
static void checkSimilarity(InputArray src, InputArray ref)
|
||||||
{
|
{
|
||||||
double normInf = cvtest::norm(src, ref, NORM_INF);
|
// Doesn't work with bilateral filter: EXPECT_LE(cvtest::norm(src, ref, NORM_INF), 1.0);
|
||||||
double normL2 = cvtest::norm(src, ref, NORM_L2) / (src.total()*src.channels());
|
EXPECT_LE(cvtest::norm(src, ref, NORM_L2 | NORM_RELATIVE), 1e-3);
|
||||||
|
|
||||||
EXPECT_LE(normInf, 1.0);
|
|
||||||
EXPECT_LE(normL2, 1.0 / 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize)
|
static Mat convertTypeAndSize(Mat src, int dstType, Size dstSize)
|
||||||
|
Reference in New Issue
Block a user