Ocean
Loading...
Searching...
No Matches
TestBullseyeDetectorStereo.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#pragma once
9
11
13
15
17
18namespace Ocean
19{
20
21namespace Test
22{
23
24namespace TestCV
25{
26
27namespace TestDetector
28{
29
30namespace TestBullseyes
31{
32
33/**
34 * This class implements tests for the BullseyeDetectorStereo
35 * @ingroup testcvdetectorbullseyes
36 */
37class OCEAN_TEST_CV_DETECTOR_BULLSEYES_EXPORT TestBullseyeDetectorStereo : protected CV::Detector::Bullseyes::BullseyeDetectorStereo
38{
39 public:
40
41 /**
42 * Helper struct containing a randomized stereo camera setup for testing.
43 */
45 {
46 /// Camera A (left camera)
48
49 /// Camera B (right camera)
51
52 /// Transformation from device to world coordinates
54
55 /// Transformation from camera A to world coordinates
57
58 /// Transformation from camera B to world coordinates
60 };
61
62 /**
63 * Tests the BullseyeDetectorStereo functions.
64 * @param testDuration Number of seconds for each test, with range (0, infinity)
65 * @return True, if succeeded
66 */
67 static bool test(const double testDuration);
68
69 /**
70 * Stress test for BullseyeDetectorStereo::detectBullseyes()
71 * @param testDuration The duration in seconds for which this test will be run, must be > 0.0
72 * @param randomGenerator A random generator that will be used to generate test data
73 * @return True, if succeeded
74 */
75 static bool stressTestDetectBullseyes(const double testDuration, RandomGenerator& randomGenerator);
76
77 /**
78 * Tests the Parameters class.
79 * @param testDuration The duration in seconds for which this test will be run, must be > 0.0
80 * @param randomGenerator A random generator that will be used to generate test data
81 * @return True, if succeeded
82 */
83 static bool testParameters(const double testDuration, RandomGenerator& randomGenerator);
84
85 /**
86 * Tests the invalidMatchingCost() static function.
87 * @return True, if succeeded
88 */
90
91 /**
92 * Tests the Candidate class.
93 * @param testDuration The duration in seconds for which this test will be run, must be > 0.0
94 * @param randomGenerator A random generator that will be used to generate test data
95 * @return True, if succeeded
96 */
97 static bool testCandidate(const double testDuration, RandomGenerator& randomGenerator);
98
99 /**
100 * Tests the triangulateBullseye() static function.
101 * @param testDuration The duration in seconds for which this test will be run, must be > 0.0
102 * @param randomGenerator A random generator that will be used to generate test data
103 * @return True, if succeeded
104 */
105 static bool testTriangulateBullseye(const double testDuration, RandomGenerator& randomGenerator);
106
107 /**
108 * Tests the extractBullseyeCandidates() protected function.
109 * @param testDuration The duration in seconds for which this test will be run, must be > 0.0
110 * @param randomGenerator A random generator that will be used to generate test data
111 * @return True, if succeeded
112 */
113 static bool testExtractBullseyeCandidates(const double testDuration, RandomGenerator& randomGenerator);
114
115 /**
116 * Tests the extractBullseyes() protected function.
117 * @param testDuration The duration in seconds for which this test will be run, must be > 0.0
118 * @param randomGenerator A random generator that will be used to generate test data
119 * @return True, if succeeded
120 */
121 static bool testExtractBullseyes(const double testDuration, RandomGenerator& randomGenerator);
122
123 /**
124 * Tests the computeCostMatrix() protected function.
125 * @param testDuration The duration in seconds for which this test will be run, must be > 0.0
126 * @param randomGenerator A random generator that will be used to generate test data
127 * @return True, if succeeded
128 */
129 static bool testComputeCostMatrix(const double testDuration, RandomGenerator& randomGenerator);
130
131 protected:
132
133 /**
134 * Creates a randomized stereo camera setup for testing.
135 * @param randomGenerator The random generator to use
136 * @return A StereoTestSetup with randomized cameras and poses
137 */
139
140 /**
141 * Creates a random 3D world point that is visible in both cameras of the stereo setup.
142 * @param randomGenerator The random generator to use
143 * @param setup The stereo test setup containing cameras and poses
144 * @param worldPoint The resulting world point (output)
145 * @param imagePointA The projection of the world point in camera A (output)
146 * @param imagePointB The projection of the world point in camera B (output)
147 * @return True if a valid visible point was generated, false otherwise
148 */
149 static bool createRandomVisibleWorldPoint(RandomGenerator& randomGenerator, const StereoTestSetup& setup, Vector3& worldPoint, Vector2& imagePointA, Vector2& imagePointB);
150
151 /**
152 * Creates a bullseye at a given position with random diameter and threshold.
153 * @param randomGenerator The random generator to use
154 * @param position The 2D position for the bullseye
155 * @return A Bullseye at the specified position with random parameters
156 */
158};
159
160} // namespace TestBullseyes
161
162} // namespace TestDetector
163
164} // namespace TestCV
165
166} // namespace Test
167
168} // namespace Ocean
This class implements a stereo detector for bullseye patterns.
Definition BullseyeDetectorStereo.h:41
Definition of a bullseye composed of a location and a radius.
Definition Bullseye.h:32
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
This class implements tests for the BullseyeDetectorStereo.
Definition TestBullseyeDetectorStereo.h:38
static bool createRandomVisibleWorldPoint(RandomGenerator &randomGenerator, const StereoTestSetup &setup, Vector3 &worldPoint, Vector2 &imagePointA, Vector2 &imagePointB)
Creates a random 3D world point that is visible in both cameras of the stereo setup.
static bool testExtractBullseyeCandidates(const double testDuration, RandomGenerator &randomGenerator)
Tests the extractBullseyeCandidates() protected function.
static bool test(const double testDuration)
Tests the BullseyeDetectorStereo functions.
static bool testComputeCostMatrix(const double testDuration, RandomGenerator &randomGenerator)
Tests the computeCostMatrix() protected function.
static StereoTestSetup createRandomStereoSetup(RandomGenerator &randomGenerator)
Creates a randomized stereo camera setup for testing.
static bool testParameters(const double testDuration, RandomGenerator &randomGenerator)
Tests the Parameters class.
static CV::Detector::Bullseyes::Bullseye createRandomBullseyeAtPosition(RandomGenerator &randomGenerator, const Vector2 &position)
Creates a bullseye at a given position with random diameter and threshold.
static bool testExtractBullseyes(const double testDuration, RandomGenerator &randomGenerator)
Tests the extractBullseyes() protected function.
static bool testCandidate(const double testDuration, RandomGenerator &randomGenerator)
Tests the Candidate class.
static bool stressTestDetectBullseyes(const double testDuration, RandomGenerator &randomGenerator)
Stress test for BullseyeDetectorStereo::detectBullseyes()
static bool testTriangulateBullseye(const double testDuration, RandomGenerator &randomGenerator)
Tests the triangulateBullseye() static function.
static bool testInvalidMatchingCost()
Tests the invalidMatchingCost() static function.
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:61
The namespace covering the entire Ocean framework.
Definition Accessor.h:15
Helper struct containing a randomized stereo camera setup for testing.
Definition TestBullseyeDetectorStereo.h:45
HomogenousMatrix4 world_T_cameraB
Transformation from camera B to world coordinates.
Definition TestBullseyeDetectorStereo.h:59
SharedAnyCamera cameraA
Camera A (left camera)
Definition TestBullseyeDetectorStereo.h:47
HomogenousMatrix4 world_T_cameraA
Transformation from camera A to world coordinates.
Definition TestBullseyeDetectorStereo.h:56
SharedAnyCamera cameraB
Camera B (right camera)
Definition TestBullseyeDetectorStereo.h:50
HomogenousMatrix4 world_T_device
Transformation from device to world coordinates.
Definition TestBullseyeDetectorStereo.h:53