make test tolerate to rounding error

pull/23154/head
Tomoaki Teshima 2 years ago
parent 0862d69a6e
commit 1833b034fe
  1. 22
      modules/ts/src/cuda_test.cpp

@ -519,6 +519,8 @@ namespace cvtest
int validCount = 0;
if (actual.size() == gold.size())
{
for (size_t i = 0; i < gold.size(); ++i)
{
const cv::KeyPoint& p1 = gold[i];
@ -527,6 +529,26 @@ namespace cvtest
if (keyPointsEquals(p1, p2))
++validCount;
}
}
else
{
std::vector<cv::KeyPoint>& shorter = gold;
std::vector<cv::KeyPoint>& longer = actual;
if (actual.size() < gold.size())
{
shorter = actual;
longer = gold;
}
for (size_t i = 0; i < shorter.size(); ++i)
{
const cv::KeyPoint& p1 = shorter[i];
const cv::KeyPoint& p2 = longer[i];
const cv::KeyPoint& p3 = longer[i+1];
if (keyPointsEquals(p1, p2) || keyPointsEquals(p1, p3))
++validCount;
}
}
return validCount;
}

Loading…
Cancel
Save