Ocean
Loading...
Searching...
No Matches
TestRANSAC.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_TESTGEOMETRY_TEST_RANSAC_H
9#define META_OCEAN_TEST_TESTGEOMETRY_TEST_RANSAC_H
10
12
14
16
17namespace Ocean
18{
19
20namespace Test
21{
22
23namespace TestGeometry
24{
25
26/**
27 * This class implements the tests for RANSAC functions.
28 * @ingroup testgeometry
29 */
30class OCEAN_TEST_GEOMETRY_EXPORT TestRANSAC
31{
32 protected:
33
34 /**
35 * Definition of individual camera distortion types.
36 */
37 enum DistortionType : uint32_t
38 {
39 /// No distortion.
40 DT_NO_DISTORTION = 0u,
41 /// The camera has radial distortion.
42 DT_RADIAL_DISTORTION = 1u << 0u | DT_NO_DISTORTION,
43 /// The camera has full distortion (e.g., radial and tangential).
44 DT_FULL_DISTORTION = (1u << 1u) | DT_RADIAL_DISTORTION
45 };
46
47 public:
48
49 /**
50 * Invokes all RANSAC tests.
51 * @param testDuration Number of seconds for each test, with range (0, infinity)
52 * @param worker Optional worker object
53 * @param selector The test selector
54 * @return True, if the entire function test has succeeded
55 */
56 static bool test(const double testDuration, Worker& worker, const TestSelector& selector);
57
58 /**
59 * Tests the iterations function.
60 * @param testDuration Number of seconds for each test, with range (0, infinity)
61 * @return True, if succeeded
62 */
63 static bool testIterations(const double testDuration);
64
65 /**
66 * Tests the perspective pose function p3p for mono cameras.
67 * @param testDuration Number of seconds for each test, with range (0, infinity)
68 * @return True, if succeeded
69 */
70 static bool testP3P(const double testDuration);
71
72 /**
73 * Tests the perspective pose function p3p for mono cameras.
74 * @param anyCameraType The camera type to be tested
75 * @param correspondences The number of correspondences to use, with range [4, infinity)
76 * @param faultyRate The rate of invalid correspondences, with range [0, 1)
77 * @param testDuration Number of seconds for each test, with range (0, infinity)
78 * @return True, if succeeded
79 */
80 static bool testP3P(const AnyCameraType anyCameraType, const size_t correspondences, const double faultyRate, const double testDuration);
81
82 /**
83 * Tests the RANSAC implementation of the perspective pose problem for three random points including unknown zoom factor.
84 * @param testDuration Number of seconds for each test, with range (0, infinity)
85 * @return True, if succeeded
86 */
87 static bool testP3PZoom(const double testDuration);
88
89 /**
90 * Tests the determination of a 6-DOF object transformation with any stereo camera.
91 * @param testDuration Number of seconds for each test, with range (0, infinity)
92 * @return True, if succeeded
93 */
94 static bool testObjectTransformationStereoAnyCamera(const double testDuration);
95
96 /**
97 * Tests the RANSAC-based function determining the homography matrix.
98 * @param testDuration Number of seconds for each test, with range (0, infinity)
99 * @param worker The worker object to distribute the computation
100 * @return True, if succeeded
101 */
102 static bool testHomographyMatrix(const double testDuration, Worker& worker);
103
104 /**
105 * Tests the RANSAC-based function determining the homography matrix with a specified number of point correspondences.
106 * @param testDuration Number of seconds for each test, with range (0, infinity)
107 * @param refine True, to apply an successive non-linear optimization step; False, to keep the internal RANSAC result
108 * @param useSVD True, to use the slower SVD approach (i.e., homographyMatrixSVD); False, to use the two-step approach (i.e., homographyMatrixLinear)
109 * @param worker The worker object to distribute the computation
110 * @return True, if succeeded
111 */
112 static bool testHomographyMatrix(const double testDuration, const bool refine, const bool useSVD, Worker& worker);
113
114 /**
115 * Tests the RANSAC-based function determining the homography matrix for non-bijective correspondences.
116 * @param testDuration Number of seconds for each test, with range (0, infinity)
117 * @param worker The worker object to distribute the computation
118 * @return True, if succeeded
119 */
120 static bool testHomographyMatrixForNonBijectiveCorrespondences(const double testDuration, Worker& worker);
121
122 /**
123 * Tests the RANSAC-based function determining the homography matrix with a specified number of non-bijective point correspondences.
124 * @param testDuration Number of seconds for each test, with range (0, infinity)
125 * @param refine True, to apply an successive non-linear optimization step; False, to keep the internal RANSAC result
126 * @param useSVD True, to use the slower SVD approach (i.e., homographyMatrixSVD); False, to use the two-step approach (i.e., homographyMatrixLinear)
127 * @param worker The worker object to distribute the computation
128 * @return True, if succeeded
129 */
130 static bool testHomographyMatrixForNonBijectiveCorrespondences(const double testDuration, const bool refine, const bool useSVD, Worker& worker);
131
132 /**
133 * Tests the calculation of the fundamental matrix.
134 * @param testDuration Number of seconds for each test, with range (0, infinity)
135 * @return True, if succeeded
136 */
137 static bool testFundamentalMatrix(const double testDuration);
138};
139
140}
141
142}
143
144}
145
146#endif // META_OCEAN_TEST_TESTGEOMETRY_TEST_RANSAC_H
This class implements the tests for RANSAC functions.
Definition TestRANSAC.h:31
static bool testP3P(const double testDuration)
Tests the perspective pose function p3p for mono cameras.
static bool testHomographyMatrixForNonBijectiveCorrespondences(const double testDuration, Worker &worker)
Tests the RANSAC-based function determining the homography matrix for non-bijective correspondences.
static bool test(const double testDuration, Worker &worker, const TestSelector &selector)
Invokes all RANSAC tests.
static bool testObjectTransformationStereoAnyCamera(const double testDuration)
Tests the determination of a 6-DOF object transformation with any stereo camera.
static bool testFundamentalMatrix(const double testDuration)
Tests the calculation of the fundamental matrix.
static bool testHomographyMatrixForNonBijectiveCorrespondences(const double testDuration, const bool refine, const bool useSVD, Worker &worker)
Tests the RANSAC-based function determining the homography matrix with a specified number of non-bije...
static bool testHomographyMatrix(const double testDuration, const bool refine, const bool useSVD, Worker &worker)
Tests the RANSAC-based function determining the homography matrix with a specified number of point co...
static bool testIterations(const double testDuration)
Tests the iterations function.
DistortionType
Definition of individual camera distortion types.
Definition TestRANSAC.h:38
static bool testP3PZoom(const double testDuration)
Tests the RANSAC implementation of the perspective pose problem for three random points including unk...
static bool testHomographyMatrix(const double testDuration, Worker &worker)
Tests the RANSAC-based function determining the homography matrix.
static bool testP3P(const AnyCameraType anyCameraType, const size_t correspondences, const double faultyRate, const double testDuration)
Tests the perspective pose function p3p for mono cameras.
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
AnyCameraType
Definition of individual camera types.
Definition AnyCamera.h:112
The namespace covering the entire Ocean framework.
Definition Accessor.h:15