diff --git a/modules/ts/src/cuda_test.cpp b/modules/ts/src/cuda_test.cpp index 39658c403afa..28808ead2e0e 100644 --- a/modules/ts/src/cuda_test.cpp +++ b/modules/ts/src/cuda_test.cpp @@ -519,13 +519,35 @@ namespace cvtest int validCount = 0; - for (size_t i = 0; i < gold.size(); ++i) + if (actual.size() == gold.size()) { - const cv::KeyPoint& p1 = gold[i]; - const cv::KeyPoint& p2 = actual[i]; + for (size_t i = 0; i < gold.size(); ++i) + { + const cv::KeyPoint& p1 = gold[i]; + const cv::KeyPoint& p2 = actual[i]; - if (keyPointsEquals(p1, p2)) - ++validCount; + if (keyPointsEquals(p1, p2)) + ++validCount; + } + } + else + { + std::vector& shorter = gold; + std::vector& 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;