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