Ocean
Loading...
Searching...
No Matches
TestFrameMinMax.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 OCEAN_TEST_TESTCV_TEST_FRAME_MIN_MAX_H
9#define OCEAN_TEST_TESTCV_TEST_FRAME_MIN_MAX_H
10
12
14
15namespace Ocean
16{
17
18/// Forward declaration
19class RandomGenerator;
20
21namespace Test
22{
23
24namespace TestCV
25{
26
27/**
28 * This class implements tests for the FrameMinMax class.
29 * @ingroup testcv
30 */
31class OCEAN_TEST_CV_EXPORT TestFrameMinMax
32{
33 public:
34
35 /**
36 * Starts all test of the FrameMinMax class.
37 * @param width The width of the test image in pixel, with range [1, infinity)
38 * @param height The height of the test image in pixel, with range [1, infinity)
39 * @param testDuration Number of seconds for each test, with range (0, infinity)
40 * @param worker The worker object to distribute the computation
41 * @param selector Test selector for filtering sub-tests; default runs all tests
42 * @return True, if succeeded
43 */
44 static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker, const TestSelector& selector = TestSelector());
45
46 /**
47 * Tests the function determining the minimum value and location.
48 * @param testDuration Number of seconds for each test, with range (0, infinity)
49 * @return True, if succeeded
50 */
51 static bool testDetermineMinValue(const double testDuration);
52
53 /**
54 * Tests the function determining the maximum value and location.
55 * @param testDuration Number of seconds for each test, with range (0, infinity)
56 * @return True, if succeeded
57 */
58 static bool testDetermineMaxValue(const double testDuration);
59
60 /**
61 * Tests the function determining the minimal and maximum pixel value.
62 * @param width The width of the test image in pixel, with range [1, infinity)
63 * @param height The height of the test image in pixel, with range [1, infinity)
64 * @param testDuration Number of seconds for each test, with range (0, infinity)
65 * @param worker The worker object to distribute the computation
66 * @return True, if succeeded
67 */
68 static bool testDetermineMinMaxValues(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
69
70 /**
71 * Tests the function determining the minimal and maximum pixel value.
72 * @param width The width of the test image in pixel, with range [1, infinity)
73 * @param height The height of the test image in pixel, with range [1, infinity)
74 * @param testDuration Number of seconds for each test, with range (0, infinity)
75 * @param worker The worker object to distribute the computation
76 * @return True, if succeeded
77 * @tparam T The data type of each pixel element
78 */
79 template <typename T>
80 static bool testDetermineMinMaxValues(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
81
82 /**
83 * Tests the function to count frame elements that are outside of a specified range of values
84 * @param testDuration Number of seconds for each test, with range (0, infinity)
85 * @return True, if succeeded
86 */
87 static bool testCountElementsOutsideRange(const double testDuration);
88
89 /**
90 * Tests the function determining the minimum value and location.
91 * @param width The width of the test frame in pixel, with range [1, infinity)
92 * @param height The height of the test frame in pixel, with range [1, infinity)
93 * @param paddingElements The number of padding elements at the end of each row, with range [0, infinity)
94 * @return True, if succeeded
95 * @tparam T The data type of each pixel value
96 */
97 template <typename T>
98 static bool testDetermineMinValue(const unsigned int width, const unsigned int height, const unsigned int paddingElements);
99
100 /**
101 * Tests the function determining the minimal and maximum value.
102 * @param width The width of the test frame in pixel, with range [1, infinity)
103 * @param height The height of the test frame in pixel, with range [1, infinity)
104 * @param paddingElements The number of padding elements at the end of each row, with range [0, infinity)
105 * @return True, if succeeded
106 * @tparam T The data type of each pixel value
107 */
108 template <typename T>
109 static bool testDetermineMaxValue(const unsigned int width, const unsigned int height, const unsigned int paddingElements);
110
111 /**
112 * Tests the function counting the elements outside of a specified range of values
113 * @param randomGenerator The random generator to be used
114 * @param width The width of the test frame in pixel, with range [1, infinity)
115 * @param height The height of the test frame in pixel, with range [1, infinity)
116 * @param paddingElements The number of padding elements at the end of each row, with range [0, infinity)
117 * @return True, if succeeded
118 * @tparam T The data type of each pixel value
119 */
120 template <typename T>
121 static bool testCountElementsOutsideRange(RandomGenerator& randomGenerator, const uint32_t width, const uint32_t height, const uint32_t paddingElements);
122
123 protected:
124
125 /**
126 * Validates the minimal and maximal value which has been determined in a given image.
127 * @param frame The frame in which the minimal and maximal values have been determined, must be valid
128 * @param minValues The minimal values to validate, one for each channel, must be valid
129 * @param maxValues The maximal values to validate, one for each channel, must be valid
130 * @return True, if succeeded
131 * @tparam T The data type of each pixel value
132 */
133 template <typename T>
134 static bool validateDetermineMinMaxValues(const Frame& frame, const T* const minValues, const T* const maxValues);
135};
136
137}
138
139}
140
141}
142
143#endif // OCEAN_TEST_TESTCV_TEST_FRAME_MIN_MAX_H
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
This class implements tests for the FrameMinMax class.
Definition TestFrameMinMax.h:32
static bool testCountElementsOutsideRange(const double testDuration)
Tests the function to count frame elements that are outside of a specified range of values.
static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker, const TestSelector &selector=TestSelector())
Starts all test of the FrameMinMax class.
static bool validateDetermineMinMaxValues(const Frame &frame, const T *const minValues, const T *const maxValues)
Validates the minimal and maximal value which has been determined in a given image.
static bool testDetermineMinValue(const unsigned int width, const unsigned int height, const unsigned int paddingElements)
Tests the function determining the minimum value and location.
static bool testDetermineMaxValue(const unsigned int width, const unsigned int height, const unsigned int paddingElements)
Tests the function determining the minimal and maximum value.
static bool testDetermineMaxValue(const double testDuration)
Tests the function determining the maximum value and location.
static bool testDetermineMinMaxValues(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the function determining the minimal and maximum pixel value.
static bool testCountElementsOutsideRange(RandomGenerator &randomGenerator, const uint32_t width, const uint32_t height, const uint32_t paddingElements)
Tests the function counting the elements outside of a specified range of values.
static bool testDetermineMinMaxValues(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the function determining the minimal and maximum pixel value.
static bool testDetermineMinValue(const double testDuration)
Tests the function determining the minimum value and location.
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