Ocean
Loading...
Searching...
No Matches
TestORBDetector.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_TESTDETECTOR_TEST_ORB_DETECTOR_H
9#define META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_ORB_DETECTOR_H
10
12
14
16
17namespace Ocean
18{
19
20namespace Test
21{
22
23namespace TestCV
24{
25
26namespace TestDetector
27{
28
29/**
30 * This class implements a ORB detector test.
31 * @ingroup testcvdetector
32 */
33class OCEAN_TEST_CV_DETECTOR_EXPORT TestORBDetector
34{
35 public:
36
37 /**
38 * Tests all ORB descriptor functions.
39 * @param frame Test frame to be used for feature detection, invalid to use a random image
40 * @param testDuration Number of seconds for each test, with range (0, infinity)
41 * @param worker The worker object
42 * @param selector The test selector to filter tests
43 * @return True, if succeeded
44 */
45 static bool test(const Frame& frame, const double testDuration, Worker& worker, const TestSelector& selector);
46
47 /**
48 * Tests the determination of the orientation of all given features.
49 * @param testDuration Number of seconds for each test, with range (0, infinity)
50 * @param worker The worker object
51 * @param yFrameTest Optional explicit frame to be used for testing, otherwise a random image will be used
52 * @return True, if succeeded
53 */
54 static bool testOrientationDetermination(const double testDuration, Worker& worker, const Frame& yFrameTest = Frame());
55
56 /**
57 * Tests the determination of the descriptor of all given features.
58 * @param testDuration Number of seconds for each test, with range (0, infinity)
59 * @param worker The worker object
60 * @param yFrameTest Optional explicit frame to be used for testing, otherwise a random image will be used
61 * @return True, if succeeded
62 */
63 static bool testDescriptorDetermination(const double testDuration, Worker& worker, const Frame& yFrameTest = Frame());
64
65 /**
66 * Tests the detection and description of reference features.
67 * This test is mainly a stress test.
68 * @param testDuration Number of seconds for each test, with range (0, infinity)
69 * @param worker The worker object
70 * @return True, if succeeded
71 */
72 static bool testDetectReferenceFeaturesAndDetermineDescriptors(const double testDuration, Worker& worker);
73
74 /**
75 * Tests the determination of the hamming distance between two randomized descriptors.
76 * @param testDuration Number of seconds for each test, with range (0, infinity)
77 * @return True, if succeeded
78 */
79 static bool testHammingDistanceDetermination(const double testDuration);
80
81 /**
82 * Tests the matching of randomized descriptors
83 * @param testDuration Number of seconds for each test, with range (0, infinity)
84 * @param worker The worker object
85 * @return True, if succeeded
86 */
87 static bool testDescriptorMatching(const double testDuration, Worker& worker);
88
89 protected:
90
91 /**
92 * Validate the calculation of the orientation.
93 * @param linedIntegralFrame Pointer to the (lined) integral frame of the actual 8 bit frame for which the feature descriptors will be calculated, the integral frame has an extra line with zero pixels on the left and top of the integral frame
94 * @param width The width of the original frame in pixel (not the width of the lined-integral frame), with range [1, infinity)
95 * @param height The height of the original frame in pixel (not the height of the lined-integral frame), with range [1, infinity)
96 * @param features The features to validate
97 * @return The success percentage, with range [0, 1]
98 */
99 static double validateOrientation(const uint32_t* linedIntegralFrame, const unsigned int width, const unsigned int height, CV::Detector::ORBFeatures& features);
100
101 /**
102 * Validate the calculation of the descriptor.
103 * @param linedIntegralFrame Pointer to the (lined) integral frame of the actual 8 bit frame for which the feature descriptors will be calculated, the integral frame has an extra line with zero pixels on the left and top of the integral frame
104 * @param width The width of the original frame in pixel (not the width of the lined-integral frame), with range [1, infinity)
105 * @param height The height of the original frame in pixel (not the height of the lined-integral frame), with range [1, infinity)
106 * @param features The features to validate
107 * @return True, if succeeded
108 */
109 static bool validateDescriptors(const uint32_t* linedIntegralFrame, const unsigned int width, const unsigned int height, CV::Detector::ORBFeatures& features);
110
111 /**
112 * Validate the calculation of the hamming distance.
113 * @param descriptors1 First descriptor to validate
114 * @param descriptors2 Second descriptor to validate
115 * @return True, if succeeded
116 */
117 static bool validateHammingDistance(const std::vector<CV::Detector::ORBDescriptor>& descriptors1, const std::vector<CV::Detector::ORBDescriptor>& descriptors2);
118
119 /**
120 * Validate the descriptor matching.
121 * @param matches Calculated indices of matches to check the validation for
122 * @param checkMatches Pre calculated correct indices of matches
123 * @return True, if succeeded
124 */
125 static bool validateDescriptorMatching(const IndexPairs32& matches, const IndexPairs32& checkMatches);
126};
127
128}
129
130}
131
132}
133
134}
135
136#endif // META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_ORB_DETECTOR_H
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements a ORB detector test.
Definition TestORBDetector.h:34
static bool validateDescriptorMatching(const IndexPairs32 &matches, const IndexPairs32 &checkMatches)
Validate the descriptor matching.
static bool testHammingDistanceDetermination(const double testDuration)
Tests the determination of the hamming distance between two randomized descriptors.
static bool testDetectReferenceFeaturesAndDetermineDescriptors(const double testDuration, Worker &worker)
Tests the detection and description of reference features.
static bool testDescriptorDetermination(const double testDuration, Worker &worker, const Frame &yFrameTest=Frame())
Tests the determination of the descriptor of all given features.
static bool testOrientationDetermination(const double testDuration, Worker &worker, const Frame &yFrameTest=Frame())
Tests the determination of the orientation of all given features.
static bool validateDescriptors(const uint32_t *linedIntegralFrame, const unsigned int width, const unsigned int height, CV::Detector::ORBFeatures &features)
Validate the calculation of the descriptor.
static bool testDescriptorMatching(const double testDuration, Worker &worker)
Tests the matching of randomized descriptors.
static bool validateHammingDistance(const std::vector< CV::Detector::ORBDescriptor > &descriptors1, const std::vector< CV::Detector::ORBDescriptor > &descriptors2)
Validate the calculation of the hamming distance.
static bool test(const Frame &frame, const double testDuration, Worker &worker, const TestSelector &selector)
Tests all ORB descriptor functions.
static double validateOrientation(const uint32_t *linedIntegralFrame, const unsigned int width, const unsigned int height, CV::Detector::ORBFeatures &features)
Validate the calculation of the orientation.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
std::vector< IndexPair32 > IndexPairs32
Definition of a vector holding 32 bit index pairs.
Definition Base.h:144
std::vector< ORBFeature > ORBFeatures
Definition of a vector holding ORB features.
Definition ORBFeature.h:32
The namespace covering the entire Ocean framework.
Definition Accessor.h:15