SURF accuracy test is moved to nonfree
This commit is contained in:
parent
6846f881a2
commit
1be58f9a00
@ -69,5 +69,3 @@ int main(int argc, char** argv)
|
|||||||
#else // HAVE_CUDA
|
#else // HAVE_CUDA
|
||||||
|
|
||||||
CV_TEST_MAIN("cv")
|
CV_TEST_MAIN("cv")
|
||||||
|
|
||||||
#endif // HAVE_CUDA
|
|
||||||
|
@ -9,16 +9,16 @@
|
|||||||
#ifndef __OPENCV_TEST_PRECOMP_HPP__
|
#ifndef __OPENCV_TEST_PRECOMP_HPP__
|
||||||
#define __OPENCV_TEST_PRECOMP_HPP__
|
#define __OPENCV_TEST_PRECOMP_HPP__
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "cvconfig.h"
|
|
||||||
#include "opencv2/opencv_modules.hpp"
|
|
||||||
|
|
||||||
#include "opencv2/ts/ts.hpp"
|
#include "opencv2/ts/ts.hpp"
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
#include "opencv2/highgui/highgui.hpp"
|
#include "opencv2/highgui/highgui.hpp"
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
#include "opencv2/nonfree/nonfree.hpp"
|
||||||
|
|
||||||
|
#include "opencv2/opencv_modules.hpp"
|
||||||
|
#ifdef HAVE_OPENCV_OCL
|
||||||
|
# include "opencv2/nonfree/ocl.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA)
|
#if defined(HAVE_OPENCV_GPU) && defined(HAVE_CUDA)
|
||||||
#include "opencv2/ts/gpu_test.hpp"
|
#include "opencv2/ts/gpu_test.hpp"
|
||||||
#include "opencv2/nonfree/gpu.hpp"
|
#include "opencv2/nonfree/gpu.hpp"
|
||||||
|
@ -43,13 +43,12 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
|
#include "test_precomp.hpp"
|
||||||
|
|
||||||
#include "precomp.hpp"
|
#ifdef HAVE_OPENCV_OCL
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
|
|
||||||
extern std::string workdir;
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using std::tr1::get;
|
||||||
|
|
||||||
static bool keyPointsEquals(const cv::KeyPoint& p1, const cv::KeyPoint& p2)
|
static bool keyPointsEquals(const cv::KeyPoint& p1, const cv::KeyPoint& p2)
|
||||||
{
|
{
|
||||||
@ -73,22 +72,12 @@ static bool keyPointsEquals(const cv::KeyPoint& p1, const cv::KeyPoint& p2)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct KeyPointLess : std::binary_function<cv::KeyPoint, cv::KeyPoint, bool>
|
|
||||||
{
|
|
||||||
bool operator()(const cv::KeyPoint& kp1, const cv::KeyPoint& kp2) const
|
|
||||||
{
|
|
||||||
return kp1.pt.y < kp2.pt.y || (kp1.pt.y == kp2.pt.y && kp1.pt.x < kp2.pt.x);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define ASSERT_KEYPOINTS_EQ(gold, actual) EXPECT_PRED_FORMAT2(assertKeyPointsEquals, gold, actual);
|
#define ASSERT_KEYPOINTS_EQ(gold, actual) EXPECT_PRED_FORMAT2(assertKeyPointsEquals, gold, actual);
|
||||||
|
|
||||||
static int getMatchedPointsCount(std::vector<cv::KeyPoint>& gold, std::vector<cv::KeyPoint>& actual)
|
static int getMatchedPointsCount(std::vector<cv::KeyPoint>& gold, std::vector<cv::KeyPoint>& actual)
|
||||||
{
|
{
|
||||||
std::sort(actual.begin(), actual.end(), KeyPointLess());
|
std::sort(actual.begin(), actual.end(), perf::comparators::KeypointGreater());
|
||||||
std::sort(gold.begin(), gold.end(), KeyPointLess());
|
std::sort(gold.begin(), gold.end(), perf::comparators::KeypointGreater());
|
||||||
|
|
||||||
int validCount = 0;
|
int validCount = 0;
|
||||||
|
|
||||||
@ -122,13 +111,29 @@ static int getMatchedPointsCount(const std::vector<cv::KeyPoint>& keypoints1, co
|
|||||||
return validCount;
|
return validCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_PARAM_CLASS(SURF_HessianThreshold, double)
|
#define PARAM_TEST_CASE(name, ...) struct name : testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > >
|
||||||
IMPLEMENT_PARAM_CLASS(SURF_Octaves, int)
|
#define IMPLEMENT_PARAM_CLASS(name, type) \
|
||||||
IMPLEMENT_PARAM_CLASS(SURF_OctaveLayers, int)
|
namespace { \
|
||||||
IMPLEMENT_PARAM_CLASS(SURF_Extended, bool)
|
class name \
|
||||||
IMPLEMENT_PARAM_CLASS(SURF_Upright, bool)
|
{ \
|
||||||
|
public: \
|
||||||
|
name ( type arg = type ()) : val_(arg) {} \
|
||||||
|
operator type () const {return val_;} \
|
||||||
|
private: \
|
||||||
|
type val_; \
|
||||||
|
}; \
|
||||||
|
inline void PrintTo( name param, std::ostream* os) \
|
||||||
|
{ \
|
||||||
|
*os << #name << "(" << testing::PrintToString(static_cast< type >(param)) << ")"; \
|
||||||
|
}}
|
||||||
|
|
||||||
PARAM_TEST_CASE(SURF, SURF_HessianThreshold, SURF_Octaves, SURF_OctaveLayers, SURF_Extended, SURF_Upright)
|
IMPLEMENT_PARAM_CLASS(HessianThreshold, double)
|
||||||
|
IMPLEMENT_PARAM_CLASS(Octaves, int)
|
||||||
|
IMPLEMENT_PARAM_CLASS(OctaveLayers, int)
|
||||||
|
IMPLEMENT_PARAM_CLASS(Extended, bool)
|
||||||
|
IMPLEMENT_PARAM_CLASS(Upright, bool)
|
||||||
|
|
||||||
|
PARAM_TEST_CASE(SURF, HessianThreshold, Octaves, OctaveLayers, Extended, Upright)
|
||||||
{
|
{
|
||||||
double hessianThreshold;
|
double hessianThreshold;
|
||||||
int nOctaves;
|
int nOctaves;
|
||||||
@ -138,16 +143,17 @@ PARAM_TEST_CASE(SURF, SURF_HessianThreshold, SURF_Octaves, SURF_OctaveLayers, SU
|
|||||||
|
|
||||||
virtual void SetUp()
|
virtual void SetUp()
|
||||||
{
|
{
|
||||||
hessianThreshold = GET_PARAM(0);
|
hessianThreshold = get<0>(GetParam());
|
||||||
nOctaves = GET_PARAM(1);
|
nOctaves = get<1>(GetParam());
|
||||||
nOctaveLayers = GET_PARAM(2);
|
nOctaveLayers = get<2>(GetParam());
|
||||||
extended = GET_PARAM(3);
|
extended = get<3>(GetParam());
|
||||||
upright = GET_PARAM(4);
|
upright = get<4>(GetParam());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(SURF, Detector)
|
TEST_P(SURF, Detector)
|
||||||
{
|
{
|
||||||
cv::Mat image = readImage(workdir + "fruits.jpg", cv::IMREAD_GRAYSCALE);
|
cv::Mat image = cv::imread(string(cvtest::TS::ptr()->get_data_path()) + "shared/fruits.png", cv::IMREAD_GRAYSCALE);
|
||||||
ASSERT_FALSE(image.empty());
|
ASSERT_FALSE(image.empty());
|
||||||
|
|
||||||
cv::ocl::SURF_OCL surf;
|
cv::ocl::SURF_OCL surf;
|
||||||
@ -180,7 +186,7 @@ TEST_P(SURF, Detector)
|
|||||||
|
|
||||||
TEST_P(SURF, Descriptor)
|
TEST_P(SURF, Descriptor)
|
||||||
{
|
{
|
||||||
cv::Mat image = readImage(workdir + "fruits.jpg", cv::IMREAD_GRAYSCALE);
|
cv::Mat image = cv::imread(string(cvtest::TS::ptr()->get_data_path()) + "shared/fruits.png", cv::IMREAD_GRAYSCALE);
|
||||||
ASSERT_FALSE(image.empty());
|
ASSERT_FALSE(image.empty());
|
||||||
|
|
||||||
cv::ocl::SURF_OCL surf;
|
cv::ocl::SURF_OCL surf;
|
||||||
@ -218,10 +224,10 @@ TEST_P(SURF, Descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(OCL_Features2D, SURF, testing::Combine(
|
INSTANTIATE_TEST_CASE_P(OCL_Features2D, SURF, testing::Combine(
|
||||||
testing::Values(/*SURF_HessianThreshold(100.0), */SURF_HessianThreshold(500.0), SURF_HessianThreshold(1000.0)),
|
testing::Values(HessianThreshold(500.0), HessianThreshold(1000.0)),
|
||||||
testing::Values(SURF_Octaves(3), SURF_Octaves(4)),
|
testing::Values(Octaves(3), Octaves(4)),
|
||||||
testing::Values(SURF_OctaveLayers(2), SURF_OctaveLayers(3)),
|
testing::Values(OctaveLayers(2), OctaveLayers(3)),
|
||||||
testing::Values(SURF_Extended(false), SURF_Extended(true)),
|
testing::Values(Extended(false), Extended(true)),
|
||||||
testing::Values(SURF_Upright(false), SURF_Upright(true))));
|
testing::Values(Upright(false), Upright(true))));
|
||||||
|
|
||||||
#endif
|
#endif // HAVE_OPENCV_OCL
|
@ -331,7 +331,6 @@ namespace cv
|
|||||||
size_t widthInBytes, size_t height, DevMemRW rw_type, DevMemType mem_type)
|
size_t widthInBytes, size_t height, DevMemRW rw_type, DevMemType mem_type)
|
||||||
{
|
{
|
||||||
cl_int status;
|
cl_int status;
|
||||||
|
|
||||||
*dev_ptr = clCreateBuffer(clCxt->impl->clContext, gDevMemRWValueMap[rw_type]|gDevMemTypeValueMap[mem_type],
|
*dev_ptr = clCreateBuffer(clCxt->impl->clContext, gDevMemRWValueMap[rw_type]|gDevMemTypeValueMap[mem_type],
|
||||||
widthInBytes * height, 0, &status);
|
widthInBytes * height, 0, &status);
|
||||||
openCLVerifyCall(status);
|
openCLVerifyCall(status);
|
||||||
|
@ -68,9 +68,7 @@
|
|||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
#include "opencv2/video/video.hpp"
|
#include "opencv2/video/video.hpp"
|
||||||
#include "opencv2/ts/ts.hpp"
|
#include "opencv2/ts/ts.hpp"
|
||||||
#include "opencv2/ts/ts_perf.hpp"
|
|
||||||
#include "opencv2/ocl/ocl.hpp"
|
#include "opencv2/ocl/ocl.hpp"
|
||||||
#include "opencv2/nonfree/nonfree.hpp"
|
|
||||||
|
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
#include "interpolation.hpp"
|
#include "interpolation.hpp"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user