perf_fast.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "perf_precomp.hpp"
  2. #include "perf_feature2d.hpp"
  3. namespace opencv_test
  4. {
  5. using namespace perf;
  6. typedef tuple<int, int, bool, string> Fast_Params_t;
  7. typedef perf::TestBaseWithParam<Fast_Params_t> Fast_Params;
  8. PERF_TEST_P(Fast_Params, detect,
  9. testing::Combine(
  10. testing::Values(20,30,100), // threshold
  11. testing::Values(
  12. // (int)FastFeatureDetector::TYPE_5_8,
  13. // (int)FastFeatureDetector::TYPE_7_12,
  14. (int)FastFeatureDetector::TYPE_9_16 // detector_type
  15. ),
  16. testing::Bool(), // nonmaxSuppression
  17. testing::Values("cv/inpaint/orig.png",
  18. "cv/cameracalibration/chess9.png")
  19. ))
  20. {
  21. int threshold_p = get<0>(GetParam());
  22. int type_p = get<1>(GetParam());
  23. bool nonmaxSuppression_p = get<2>(GetParam());
  24. string filename = getDataPath(get<3>(GetParam()));
  25. Mat img = imread(filename, IMREAD_GRAYSCALE);
  26. ASSERT_FALSE(img.empty()) << "Failed to load image: " << filename;
  27. vector<KeyPoint> keypoints;
  28. declare.in(img);
  29. TEST_CYCLE()
  30. {
  31. FAST(img, keypoints, threshold_p, nonmaxSuppression_p, (FastFeatureDetector::DetectorType)type_p);
  32. }
  33. SANITY_CHECK_NOTHING();
  34. }
  35. } // namespace opencv_test