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