Add sanity checks support for vertor<KeyPoint>
This commit is contained in:
parent
5a5c477be6
commit
95b6a103b5
@ -581,7 +581,7 @@ function(ocv_add_perf_tests)
|
||||
__ocv_parse_test_sources(PERF ${ARGN})
|
||||
|
||||
# opencv_highgui is required for imread/imwrite
|
||||
set(perf_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_PERF_${the_module}_DEPS})
|
||||
set(perf_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_PERF_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
|
||||
ocv_check_dependencies(${perf_deps})
|
||||
|
||||
if(OCV_DEPENDENCIES_FOUND)
|
||||
@ -632,7 +632,7 @@ function(ocv_add_accuracy_tests)
|
||||
__ocv_parse_test_sources(TEST ${ARGN})
|
||||
|
||||
# opencv_highgui is required for imread/imwrite
|
||||
set(test_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_TEST_${the_module}_DEPS})
|
||||
set(test_deps ${the_module} opencv_ts opencv_highgui ${OPENCV_TEST_${the_module}_DEPS} ${OPENCV_MODULE_opencv_ts_DEPS})
|
||||
ocv_check_dependencies(${test_deps})
|
||||
|
||||
if(OCV_DEPENDENCIES_FOUND)
|
||||
|
@ -10,7 +10,8 @@ endif()
|
||||
|
||||
set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
|
||||
|
||||
ocv_add_module(ts opencv_core)
|
||||
ocv_add_module(ts opencv_core opencv_features2d)
|
||||
|
||||
ocv_glob_module_sources()
|
||||
ocv_module_include_directories()
|
||||
ocv_create_module()
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define __OPENCV_TS_PERF_HPP__
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/features2d/features2d.hpp"
|
||||
#include "ts_gtest.h"
|
||||
|
||||
#ifdef HAVE_TBB
|
||||
@ -165,6 +166,7 @@ class CV_EXPORTS Regression
|
||||
{
|
||||
public:
|
||||
static Regression& add(TestBase* test, const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
|
||||
static Regression& addKeypoints(TestBase* test, const std::string& name, const std::vector<cv::KeyPoint>& array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
|
||||
static void Init(const std::string& testSuitName, const std::string& ext = ".xml");
|
||||
|
||||
Regression& operator() (const std::string& name, cv::InputArray array, double eps = DBL_EPSILON, ERROR_TYPE err = ERROR_ABSOLUTE);
|
||||
@ -199,6 +201,7 @@ private:
|
||||
};
|
||||
|
||||
#define SANITY_CHECK(array, ...) ::perf::Regression::add(this, #array, array , ## __VA_ARGS__)
|
||||
#define SANITY_CHECK_KEYPOINTS(array, ...) ::perf::Regression::addKeypoints(this, #array, array , ## __VA_ARGS__)
|
||||
|
||||
|
||||
/*****************************************************************************************\
|
||||
|
@ -103,6 +103,24 @@ Regression& Regression::add(TestBase* test, const std::string& name, cv::InputAr
|
||||
return instance()(name, array, eps, err);
|
||||
}
|
||||
|
||||
Regression& Regression::addKeypoints(TestBase* test, const std::string& name, const std::vector<cv::KeyPoint>& array, double eps, ERROR_TYPE err)
|
||||
{
|
||||
int len = (int)array.size();
|
||||
cv::Mat pt (len, 1, CV_32FC2, (void*)&array[0].pt, sizeof(cv::KeyPoint));
|
||||
cv::Mat size (len, 1, CV_32FC1, (void*)&array[0].size, sizeof(cv::KeyPoint));
|
||||
cv::Mat angle (len, 1, CV_32FC1, (void*)&array[0].angle, sizeof(cv::KeyPoint));
|
||||
cv::Mat response(len, 1, CV_32FC1, (void*)&array[0].response, sizeof(cv::KeyPoint));
|
||||
cv::Mat octave (len, 1, CV_32SC1, (void*)&array[0].octave, sizeof(cv::KeyPoint));
|
||||
cv::Mat class_id(len, 1, CV_32SC1, (void*)&array[0].class_id, sizeof(cv::KeyPoint));
|
||||
|
||||
return Regression::add(test, name + "-pt", pt, eps, ERROR_ABSOLUTE)
|
||||
(name + "-size", size, eps, ERROR_ABSOLUTE)
|
||||
(name + "-angle", angle, eps, ERROR_ABSOLUTE)
|
||||
(name + "-response", response, eps, err)
|
||||
(name + "-octave", octave, eps, ERROR_ABSOLUTE)
|
||||
(name + "-class_id", class_id, eps, ERROR_ABSOLUTE);
|
||||
}
|
||||
|
||||
void Regression::Init(const std::string& testSuitName, const std::string& ext)
|
||||
{
|
||||
instance().init(testSuitName, ext);
|
||||
@ -490,6 +508,12 @@ void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERR
|
||||
|
||||
Regression& Regression::operator() (const std::string& name, cv::InputArray array, double eps, ERROR_TYPE err)
|
||||
{
|
||||
if(!array.empty() && array.depth() == CV_USRTYPE1)
|
||||
{
|
||||
ADD_FAILURE() << " Can not check regression for CV_USRTYPE1 data type for " << name;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string nodename = getCurrentTestNodeName();
|
||||
|
||||
cv::FileNode n = rootIn[nodename];
|
||||
|
Loading…
x
Reference in New Issue
Block a user