opencv/modules/features2d/perf/opencl/perf_orb.cpp

87 lines
2.1 KiB
C++
Raw Normal View History

2014-08-01 22:11:20 +08:00
#include "../perf_precomp.hpp"
2014-03-14 03:22:41 +08:00
#include "opencv2/ts/ocl_perf.hpp"
#ifdef HAVE_OPENCL
namespace cvtest {
namespace ocl {
typedef ::perf::TestBaseWithParam<std::string> ORBFixture;
#define ORB_IMAGES OCL_PERF_ENUM("cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png", "stitching/a3.png")
OCL_PERF_TEST_P(ORBFixture, ORB_Detect, ORB_IMAGES)
{
string filename = getDataPath(GetParam());
Mat mframe = imread(filename, IMREAD_GRAYSCALE);
if (mframe.empty())
FAIL() << "Unable to load source image " << filename;
UMat frame, mask;
mframe.copyTo(frame);
declare.in(frame);
Ptr<ORB> detector = ORB::create(1500, 1.3f, 1);
2014-03-14 03:22:41 +08:00
vector<KeyPoint> points;
OCL_TEST_CYCLE() detector->detect(frame, points, mask);
2014-03-14 03:22:41 +08:00
2014-03-14 16:59:14 +08:00
std::sort(points.begin(), points.end(), comparators::KeypointGreater());
2014-03-14 03:22:41 +08:00
SANITY_CHECK_KEYPOINTS(points, 1e-5);
}
OCL_PERF_TEST_P(ORBFixture, ORB_Extract, ORB_IMAGES)
{
string filename = getDataPath(GetParam());
Mat mframe = imread(filename, IMREAD_GRAYSCALE);
if (mframe.empty())
FAIL() << "Unable to load source image " << filename;
UMat mask, frame;
mframe.copyTo(frame);
declare.in(frame);
Ptr<ORB> detector = ORB::create(1500, 1.3f, 1);
2014-03-14 03:22:41 +08:00
vector<KeyPoint> points;
detector->detect(frame, points, mask);
2014-03-14 16:59:14 +08:00
std::sort(points.begin(), points.end(), comparators::KeypointGreater());
2014-03-14 03:22:41 +08:00
UMat descriptors;
OCL_TEST_CYCLE() detector->compute(frame, points, descriptors);
2014-03-14 03:22:41 +08:00
SANITY_CHECK(descriptors);
}
OCL_PERF_TEST_P(ORBFixture, ORB_Full, ORB_IMAGES)
{
string filename = getDataPath(GetParam());
Mat mframe = imread(filename, IMREAD_GRAYSCALE);
if (mframe.empty())
FAIL() << "Unable to load source image " << filename;
UMat mask, frame;
mframe.copyTo(frame);
declare.in(frame);
Ptr<ORB> detector = ORB::create(1500, 1.3f, 1);
2014-03-14 03:22:41 +08:00
vector<KeyPoint> points;
UMat descriptors;
OCL_TEST_CYCLE() detector->detectAndCompute(frame, mask, points, descriptors, false);
2014-03-14 03:22:41 +08:00
::perf::sort(points, descriptors);
SANITY_CHECK_KEYPOINTS(points, 1e-5);
SANITY_CHECK(descriptors);
}
} // ocl
} // cvtest
#endif // HAVE_OPENCL