Ocean
TestAdvancedMotion.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_TESTADVANCED_TEST_ADVANCED_MOTION_H
9 #define META_OCEAN_TEST_TESTCV_TESTADVANCED_TEST_ADVANCED_MOTION_H
10 
12 
14 #include "ocean/base/Worker.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Test
20 {
21 
22 namespace TestCV
23 {
24 
25 namespace TestAdvanced
26 {
27 
28 /**
29  * This class implements tests for AdvancedMotion.
30  * @ingroup testcvadvanced
31  */
32 class OCEAN_TEST_CV_ADVANCED_EXPORT TestAdvancedMotion
33 {
34  public:
35 
36  /**
37  * Invokes all tests for AdvancedMotion.
38  * @param width The width of the test frame in pixel, with range [32, infinity)
39  * @param height The height of the test frame in pixel, with range [32, infinity)
40  * @param testDuration The number of seconds for each test, with range (0, infinity)
41  * @param worker The worker object
42  * @return True, if succeeded
43  */
44  static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
45 
46  /**
47  * Invokes the test of trackPointSubPixelMirroredBorder().
48  * @param width The width of the test frame in pixel, with range [32, infinity)
49  * @param height The height of the test frame in pixel, with range [32, infinity)
50  * @param testDuration The number of seconds for each test, with range (0, infinity)
51  * @param worker The worker object
52  * @return True, if succeeded
53  */
54  static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
55 
56  /**
57  * Invokes the test of trackPointSubPixelMirroredBorder() with specified metric type.
58  * @param width The width of the test frame in pixel, with range [32, infinity)
59  * @param height The height of the test frame in pixel, with range [32, infinity)
60  * @param testDuration The number of seconds for each test, with range (0, infinity)
61  * @param worker The worker object
62  * @return True, if succeeded
63  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
64  */
65  template <typename T>
66  static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
67 
68  /**
69  * Invokes the test of trackPointSubPixelMirroredBorder() with specified metric type and channel number.
70  * @param width The width of the test frame in pixel, with range [32, infinity)
71  * @param height The height of the test frame in pixel, with range [32, infinity)
72  * @param testDuration The number of seconds for each test, with range (0, infinity)
73  * @param worker The worker object
74  * @return True, if succeeded
75  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
76  * @tparam tChannels The number of channels the frame has, with range [1, infinity)
77  */
78  template <typename T, unsigned int tChannels>
79  static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
80 
81  /**
82  * Invokes the test of trackPointSubPixelMirroredBorder() with specified metric type, channel number, and patch size.
83  * @param width The width of the test frame in pixel, with range [32, infinity)
84  * @param height The height of the test frame in pixel, with range [32, infinity)
85  * @param testDuration The number of seconds for each test, with range (0, infinity)
86  * @param worker The worker object
87  * @return True, if succeeded
88  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
89  * @tparam tChannels The number of channels the frame has, with range [1, infinity)
90  * @tparam tPatchSize The size of the image patch to be used, with range [1, infinity), must be odd
91  */
92  template <typename T, unsigned int tChannels, unsigned int tPatchSize>
93  static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
94 
95  /**
96  * Invokes the test of trackPointsSubPixelMirroredBorder().
97  * @param width The width of the test frame in pixel, with range [32, infinity)
98  * @param height The height of the test frame in pixel, with range [32, infinity)
99  * @param testDuration The number of seconds for each test, with range (0, infinity)
100  * @param worker The worker object
101  * @return True, if succeeded
102  */
103  static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
104 
105  /**
106  * Invokes the test of trackPointsSubPixelMirroredBorder() with specified metric type.
107  * @param width The width of the test frame in pixel, with range [32, infinity)
108  * @param height The height of the test frame in pixel, with range [32, infinity)
109  * @param testDuration The number of seconds for each test, with range (0, infinity)
110  * @param worker The worker object
111  * @return True, if succeeded
112  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
113  */
114  template <typename T>
115  static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
116 
117  /**
118  * Invokes the test of trackPointsSubPixelMirroredBorder() with specified metric type and channel number.
119  * @param width The width of the test frame in pixel, with range [32, infinity)
120  * @param height The height of the test frame in pixel, with range [32, infinity)
121  * @param testDuration The number of seconds for each test, with range (0, infinity)
122  * @param worker The worker object
123  * @return True, if succeeded
124  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
125  * @tparam tChannels The number of channels the frame has, with range [1, infinity)
126  */
127  template <typename T, unsigned int tChannels>
128  static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
129 
130  /**
131  * Invokes the test of trackPointsSubPixelMirroredBorder() with specified metric type, channel number, and patch size.
132  * @param width The width of the test frame in pixel, with range [32, infinity)
133  * @param height The height of the test frame in pixel, with range [32, infinity)
134  * @param testDuration The number of seconds for each test, with range (0, infinity)
135  * @param worker The worker object
136  * @return True, if succeeded
137  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
138  * @tparam tChannels The number of channels the frame has, with range [1, infinity)
139  * @tparam tPatchSize The size of the image patch to be used, with range [1, infinity), must be odd
140  */
141  template <typename T, unsigned int tChannels, unsigned int tPatchSize>
142  static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
143 
144  /**
145  * Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder().
146  * @param width The width of the test frame in pixel, with range [32, infinity)
147  * @param height The height of the test frame in pixel, with range [32, infinity)
148  * @param testDuration The number of seconds for each test, with range (0, infinity)
149  * @param worker The worker object
150  * @return True, if succeeded
151  */
152  static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
153 
154  /**
155  * Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder() with specified metric type.
156  * @param width The width of the test frame in pixel, with range [32, infinity)
157  * @param height The height of the test frame in pixel, with range [32, infinity)
158  * @param testDuration The number of seconds for each test, with range (0, infinity)
159  * @param worker The worker object
160  * @return True, if succeeded
161  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
162  */
163  template <typename T>
164  static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
165 
166  /**
167  * Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder() with specified metric type and channel number.
168  * @param width The width of the test frame in pixel, with range [32, infinity)
169  * @param height The height of the test frame in pixel, with range [32, infinity)
170  * @param testDuration The number of seconds for each test, with range (0, infinity)
171  * @param worker The worker object
172  * @return True, if succeeded
173  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
174  * @tparam tChannels The number of channels the frame has, with range [1, infinity)
175  */
176  template <typename T, unsigned int tChannels>
177  static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
178 
179  /**
180  * Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder() with specified metric type, channel number, and patch size.
181  * @param width The width of the test frame in pixel, with range [32, infinity)
182  * @param height The height of the test frame in pixel, with range [32, infinity)
183  * @param testDuration The number of seconds for each test, with range (0, infinity)
184  * @param worker The worker object
185  * @return True, if succeeded
186  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
187  * @tparam tChannels The number of channels the frame has, with range [1, infinity)
188  * @tparam tPatchSize The size of the image patch to be used, with range [1, infinity), must be odd
189  */
190  template <typename T, unsigned int tChannels, unsigned int tPatchSize>
191  static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
192 
193  /**
194  * Invokes the stress test of trackPointsBidirectionalSubPixelMirroredBorder().
195  * @param testDuration The number of seconds for each test, with range (0, infinity)
196  * @param worker The worker object
197  * @return True, if succeeded
198  */
199  static bool stressTestTrackPointsBidirectionalSubPixelMirroredBorder(const double testDuration, Worker& worker);
200 
201  /**
202  * Invokes the stress test of trackPointsBidirectionalSubPixelMirroredBorder().
203  * @param randomGenerator Random number generator to use for test
204  * @param worker The worker object
205  * @return True, if succeeded
206  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
207  */
208  template <typename T>
210 
211  /**
212  * Invokes the stress test of trackPointsBidirectionalSubPixelMirroredBorder().
213  * @param randomGenerator Random number generator to use for test
214  * @param worker The worker object
215  * @return True, if succeeded
216  * @tparam T The data type of the motion class to be tested, either 'AdvancedMotionSSD' or 'AdvancedMotionZeroMeanSSD'
217  * @tparam tPatchSize The size of the image patch to be used, with range [1, infinity), must be odd
218  */
219  template <typename T, unsigned int tPatchSize>
221 
222  protected:
223 
224  /**
225  * Creates a random image which is suitable for patch tracking.
226  * @param frameType The frame type of the resulting image, must be valid
227  * @param randomGenerator The random generator to be used
228  * @return The resulting frame
229  */
230  static Frame createRandomTrackableFrame(const FrameType& frameType, RandomGenerator& randomGenerator);
231 };
232 
233 }
234 
235 }
236 
237 }
238 
239 }
240 
241 #endif // META_OCEAN_TEST_TESTCV_TESTADVANCED_TEST_ADVANCED_MOTION_H
This class implements Ocean's image class.
Definition: Frame.h:1792
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition: Frame.h:30
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements tests for AdvancedMotion.
Definition: TestAdvancedMotion.h:33
static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsSubPixelMirroredBorder() with specified metric type.
static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder() with specified metric type,...
static Frame createRandomTrackableFrame(const FrameType &frameType, RandomGenerator &randomGenerator)
Creates a random image which is suitable for patch tracking.
static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointSubPixelMirroredBorder() with specified metric type.
static bool stressTestTrackPointsBidirectionalSubPixelMirroredBorder(RandomGenerator &randomGenerator, Worker &worker)
Invokes the stress test of trackPointsBidirectionalSubPixelMirroredBorder().
static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder().
static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder() with specified metric type.
static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointSubPixelMirroredBorder() with specified metric type and channel number.
static bool stressTestTrackPointsBidirectionalSubPixelMirroredBorder(const double testDuration, Worker &worker)
Invokes the stress test of trackPointsBidirectionalSubPixelMirroredBorder().
static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointSubPixelMirroredBorder().
static bool stressTestTrackPointsBidirectionalSubPixelMirroredBorder(RandomGenerator &randomGenerator, Worker &worker)
Invokes the stress test of trackPointsBidirectionalSubPixelMirroredBorder().
static bool testTrackPointsBidirectionalSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsBidirectionalSubPixelMirroredBorder() with specified metric type and c...
static bool testTrackPointSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointSubPixelMirroredBorder() with specified metric type,...
static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsSubPixelMirroredBorder().
static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsSubPixelMirroredBorder() with specified metric type,...
static bool testTrackPointsSubPixelMirroredBorder(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes the test of trackPointsSubPixelMirroredBorder() with specified metric type and channel number...
static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Invokes all tests for AdvancedMotion.
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15