Ocean
TestMultipleViewGeometry.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_MULTIPLE_VIEW_GEOMETRY_H
9 #define META_OCEAN_TEST_TESTGEOMETRY_TEST_MULTIPLE_VIEW_GEOMETRY_H
10 
12 
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestGeometry
22 {
23 
24 /**
25  * This class implements an epipolar geometry test.
26  * @ingroup testgeometry
27  */
28 class OCEAN_TEST_GEOMETRY_EXPORT TestMultipleViewGeometry
29 {
30  public:
31 
32  /**
33  * Tests all multiple view geometry functions.
34  * @param testDuration Number of seconds for each test, with range (0, infinity)
35  * @return True, if succeeded
36  */
37  static bool testMultipleViewGeometry(const double testDuration);
38 
39  private:
40 
41  /**
42  * Tests the calculation of the trifocal tensor matrices.
43  * @param addGaussianNoise Gaussian noise will be added
44  * @param testDuration Number of seconds for each test, with range (0, infinity)
45  * @return True, if succeeded
46  */
47  static bool testTrifocalTensorMatrix(bool addGaussianNoise, const double testDuration);
48 
49  /**
50  * Tests the 3-views case of projective reconstruction algorithm.
51  * @param addGaussianNoise Gaussian noise will be added
52  * @param testDuration Number of seconds for each test, with range (0, infinity)
53  * @return True, if succeeded
54  */
55  static bool testProjectiveReconstructionFrom3Views(bool addGaussianNoise, const double testDuration);
56 
57  /**
58  * Tests the multiple views case of projective reconstruction algorithm.
59  * @param views Number of views, with range [3, infinity)
60  * @param addGaussianNoise If set, Gaussian noise is added
61  * @param testDuration Number of seconds for each test, with range (0, infinity)
62  * @return True, if succeeded
63  */
64  static bool testProjectiveReconstruction(const unsigned int views, bool addGaussianNoise, const double testDuration);
65 
66  /**
67  * Tests the multiple views case of projective reconstruction algorithm.
68  * Faulty image point correspondences are used.
69  * @param views Number of views, with range [3, infinity)
70  * @param testDuration Number of seconds for each test, with range (0, infinity)
71  * @return True, if succeeded
72  */
73  static bool testFaultyProjectiveReconstruction(const unsigned int views, const double testDuration);
74 
75  /**
76  * Generate groups of corresponding image points for individual camera poses.
77  * @param pinholeCamera The pinhole camera profile to be used, must be valid
78  * @param points Number of point correspondences, with range [1, infinity)
79  * @param views Number of views, with range [2, infinity)
80  * @param imagePointsPerPose Resulting groups of corresponding image points, one group for each camera pose
81  * @param gaussSigma Additional Gaussian noise will be added [0, infinity), 0 disable noise
82  * @param objectPoints Optional resulting 3d object points
83  * @return True, if succeeded
84  */
85  static bool generatedImagePointGroups(const PinholeCamera& pinholeCamera, const size_t points, const unsigned int views, std::vector<Vectors2>& imagePointsPerPose, Scalar gaussSigma = Scalar(0), Vectors3* objectPoints = nullptr);
86 
87  /**
88  * Evaluates the (squared) re-projection error for given camera intrinsics and camera poses.<br>
89  * Therefore, 3d objects point are determined from camera poses and then projected to image plane.
90  * @param imagePointsPerPose Group of corresponding image points, one group for each camera pose
91  * @param pinholeCamera The pinhole camera profile to be used, must be valid
92  * @param posesIF The camera poses (inverted flipped)
93  * @return The squared re-projection error between image points given and estimated image points.
94  */
95  static Scalar evaluateReprojectionError(const std::vector<Vectors2>& imagePointsPerPose, const PinholeCamera& pinholeCamera, const HomogenousMatrices4& posesIF);
96 };
97 
98 }
99 
100 }
101 
102 }
103 
104 #endif // META_OCEAN_TEST_TESTGEOMETRY_TEST_MULTIPLE_VIEW_GEOMETRY_H
This class implements an epipolar geometry test.
Definition: TestMultipleViewGeometry.h:29
static bool testProjectiveReconstruction(const unsigned int views, bool addGaussianNoise, const double testDuration)
Tests the multiple views case of projective reconstruction algorithm.
static bool testFaultyProjectiveReconstruction(const unsigned int views, const double testDuration)
Tests the multiple views case of projective reconstruction algorithm.
static bool testProjectiveReconstructionFrom3Views(bool addGaussianNoise, const double testDuration)
Tests the 3-views case of projective reconstruction algorithm.
static Scalar evaluateReprojectionError(const std::vector< Vectors2 > &imagePointsPerPose, const PinholeCamera &pinholeCamera, const HomogenousMatrices4 &posesIF)
Evaluates the (squared) re-projection error for given camera intrinsics and camera poses.
static bool testMultipleViewGeometry(const double testDuration)
Tests all multiple view geometry functions.
static bool generatedImagePointGroups(const PinholeCamera &pinholeCamera, const size_t points, const unsigned int views, std::vector< Vectors2 > &imagePointsPerPose, Scalar gaussSigma=Scalar(0), Vectors3 *objectPoints=nullptr)
Generate groups of corresponding image points for individual camera poses.
static bool testTrifocalTensorMatrix(bool addGaussianNoise, const double testDuration)
Tests the calculation of the trifocal tensor matrices.
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< HomogenousMatrix4 > HomogenousMatrices4
Definition of a vector holding HomogenousMatrix4 objects.
Definition: HomogenousMatrix4.h:73
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15