Home | History | Annotate | Download | only in perf
      1 #include "perf_precomp.hpp"
      2 
      3 using namespace std;
      4 using namespace cv;
      5 using namespace perf;
      6 using std::tr1::make_tuple;
      7 using std::tr1::get;
      8 
      9 typedef perf::TestBaseWithParam<std::string> orb;
     10 
     11 #define ORB_IMAGES \
     12     "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
     13     "stitching/a3.png"
     14 
     15 PERF_TEST_P(orb, detect, testing::Values(ORB_IMAGES))
     16 {
     17     string filename = getDataPath(GetParam());
     18     Mat frame = imread(filename, IMREAD_GRAYSCALE);
     19 
     20     if (frame.empty())
     21         FAIL() << "Unable to load source image " << filename;
     22 
     23     Mat mask;
     24     declare.in(frame);
     25     Ptr<ORB> detector = ORB::create(1500, 1.3f, 1);
     26     vector<KeyPoint> points;
     27 
     28     TEST_CYCLE() detector->detect(frame, points, mask);
     29 
     30     sort(points.begin(), points.end(), comparators::KeypointGreater());
     31     SANITY_CHECK_KEYPOINTS(points, 1e-5);
     32 }
     33 
     34 PERF_TEST_P(orb, extract, testing::Values(ORB_IMAGES))
     35 {
     36     string filename = getDataPath(GetParam());
     37     Mat frame = imread(filename, IMREAD_GRAYSCALE);
     38 
     39     if (frame.empty())
     40         FAIL() << "Unable to load source image " << filename;
     41 
     42     Mat mask;
     43     declare.in(frame);
     44 
     45     Ptr<ORB> detector = ORB::create(1500, 1.3f, 1);
     46     vector<KeyPoint> points;
     47     detector->detect(frame, points, mask);
     48     sort(points.begin(), points.end(), comparators::KeypointGreater());
     49 
     50     Mat descriptors;
     51 
     52     TEST_CYCLE() detector->compute(frame, points, descriptors);
     53 
     54     SANITY_CHECK(descriptors);
     55 }
     56 
     57 PERF_TEST_P(orb, full, testing::Values(ORB_IMAGES))
     58 {
     59     string filename = getDataPath(GetParam());
     60     Mat frame = imread(filename, IMREAD_GRAYSCALE);
     61 
     62     if (frame.empty())
     63         FAIL() << "Unable to load source image " << filename;
     64 
     65     Mat mask;
     66     declare.in(frame);
     67     Ptr<ORB> detector = ORB::create(1500, 1.3f, 1);
     68 
     69     vector<KeyPoint> points;
     70     Mat descriptors;
     71 
     72     TEST_CYCLE() detector->detectAndCompute(frame, mask, points, descriptors, false);
     73 
     74     perf::sort(points, descriptors);
     75     SANITY_CHECK_KEYPOINTS(points, 1e-5);
     76     SANITY_CHECK(descriptors);
     77 }
     78