Ocean
TestFeatureDetectors.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_TEST_TESTCV_TESTOPENCV_TEST_FEATURE_DETECTORS_H
9 #define META_OCEAN_TEST_TESTCV_TESTOPENCV_TEST_FEATURE_DETECTORS_H
10 
12 
13 #include <opencv2/core.hpp>
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestCV
22 {
23 
24 namespace TestOpenCV
25 {
26 
27 /**
28  * This class tests the performance of several OpenCV feature detectors.
29  * @ingroup testcvopencv
30  */
31 class OCEAN_TEST_CV_OPENCV_EXPORT TestFeatureDetectors
32 {
33  public:
34 
35  /**
36  * Tests all functions of relevant feature detectors in OpenCV.
37  * @param frame The image that is used for the test, must be valid
38  * @param testDuration Number of seconds for each test, with range (0, infinity)
39  * @return True, if succeeded
40  */
41  static bool testFeatureDetectors(const cv::Mat& frame, const double testDuration);
42 
43  private:
44 
45  /**
46  * Tests the OpenCV Harris corner detector.
47  * @param testDuration Number of seconds for each test, with range (0, infinity)
48  * @param frame The image that is used for the test, must be valid
49  * @param cornersCount Number of corners to extract (Harris corner threshold is determined internally) (0, infinity)
50  * @return True, if succeeded
51  */
52  static bool testHarrisCornerDetector(const cv::Mat& frame, const double testDuration, size_t cornersCount);
53 
54  /**
55  * Tests the OpenCV FAST feature detector.
56  * @param testDuration Number of seconds for each test, with range (0, infinity)
57  * @param frame The image that is used for the test, must be valid
58  * @param cornersCount Number of keypoints to extract (threshold is determined internally) (0, infinity)
59  * @return True, if succeeded
60  */
61  static bool testFASTFeatureDectector(const cv::Mat& frame, const double testDuration, size_t cornersCount);
62 
63  /**
64  * Tests the OpenCV SURF feature detector.
65  * @param testDuration Number of seconds for each test, with range (0, infinity)
66  * @param frame The image that is used for the test, must be valid
67  * @param cornersCount Number of keypoints to extract (threshold is determined internally) (0, infinity)
68  * @param computeDescriptors In addition to the detection of feature points, also compute their corresponding descriptors (default: true)
69  * @return True, if succeeded
70  */
71  static bool testSURFFeatureDectector(const cv::Mat& frame, const double testDuration, size_t cornersCount, bool computeDescriptors = true);
72 };
73 
74 } // namespace TestOpenCV
75 
76 } // namespace TestCV
77 
78 } // namespace Test
79 
80 } // namespace Ocean
81 
82 #endif // META_OCEAN_TEST_TESTCV_TESTOPENCV_TEST_FEATURE_DETECTORS_H
This class tests the performance of several OpenCV feature detectors.
Definition: TestFeatureDetectors.h:32
static bool testHarrisCornerDetector(const cv::Mat &frame, const double testDuration, size_t cornersCount)
Tests the OpenCV Harris corner detector.
static bool testSURFFeatureDectector(const cv::Mat &frame, const double testDuration, size_t cornersCount, bool computeDescriptors=true)
Tests the OpenCV SURF feature detector.
static bool testFASTFeatureDectector(const cv::Mat &frame, const double testDuration, size_t cornersCount)
Tests the OpenCV FAST feature detector.
static bool testFeatureDetectors(const cv::Mat &frame, const double testDuration)
Tests all functions of relevant feature detectors in OpenCV.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15