Ocean
TestFrameOperations.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_TEST_FRAME_OPERATIONS_H
9 #define META_OCEAN_TEST_TESTCV_TEST_FRAME_OPERATIONS_H
10 
12 
13 #include "ocean/math/Numeric.h"
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestCV
22 {
23 
24 /**
25  * This class implements a frame operations test.
26  * @ingroup testcv
27  */
28 class OCEAN_TEST_CV_EXPORT TestFrameOperations
29 {
30  public:
31 
32  /**
33  * Tests all frame operation functions.
34  * @param testDuration Number of seconds for each test, with range (0, infinity)
35  * @param worker The worker object to distribute the computation
36  * @return True, if so
37  */
38  static bool test(const double testDuration, Worker& worker);
39 
40  /**
41  * Tests the subtraction of two frames.
42  * @param width The width of the test frame in pixels, with range [1, infinity)
43  * @param height The height of the test frame in pixels, with range [1, infinity)
44  * @param channels The number of frame channels, with range [1, 4]
45  * @param testDuration Number of seconds for each test, with range (0, infinity)
46  * @param worker The worker object to distribute the computation
47  * @return True, if so
48  * @tparam T The data type of the pixel channel values, either 'unsiged char' or 'float'
49  */
50  template <typename T>
51  static bool testSubtraction(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker& worker);
52 
53  protected:
54 
55  /**
56  * Validation of frame subtraction
57  * @param source0 The first source frame, must be valid
58  * @param source1 The second source frame, must be valid
59  * @param target The target frame that will be validated, must be valid
60  * @return True if the validation has been successful, otherwise false
61  * @tparam T Type of the data being validated
62  */
63  template <typename T>
64  static bool validateSubtraction(const Frame& source0, const Frame& source1, const Frame& target);
65 };
66 
67 } // namespace TestCV
68 
69 } // namespace Test
70 
71 } // Ocean
72 
73 #endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_OPERATIONS_H
This class implements Ocean's image class.
Definition: Frame.h:1760
This class implements a frame operations test.
Definition: TestFrameOperations.h:29
static bool testSubtraction(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker &worker)
Tests the subtraction of two frames.
static bool test(const double testDuration, Worker &worker)
Tests all frame operation functions.
static bool validateSubtraction(const Frame &source0, const Frame &source1, const Frame &target)
Validation of frame subtraction.
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