Ocean
Loading...
Searching...
No Matches
TestNonLinearOptimizationHomography.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_HOMOGRAPHY_H
9#define META_OCEAN_TEST_TESTGEOMETRY_TEST_NON_LINEAR_OPTIMIZATION_HOMOGRAPHY_H
10
12
14
16
17namespace Ocean
18{
19
20namespace Test
21{
22
23namespace TestGeometry
24{
25
26/**
27 * This class implements the tests of the non linear optimization functions for homography optimization.
28 * @ingroup testgeometry
29 */
30class OCEAN_TEST_GEOMETRY_EXPORT TestNonLinearOptimizationHomography
31{
32 public:
33
34 /**
35 * Tests the non linear optimization function.
36 * @param testDuration Number of seconds for each test, with range (0, infinity)
37 * @param worker Optional worker object
38 * @param selector Selector for sub-tests
39 * @return True, if the entire function test has succeeded
40 */
41 static bool test(const double testDuration, Worker* worker, const TestSelector& selector);
42
43 /**
44 * Tests the non linear optimization function optimizing a homography.
45 * @param testDuration Number of seconds for each test, with range (0, infinity)
46 * @return True, if succeeded
47 */
48 static bool testNonLinearOptimizationHomography(const double testDuration);
49
50 /**
51 * Tests the non linear optimization function optimizing a similarity transformation.
52 * @param testDuration Number of seconds for each test, with range (0, infinity)
53 * @return True, if succeeded
54 */
55 static bool testNonLinearOptimizationSimilarity(const double testDuration);
56
57 /**
58 * Tests the non linear optimizations function optimizing a homography with specified correspondences, estimator type and outliers.
59 * @param correspondences Number of point correspondences
60 * @param modelParameter The number of parameters defining the model (of the homography) to be optimize, with range [8, 9]
61 * @param testDuration Number of seconds for each test, with range (0, infinity)
62 * @param type Estimator type to be used
63 * @param standardDeviation Optional standard deviation of the Gaussian distribution for noised image points
64 * @param outliers Number of outlier correspondences
65 * @param useCovariances True, to use covariances
66 * @return True, if succeeded
67 */
68 static bool testNonLinearOptimizationHomography(const unsigned int correspondences, const unsigned int modelParameter, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation, const unsigned int outliers, const bool useCovariances);
69
70 /**
71 * Tests the non linear optimizations function optimizing a similarity transformation with specified correspondences, estimator type and outliers.
72 * @param correspondences Number of point correspondences
73 * @param testDuration Number of seconds for each test, with range (0, infinity)
74 * @param type Estimator type to be used
75 * @param standardDeviation Optional standard deviation of the Gaussian distribution for noised image points
76 * @param outliers Number of outlier correspondences
77 * @param useCovariances True, to use covariances
78 * @return True, if succeeded
79 */
80 static bool testNonLinearOptimizationSimilarity(const unsigned int correspondences, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation, const unsigned int outliers, const bool useCovariances);
81
82 protected:
83
84 /**
85 * Determines the average pixel error between set of left points transform to the right points.
86 * @param homography The homography that will be checked transforming left points to right points (right = homography * left), must be valid
87 * @param pointsLeft Image points defined in the left camera frame
88 * @param pointsRight Image points defined int he right camerea frame, each point corresponds the one point in the left camera frame
89 * @param maximalSqrDistance Optional resulting maximal square distance between a right image point and the corresponding transformed left image point
90 * @return The average square distance between the right image points and the transformed left image points in pixel, with range [0, infinity)
91 */
92 static Scalar determineHomographyError(const SquareMatrix3& homography, const Vectors2& pointsLeft, const Vectors2& pointsRight, Scalar* maximalSqrDistance = nullptr);
93};
94
95}
96
97}
98
99}
100
101#endif // META_OCEAN_TEST_TESTGEOMETRY_TEST_NON_LINEAR_OPTIMIZATION_HOMOGRAPHY_H
EstimatorType
Definition of individual robust estimator types.
Definition Estimator.h:34
This class implements the tests of the non linear optimization functions for homography optimization.
Definition TestNonLinearOptimizationHomography.h:31
static bool testNonLinearOptimizationSimilarity(const double testDuration)
Tests the non linear optimization function optimizing a similarity transformation.
static bool testNonLinearOptimizationSimilarity(const unsigned int correspondences, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation, const unsigned int outliers, const bool useCovariances)
Tests the non linear optimizations function optimizing a similarity transformation with specified cor...
static bool testNonLinearOptimizationHomography(const double testDuration)
Tests the non linear optimization function optimizing a homography.
static bool test(const double testDuration, Worker *worker, const TestSelector &selector)
Tests the non linear optimization function.
static Scalar determineHomographyError(const SquareMatrix3 &homography, const Vectors2 &pointsLeft, const Vectors2 &pointsRight, Scalar *maximalSqrDistance=nullptr)
Determines the average pixel error between set of left points transform to the right points.
static bool testNonLinearOptimizationHomography(const unsigned int correspondences, const unsigned int modelParameter, const double testDuration, const Geometry::Estimator::EstimatorType type, const Scalar standardDeviation, const unsigned int outliers, const bool useCovariances)
Tests the non linear optimizations function optimizing a homography with specified correspondences,...
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
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition Vector2.h:64
float Scalar
Definition of a scalar type.
Definition Math.h:129
The namespace covering the entire Ocean framework.
Definition Accessor.h:15