mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 03:30:34 +08:00
Add sanity check support for vector<DMatch>
This commit is contained in:
parent
d970a9159e
commit
39d6eb7312
@ -167,6 +167,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 Regression& addMatches(TestBase* test, const std::string& name, const std::vector<cv::DMatch>& 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);
|
||||
@ -202,6 +203,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__)
|
||||
#define SANITY_CHECK_MATCHES(array, ...) ::perf::Regression::addMatches(this, #array, array , ## __VA_ARGS__)
|
||||
|
||||
|
||||
/*****************************************************************************************\
|
||||
|
@ -121,6 +121,20 @@ Regression& Regression::addKeypoints(TestBase* test, const std::string& name, co
|
||||
(name + "-class_id", class_id, eps, ERROR_ABSOLUTE);
|
||||
}
|
||||
|
||||
Regression& Regression::addMatches(TestBase* test, const std::string& name, const std::vector<cv::DMatch>& array, double eps, ERROR_TYPE err)
|
||||
{
|
||||
int len = (int)array.size();
|
||||
cv::Mat queryIdx(len, 1, CV_32SC1, (void*)&array[0].queryIdx, sizeof(cv::DMatch));
|
||||
cv::Mat trainIdx(len, 1, CV_32SC1, (void*)&array[0].trainIdx, sizeof(cv::DMatch));
|
||||
cv::Mat imgIdx (len, 1, CV_32SC1, (void*)&array[0].imgIdx, sizeof(cv::DMatch));
|
||||
cv::Mat distance(len, 1, CV_32FC1, (void*)&array[0].distance, sizeof(cv::DMatch));
|
||||
|
||||
return Regression::add(test, name + "-queryIdx", queryIdx, DBL_EPSILON, ERROR_ABSOLUTE)
|
||||
(name + "-trainIdx", trainIdx, DBL_EPSILON, ERROR_ABSOLUTE)
|
||||
(name + "-imgIdx", imgIdx, DBL_EPSILON, ERROR_ABSOLUTE)
|
||||
(name + "-distance", distance, eps, err);
|
||||
}
|
||||
|
||||
void Regression::Init(const std::string& testSuitName, const std::string& ext)
|
||||
{
|
||||
instance().init(testSuitName, ext);
|
||||
|
Loading…
Reference in New Issue
Block a user