Updated docs to 2.4.3
[profile/ivi/opencv.git] / modules / features2d / perf / perf_fast.cpp
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 enum { TYPE_5_8 =FastFeatureDetector::TYPE_5_8, TYPE_7_12 = FastFeatureDetector::TYPE_7_12, TYPE_9_16 = FastFeatureDetector::TYPE_9_16 };
10 CV_ENUM(FastType, TYPE_5_8, TYPE_7_12, TYPE_9_16)
11
12 typedef std::tr1::tuple<String, FastType> File_Type_t;
13 typedef perf::TestBaseWithParam<File_Type_t> fast;
14
15 #define FAST_IMAGES \
16     "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
17     "stitching/a3.png"
18
19 PERF_TEST_P(fast, detect, testing::Combine(
20                             testing::Values(FAST_IMAGES),
21                             testing::ValuesIn(FastType::all())
22                           ))
23 {
24     String filename = getDataPath(get<0>(GetParam()));
25     int type = get<1>(GetParam());
26     Mat frame = imread(filename, IMREAD_GRAYSCALE);
27
28     if (frame.empty())
29         FAIL() << "Unable to load source image " << filename;
30
31     declare.in(frame);
32
33     Ptr<FeatureDetector> fd = Algorithm::create<FeatureDetector>("Feature2D.FASTX");
34     ASSERT_FALSE( fd == 0 );
35     fd->set("threshold", 20);
36     fd->set("nonmaxSuppression", true);
37     fd->set("type", type);
38     vector<KeyPoint> points;
39
40     TEST_CYCLE() fd->detect(frame, points);
41
42     SANITY_CHECK_KEYPOINTS(points);
43 }
44