perf_fast.cpp 1.18 KB
Newer Older
wester committed
1
#include "perf_precomp.hpp"
a  
Kai Westerkamp committed
2

wester committed
3 4 5 6 7
using namespace std;
using namespace cv;
using namespace perf;
using std::tr1::make_tuple;
using std::tr1::get;
a  
Kai Westerkamp committed
8 9

enum { TYPE_5_8 =FastFeatureDetector::TYPE_5_8, TYPE_7_12 = FastFeatureDetector::TYPE_7_12, TYPE_9_16 = FastFeatureDetector::TYPE_9_16 };
wester committed
10
CV_ENUM(FastType, TYPE_5_8, TYPE_7_12, TYPE_9_16)
a  
Kai Westerkamp committed
11 12

typedef std::tr1::tuple<string, FastType> File_Type_t;
wester committed
13
typedef perf::TestBaseWithParam<File_Type_t> fast;
a  
Kai Westerkamp committed
14 15 16 17 18

#define FAST_IMAGES \
    "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
    "stitching/a3.png"

wester committed
19
PERF_TEST_P(fast, detect, testing::Combine(
a  
Kai Westerkamp committed
20 21 22 23 24 25
                            testing::Values(FAST_IMAGES),
                            FastType::all()
                          ))
{
    string filename = getDataPath(get<0>(GetParam()));
    int type = get<1>(GetParam());
wester committed
26
    Mat frame = imread(filename, IMREAD_GRAYSCALE);
a  
Kai Westerkamp committed
27

wester committed
28
    if (frame.empty())
a  
Kai Westerkamp committed
29 30 31 32 33 34 35 36
        FAIL() << "Unable to load source image " << filename;

    declare.in(frame);

    Ptr<FeatureDetector> fd = FastFeatureDetector::create(20, true, type);
    ASSERT_FALSE( fd.empty() );
    vector<KeyPoint> points;

wester committed
37
    TEST_CYCLE() fd->detect(frame, points);
a  
Kai Westerkamp committed
38 39 40

    SANITY_CHECK_KEYPOINTS(points);
}