Ocean
TestNonLinearOptimizationObjectPoint.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_NON_LINEAR_OPTIMIZATION_OBJECT_POINT_H
9 #define META_OCEAN_TEST_TESTGEOMETRY_TEST_NON_LINEAR_OPTIMIZATION_OBJECT_POINT_H
10 
12 
15 
16 #include "ocean/math/AnyCamera.h"
18 
19 namespace Ocean
20 {
21 
22 namespace Test
23 {
24 
25 namespace TestGeometry
26 {
27 
28 /**
29  * This class tests the non linear optimization plane implementations.
30  * @ingroup testgeometry
31  */
33 {
34  public:
35 
36  /**
37  * Tests the non linear optimization orientation function.
38  * @param testDuration Number of seconds for each test
39  * @param worker Optional worker object
40  * @return True, if the entire function test has succeeded
41  */
42  static bool test(const double testDuration, Worker* worker);
43 
44  /**
45  * Tests the non linear optimization function for several 3D object points and a pinhole camera.
46  * @param testDuration Number of seconds for each test, with range (0, infinity)
47  * @param worker Optional worker object
48  * @return True, if succeeded
49  */
50  static bool testNonLinearOptimizationObjectPointsPinholeCamera(const double testDuration, Worker* worker);
51 
52  /**
53  * Tests the non linear optimization function for object points with a specific camera and a specified number of random point correspondences.
54  * @param patternCamera The camera profile pattern which will be used for the test
55  * @param poses Number of camera poses
56  * @param numberObjectPoints Number of object point points
57  * @param testDuration Number of seconds for each test, with range (0, infinity)
58  * @param type Estimator type to be used
59  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
60  * @param outliers Number of outliers correspondences
61  * @param worker Optional worker object
62  * @return True, if succeeded
63  */
64  static bool testNonLinearOptimizationObjectPointsPinholeCamera(const PinholeCamera& patternCamera, const unsigned int poses, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0u, Worker* worker = nullptr);
65 
66  /**
67  * Tests the non linear optimization function for one 3D object point and a fisheye camera.
68  * @param testDuration Number of seconds for each test, with range (0, infinity)
69  * @return True, if succeeded
70  */
71  static bool testNonLinearOptimizationObjectPointFisheyeCamera(const double testDuration);
72 
73  /**
74  * Tests the non linear optimization function for one object point with a specific a specific number of random point correspondences.
75  * @param poses Number of camera poses
76  * @param testDuration Number of seconds for each test, with range (0, infinity)
77  * @param type Estimator type to be used
78  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
79  * @param outliers Number of outliers correspondences
80  * @return True, if succeeded
81  */
82  static bool testNonLinearOptimizationObjectPointFisheyeCamera(const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0u);
83 
84  /**
85  * Tests the non linear optimization function for one 3D object point and any camera.
86  * @param testDuration Number of seconds for each test, with range (0, infinity)
87  * @return True, if succeeded
88  */
89  static bool testNonLinearOptimizationObjectPointAnyCamera(const double testDuration);
90 
91  /**
92  * Tests the non linear optimization function for one object point with a specific a specific number of random point correspondences.
93  * @param anyCamera The camera profile to be used, must be valid
94  * @param poses Number of camera poses, with range [2, infinity)
95  * @param testDuration Number of seconds for each test, with range (0, infinity)
96  * @param type Estimator type to be used
97  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
98  * @param outliers Number of outliers correspondences, with range [0, poses - 1]
99  * @return True, if succeeded
100  */
101  static bool testNonLinearOptimizationObjectPointAnyCamera(const AnyCamera& anyCamera, const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0u);
102 
103  /**
104  * Tests the non linear optimization function for one 3D object point and any camera.
105  * @param testDuration Number of seconds for each test, with range (0, infinity)
106  * @return True, if succeeded
107  */
108  static bool testNonLinearOptimizationObjectPointStereoAnyCamera(const double testDuration);
109 
110  /**
111  * Tests the non linear optimization function for one object point with a specific a specific number of random point correspondences.
112  * @param anyCameraA The first camera profile to be used, must be valid
113  * @param anyCameraB The second camera profile to be used, must be valid
114  * @param poses Number of camera poses, with range [2, infinity)
115  * @param testDuration Number of seconds for each test, with range (0, infinity)
116  * @param type Estimator type to be used
117  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
118  * @param outliers Number of outliers correspondences, with range [0, poses - 1]
119  * @return True, if succeeded
120  */
121  static bool testNonLinearOptimizationObjectPointStereoAnyCamera(const AnyCamera& anyCameraA, const AnyCamera& anyCameraB, const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0u);
122 
123  /**
124  * Tests the non linear optimization function for one 3D object point and any cameras.
125  * @param testDuration Number of seconds for each test, with range (0, infinity)
126  * @return True, if succeeded
127  */
128  static bool testNonLinearOptimizationObjectPointAnyCameras(const double testDuration);
129 
130  /**
131  * Tests the non linear optimization function for one object point with a specific a specific number of random point correspondences.
132  * @param poses Number of camera poses, with range [2, infinity)
133  * @param testDuration Number of seconds for each test, with range (0, infinity)
134  * @param type Estimator type to be used
135  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
136  * @param outliers Number of outliers correspondences, with range [0, poses - 1]
137  * @return True, if succeeded
138  */
139  static bool testNonLinearOptimizationObjectPointAnyCameras(const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0u);
140 
141 
142  /**
143  * Tests the non linear optimization function for one 3D object point and a stereo fisheye camera.
144  * @param testDuration Number of seconds for each test, with range (0, infinity)
145  * @return True, if succeeded
146  */
147  static bool testNonLinearOptimizationObjectPointStereoFisheyeCamera(const double testDuration);
148 
149  /**
150  * Tests the non linear optimization function for one object point with a specific a specific number of random point correspondences.
151  * @param poses Number of camera poses
152  * @param testDuration Number of seconds for each test, with range (0, infinity)
153  * @param type Estimator type to be used
154  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
155  * @param outliers Number of outliers correspondences
156  * @return True, if succeeded
157  */
158  static bool testNonLinearOptimizationObjectPointStereoFisheyeCamera(const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0u);
159 
160  /**
161  * Tests the non linear optimization function for one static and one dynamic 6DOF poses and several dynamic 3D object points.
162  * @param testDuration Number of seconds for each test, with range (0, infinity)
163  * @return True, if succeeded
164  */
165  static bool testNonLinearOptimizationOnePoseObjectPoints(const double testDuration);
166 
167  /**
168  * Tests the non linear optimization function for one static and one dynamic camera pose and several dynamic object points.
169  * @param pinholeCamera The pinhole camera to test
170  * @param numberObjectPoints Number of object points
171  * @param testDuration Number of seconds for each test, with range (0, infinity)
172  * @param type Estimator type to be used
173  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
174  * @param outliers Number of outliers correspondences
175  * @param useCovariances True, to create and use perfect covariance matrices
176  * @return True, if succeeded
177  */
178  static bool testNonLinearOptimizationOnePoseObjectPoints(const PinholeCamera& pinholeCamera, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0, const bool useCovariances = false);
179 
180  /**
181  * Tests the non linear optimization function for one static and one dynamic 6DOF poses and several dynamic 3D object points.
182  * @param testDuration Number of seconds for each test, with range (0, infinity)
183  * @return True, if succeeded
184  */
185  static bool testNonLinearOptimizationTwoPosesObjectPoints(const double testDuration);
186 
187  /**
188  * Tests the non linear optimization function for two dynamic camera pose and several dynamic object points.
189  * @param pinholeCamera The pinhole camera to test
190  * @param numberObjectPoints Number of object points
191  * @param testDuration Number of seconds for each test, with range (0, infinity)
192  * @param type Estimator type to be used
193  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points
194  * @param outliers Number of outliers correspondences
195  * @param useCovariances True, to create and use perfect covariance matrices
196  * @return True, if succeeded
197  */
198  static bool testNonLinearOptimizationTwoPosesObjectPoints(const PinholeCamera& pinholeCamera, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation = 0, const unsigned int outliers = 0, const bool useCovariances = false);
199 
200  /**
201  * Tests the non linear optimization function for several 6DOF poses and several 3D object points.
202  * @param testDuration Number of seconds for each test, with range (0, infinity)
203  * @return True, if succeeded
204  */
205  static bool testNonLinearOptimizationPosesObjectPoints(const double testDuration);
206 
207  /**
208  * Tests the non linear optimization function for poses, and object points, and a specified number of random point correspondences.
209  * @param numberPoses The number of camera poses, with range [2, infinity)
210  * @param numberObjectPoints Number of object points, with range [4, infinity)
211  * @param testDuration Number of seconds for each test, with range (0, infinity)
212  * @param type The estimator type to be used
213  * @param noiseStandardDeviation The standard deviation of the Gaussian normal distribution for noised image points, with range [0, infinity)
214  * @param numberOutliers The number of outliers correspondences, with range [0, numberObjectPoints]
215  * @param slowImplementation True, to test the slow implementation; False, to test the fast (highly optimized) implementation
216  * @return True, if succeeded
217  */
218  static bool testNonLinearOptimizationPosesObjectPoints(const unsigned int numberPoses, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar noiseStandardDeviation = Scalar(0), const unsigned int numberOutliers = 0u, const bool slowImplementation = false);
219 
220  /**
221  * Tests the non linear optimization function for several 6DOF poses (with fixed translations) and several 3D object points.
222  * @param testDuration Number of seconds for each test, with range (0, infinity)
223  * @return True, if succeeded
224  */
225  static bool testNonLinearOptimizationOrientationalPosesObjectPoints(const double testDuration);
226 
227  /**
228  * Tests the non linear optimization function for poses (with fixed translations), and object points, and a specified number of random point correspondences.
229  * @param numberPoses The number of camera poses, with range [2, infinity)
230  * @param numberObjectPoints Number of object points, with range [4, infinity)
231  * @param testDuration Number of seconds for each test, with range (0, infinity)
232  * @param type The estimator type to be used
233  * @param noiseStandardDeviation The standard deviation of the Gaussian normal distribution for noised image points, with range [0, infinity)
234  * @param numberOutliers The number of outliers correspondences, with range [0, numberObjectPoints]
235  * @return True, if succeeded
236  */
237  static bool testNonLinearOptimizationOrientationalPosesObjectPoints(const unsigned int numberPoses, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar noiseStandardDeviation = Scalar(0), const unsigned int numberOutliers = 0u);
238 
239  /**
240  * Tests the non linear optimization function for a 3D object point observed in several cameras with rotational motion.
241  * @param testDuration Number of seconds for each test
242  * @return True, if succeeded
243  */
244  static bool testOptimizeObjectPointRotationalPoses(const double testDuration);
245 
246  /**
247  * Tests the non linear optimization function for a 3D object point observed in several cameras with rotational motion with noisy image points optional in combination with a RANSAC algorithm.
248  * @param patternCamera The camera profile pattern which will be used for the test
249  * @param numberObservations Number of observations to be used, with range [1, infinity)
250  * @param testDuration Number of seconds for each test, with range (0, infinity)
251  * @param type Estimator type to be used
252  * @param standardDeviation Optional standard deviation of the Gaussian normal distribution for noised image points, with range [0, infinity)
253  * @param outliers Number of outliers correspondences
254  * @param useRoughObjectPoint True, to use a rough object point as start for the optimization; False, to use a RANSAC approach for a initial object point
255  * @return True, if succeeded
256  */
257  static bool testOptimizeObjectPointRotationalPoses(const PinholeCamera& patternCamera, const unsigned int numberObservations, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation, const unsigned int outliers, const bool useRoughObjectPoint);
258 };
259 
260 }
261 
262 }
263 
264 }
265 
266 #endif // META_OCEAN_TEST_TESTGEOMETRY_TEST_NON_LINEAR_OPTIMIZATION_OBJECT_POINT_H
This class implements the abstract base class for all AnyCamera objects.
Definition: AnyCamera.h:130
EstimatorType
Definition of individual robust estimator types.
Definition: Estimator.h:34
This class implements least square or robust optimization algorithms optimizing the locations of 3D o...
Definition: NonLinearOptimizationObjectPoint.h:32
This class tests the non linear optimization plane implementations.
Definition: TestNonLinearOptimizationObjectPoint.h:33
static bool testNonLinearOptimizationPosesObjectPoints(const double testDuration)
Tests the non linear optimization function for several 6DOF poses and several 3D object points.
static bool testNonLinearOptimizationObjectPointStereoAnyCamera(const double testDuration)
Tests the non linear optimization function for one 3D object point and any camera.
static bool testNonLinearOptimizationObjectPointAnyCamera(const AnyCamera &anyCamera, const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0u)
Tests the non linear optimization function for one object point with a specific a specific number of ...
static bool testOptimizeObjectPointRotationalPoses(const PinholeCamera &patternCamera, const unsigned int numberObservations, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation, const unsigned int outliers, const bool useRoughObjectPoint)
Tests the non linear optimization function for a 3D object point observed in several cameras with rot...
static bool testNonLinearOptimizationObjectPointStereoFisheyeCamera(const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0u)
Tests the non linear optimization function for one object point with a specific a specific number of ...
static bool testNonLinearOptimizationOrientationalPosesObjectPoints(const unsigned int numberPoses, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar noiseStandardDeviation=Scalar(0), const unsigned int numberOutliers=0u)
Tests the non linear optimization function for poses (with fixed translations), and object points,...
static bool test(const double testDuration, Worker *worker)
Tests the non linear optimization orientation function.
static bool testNonLinearOptimizationObjectPointsPinholeCamera(const PinholeCamera &patternCamera, const unsigned int poses, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0u, Worker *worker=nullptr)
Tests the non linear optimization function for object points with a specific camera and a specified n...
static bool testNonLinearOptimizationObjectPointFisheyeCamera(const double testDuration)
Tests the non linear optimization function for one 3D object point and a fisheye camera.
static bool testNonLinearOptimizationObjectPointAnyCamera(const double testDuration)
Tests the non linear optimization function for one 3D object point and any camera.
static bool testOptimizeObjectPointRotationalPoses(const double testDuration)
Tests the non linear optimization function for a 3D object point observed in several cameras with rot...
static bool testNonLinearOptimizationOnePoseObjectPoints(const PinholeCamera &pinholeCamera, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0, const bool useCovariances=false)
Tests the non linear optimization function for one static and one dynamic camera pose and several dyn...
static bool testNonLinearOptimizationPosesObjectPoints(const unsigned int numberPoses, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar noiseStandardDeviation=Scalar(0), const unsigned int numberOutliers=0u, const bool slowImplementation=false)
Tests the non linear optimization function for poses, and object points, and a specified number of ra...
static bool testNonLinearOptimizationObjectPointAnyCameras(const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0u)
Tests the non linear optimization function for one object point with a specific a specific number of ...
static bool testNonLinearOptimizationObjectPointsPinholeCamera(const double testDuration, Worker *worker)
Tests the non linear optimization function for several 3D object points and a pinhole camera.
static bool testNonLinearOptimizationTwoPosesObjectPoints(const double testDuration)
Tests the non linear optimization function for one static and one dynamic 6DOF poses and several dyna...
static bool testNonLinearOptimizationObjectPointFisheyeCamera(const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0u)
Tests the non linear optimization function for one object point with a specific a specific number of ...
static bool testNonLinearOptimizationOnePoseObjectPoints(const double testDuration)
Tests the non linear optimization function for one static and one dynamic 6DOF poses and several dyna...
static bool testNonLinearOptimizationOrientationalPosesObjectPoints(const double testDuration)
Tests the non linear optimization function for several 6DOF poses (with fixed translations) and sever...
static bool testNonLinearOptimizationObjectPointStereoFisheyeCamera(const double testDuration)
Tests the non linear optimization function for one 3D object point and a stereo fisheye camera.
static bool testNonLinearOptimizationObjectPointAnyCameras(const double testDuration)
Tests the non linear optimization function for one 3D object point and any cameras.
static bool testNonLinearOptimizationTwoPosesObjectPoints(const PinholeCamera &pinholeCamera, const unsigned int numberObjectPoints, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0, const bool useCovariances=false)
Tests the non linear optimization function for two dynamic camera pose and several dynamic object poi...
static bool testNonLinearOptimizationObjectPointStereoAnyCamera(const AnyCamera &anyCameraA, const AnyCamera &anyCameraB, const unsigned int poses, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation=0, const unsigned int outliers=0u)
Tests the non linear optimization function for one object point with a specific a specific number of ...
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15