Merge pull request #2527 from apavlenko:ocl_surf_24
This commit is contained in:
@@ -11,4 +11,31 @@ static const char * impls[] = {
|
||||
"plain"
|
||||
};
|
||||
|
||||
CV_PERF_TEST_MAIN_WITH_IMPLS(nonfree, impls, perf::printCudaInfo())
|
||||
#ifdef HAVE_OPENCL
|
||||
#define DUMP_PROPERTY_XML(propertyName, propertyValue) \
|
||||
do { \
|
||||
std::stringstream ssName, ssValue;\
|
||||
ssName << propertyName;\
|
||||
ssValue << propertyValue; \
|
||||
::testing::Test::RecordProperty(ssName.str(), ssValue.str()); \
|
||||
} while (false)
|
||||
|
||||
#define DUMP_MESSAGE_STDOUT(msg) \
|
||||
do { \
|
||||
std::cout << msg << std::endl; \
|
||||
} while (false)
|
||||
|
||||
#include "opencv2/ocl/private/opencl_dumpinfo.hpp"
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::perf::TestBase::setPerformanceStrategy(::perf::PERF_STRATEGY_SIMPLE);
|
||||
#if defined(HAVE_CUDA)
|
||||
CV_PERF_TEST_MAIN_INTERNALS(nonfree, impls, perf::printCudaInfo());
|
||||
#elif defined(HAVE_OPENCL)
|
||||
CV_PERF_TEST_MAIN_INTERNALS(nonfree, impls, dumpOpenCLDevice());
|
||||
#else
|
||||
CV_PERF_TEST_MAIN_INTERNALS(nonfree, impls)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ PERF_TEST_P(surf, detect, testing::Values(SURF_IMAGES))
|
||||
{
|
||||
String filename = getDataPath(GetParam());
|
||||
Mat frame = imread(filename, IMREAD_GRAYSCALE);
|
||||
|
||||
if (frame.empty())
|
||||
FAIL() << "Unable to load source image " << filename;
|
||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
Mat mask;
|
||||
declare.in(frame).time(90);
|
||||
@@ -34,9 +32,7 @@ PERF_TEST_P(surf, extract, testing::Values(SURF_IMAGES))
|
||||
{
|
||||
String filename = getDataPath(GetParam());
|
||||
Mat frame = imread(filename, IMREAD_GRAYSCALE);
|
||||
|
||||
if (frame.empty())
|
||||
FAIL() << "Unable to load source image " << filename;
|
||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
Mat mask;
|
||||
declare.in(frame).time(90);
|
||||
@@ -55,9 +51,7 @@ PERF_TEST_P(surf, full, testing::Values(SURF_IMAGES))
|
||||
{
|
||||
String filename = getDataPath(GetParam());
|
||||
Mat frame = imread(filename, IMREAD_GRAYSCALE);
|
||||
|
||||
if (frame.empty())
|
||||
FAIL() << "Unable to load source image " << filename;
|
||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
Mat mask;
|
||||
declare.in(frame).time(90);
|
||||
|
||||
@@ -121,4 +121,93 @@ PERF_TEST_P(OCL_SURF, DISABLED_without_data_transfer, testing::Values(SURF_IMAGE
|
||||
SANITY_CHECK_NOTHING();
|
||||
}
|
||||
|
||||
|
||||
|
||||
PERF_TEST_P(OCL_SURF, DISABLED_detect, testing::Values(SURF_IMAGES))
|
||||
{
|
||||
String filename = getDataPath(GetParam());
|
||||
Mat frame = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
declare.in(frame);
|
||||
|
||||
Mat mask;
|
||||
vector<KeyPoint> points;
|
||||
Ptr<Feature2D> detector;
|
||||
|
||||
if (getSelectedImpl() == "plain")
|
||||
{
|
||||
detector = new SURF;
|
||||
TEST_CYCLE() detector->operator()(frame, mask, points, noArray());
|
||||
}
|
||||
else if (getSelectedImpl() == "ocl")
|
||||
{
|
||||
detector = new ocl::SURF_OCL;
|
||||
OCL_TEST_CYCLE() detector->operator()(frame, mask, points, noArray());
|
||||
}
|
||||
else CV_TEST_FAIL_NO_IMPL();
|
||||
|
||||
SANITY_CHECK_KEYPOINTS(points, 1e-3);
|
||||
}
|
||||
|
||||
PERF_TEST_P(OCL_SURF, DISABLED_extract, testing::Values(SURF_IMAGES))
|
||||
{
|
||||
String filename = getDataPath(GetParam());
|
||||
Mat frame = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
declare.in(frame);
|
||||
|
||||
Mat mask;
|
||||
Ptr<Feature2D> detector;
|
||||
vector<KeyPoint> points;
|
||||
vector<float> descriptors;
|
||||
|
||||
if (getSelectedImpl() == "plain")
|
||||
{
|
||||
detector = new SURF;
|
||||
detector->operator()(frame, mask, points, noArray());
|
||||
TEST_CYCLE() detector->operator()(frame, mask, points, descriptors, true);
|
||||
}
|
||||
else if (getSelectedImpl() == "ocl")
|
||||
{
|
||||
detector = new ocl::SURF_OCL;
|
||||
detector->operator()(frame, mask, points, noArray());
|
||||
OCL_TEST_CYCLE() detector->operator()(frame, mask, points, descriptors, true);
|
||||
}
|
||||
else CV_TEST_FAIL_NO_IMPL();
|
||||
|
||||
SANITY_CHECK(descriptors, 1e-4);
|
||||
}
|
||||
|
||||
PERF_TEST_P(OCL_SURF, DISABLED_full, testing::Values(SURF_IMAGES))
|
||||
{
|
||||
String filename = getDataPath(GetParam());
|
||||
Mat frame = imread(filename, IMREAD_GRAYSCALE);
|
||||
ASSERT_FALSE(frame.empty()) << "Unable to load source image " << filename;
|
||||
|
||||
declare.in(frame).time(90);
|
||||
|
||||
Mat mask;
|
||||
Ptr<Feature2D> detector;
|
||||
vector<KeyPoint> points;
|
||||
vector<float> descriptors;
|
||||
|
||||
if (getSelectedImpl() == "plain")
|
||||
{
|
||||
detector = new SURF;
|
||||
TEST_CYCLE() detector->operator()(frame, mask, points, descriptors, false);
|
||||
}
|
||||
else if (getSelectedImpl() == "ocl")
|
||||
{
|
||||
detector = new ocl::SURF_OCL;
|
||||
detector->operator()(frame, mask, points, noArray());
|
||||
OCL_TEST_CYCLE() detector->operator()(frame, mask, points, descriptors, false);
|
||||
}
|
||||
else CV_TEST_FAIL_NO_IMPL();
|
||||
|
||||
SANITY_CHECK_KEYPOINTS(points, 1e-3);
|
||||
SANITY_CHECK(descriptors, 1e-4);
|
||||
}
|
||||
|
||||
#endif // HAVE_OPENCV_OCL
|
||||
|
||||
Reference in New Issue
Block a user