Ocean
TestLineDetectorHough.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_LINE_DETECTOR_HOUGH_H
9 #define META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_LINE_DETECTOR_HOUGH_H
10 
12 
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestCV
22 {
23 
24 namespace TestDetector
25 {
26 
27 /**
28  * This class implements houg-transformation-based line detector tests.
29  * @ingroup testcvdetector
30  */
31 class OCEAN_TEST_CV_DETECTOR_EXPORT TestLineDetectorHough
32 {
33  public:
34 
35  /**
36  * Tests the line detector functions.
37  * @param testDuration Number of seconds for each test, with range (0, infinity)
38  * @param worker The worker object
39  * @return True, if succeeded
40  */
41  static bool test(const double testDuration, Worker& worker);
42 
43  /**
44  * Tests the accumulator joining function.
45  * @param width The width of the test frame, with range [7, infinity)
46  * @param height The height of the test frame, with range [7, infinity)
47  * @param worker The worker object
48  * @return True, if succeeded
49  */
50  static bool testAccumulatorJoin(const unsigned int width, const unsigned int height, Worker& worker);
51 
52  /**
53  * Tests the line detector on a random frame without any distinct edges.
54  * @param testDuration Number of seconds for each test, with range (0, infinity)
55  * @param worker The worker object
56  * @return True, if succeeded
57  */
58  static bool testLineDetectorRandomFrame(const double testDuration, Worker& worker);
59 
60  /**
61  * Tests the line detector on an artificial frame with strong edges.
62  * @param width The width of the test frame, with range [7, infinity)
63  * @param height The height of the test frame, with range [7, infinity)
64  * @param testDuration Number of seconds for each test, with range (0, infinity)
65  * @param worker The worker object
66  * @return True, if succeeded
67  */
68  static bool testLineDetectorArtificialFrame(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
69 
70  private:
71 
72  /**
73  * Validates the mirrored smooth function of the accumulator array.
74  * @param original The original buffer which has been filtered
75  * @param smoothAccumulator Filtered buffer to be validated
76  * @param width The width of the accumulator buffer in pixel, with range [3, infinity)
77  * @param height The height of the accumulator buffer in pixel, with range [3, infinity)
78  * @return True, if succeeded
79  */
80  static bool validateSmooth(const unsigned int* original, const unsigned int* smoothAccumulator, const unsigned int width, const unsigned int height);
81 
82  /**
83  * Validates joined accumulator arrays.
84  * @param original The original accumulator objects
85  * @param joined The joined accumulator object
86  * @param accumulators Number of accumulators to be joined
87  * @return True, if succeeded
88  */
89  static bool validateJoin(const CV::Detector::LineDetectorHough::Accumulator* original, const CV::Detector::LineDetectorHough::Accumulator* joined, const unsigned int accumulators);
90 };
91 
92 }
93 
94 }
95 
96 }
97 
98 }
99 
100 #endif // META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_LINE_DETECTOR_HOUGH_H
Vote accumulator array.
Definition: LineDetectorHough.h:173
This class implements houg-transformation-based line detector tests.
Definition: TestLineDetectorHough.h:32
static bool validateSmooth(const unsigned int *original, const unsigned int *smoothAccumulator, const unsigned int width, const unsigned int height)
Validates the mirrored smooth function of the accumulator array.
static bool testAccumulatorJoin(const unsigned int width, const unsigned int height, Worker &worker)
Tests the accumulator joining function.
static bool validateJoin(const CV::Detector::LineDetectorHough::Accumulator *original, const CV::Detector::LineDetectorHough::Accumulator *joined, const unsigned int accumulators)
Validates joined accumulator arrays.
static bool testLineDetectorArtificialFrame(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the line detector on an artificial frame with strong edges.
static bool test(const double testDuration, Worker &worker)
Tests the line detector functions.
static bool testLineDetectorRandomFrame(const double testDuration, Worker &worker)
Tests the line detector on a random frame without any distinct edges.
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