8 #ifndef META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_HOMOGRAPHY_H
9 #define META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_HOMOGRAPHY_H
43 #ifdef OCEAN_USE_SLOWER_IMPLEMENTATION
53 class HomographyOptimizationProvider;
58 class SimilarityOptimizationProvider;
63 class NormalizedHomographyData;
68 class HomographyCameraData;
73 class CameraHomographiesData;
78 class DistortionCameraHomographiesData;
105 static bool optimizeHomography(
const SquareMatrix3& homography,
const Vector2* imagePointsLeft,
const Vector2* imagePointsRight,
const size_t correspondences,
const unsigned int modelParameters,
SquareMatrix3& optimizedHomography,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
const Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
const Matrix* invertedCovariances =
nullptr,
Scalars* intermediates =
nullptr);
129 template <Estimator::EstimatorType tEstimator>
130 static bool optimizeHomography(
const SquareMatrix3& homography,
const Vector2* imagePointsLeft,
const Vector2* imagePointsRight,
const size_t correspondences,
const unsigned int modelParameters,
SquareMatrix3& optimizedHomography,
const unsigned int iterations = 20u,
const Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
const Matrix* invertedCovariances =
nullptr,
Scalars* intermediates =
nullptr);
151 static bool optimizeSimilarity(
const SquareMatrix3& similarity,
const Vector2* imagePointsLeft,
const Vector2* imagePointsRight,
const size_t correspondences,
SquareMatrix3& optimizedSimilarity,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
const Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
const Matrix* invertedCovariances =
nullptr,
Scalars* intermediates =
nullptr);
171 template <Estimator::EstimatorType tEstimator>
172 static bool optimizeSimilarity(
const SquareMatrix3& similarity,
const Vector2* imagePointsLeft,
const Vector2* imagePointsRight,
const size_t correspondences,
SquareMatrix3& optimizedSimilarity,
const unsigned int iterations = 20u,
const Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
const Matrix* invertedCovariances =
nullptr,
Scalars* intermediates =
nullptr);
174 #ifdef OCEAN_USE_SLOWER_IMPLEMENTATION
190 static bool optimizeHomography(
const SquareMatrix3& homography,
const Vector2* imagePointsLeft,
const Vector2* imagePointsRight,
const size_t correspondences,
SquareMatrix3& optimizedHomography,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
209 static bool optimizeHomography(
const PinholeCamera& pinholeCamera,
const SquareMatrix3& homography,
const Vector2* imagePointsLeft,
const Vector2* imagePointsRight,
const size_t correspondences,
SquareMatrix3& optimizedHomography,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
229 static bool optimizeCameraHomography(
const PinholeCamera& pinholeCamera,
const SquareMatrix3& homography,
const Vector2* imagePointsLeft,
const Vector2* imagePointsRight,
const size_t correspondences,
PinholeCamera& optimizedCamera,
SquareMatrix3& optimizedHomography,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
250 static bool optimizeCameraHomographies(
const PinholeCamera& pinholeCamera,
const SquareMatrices3& homographies,
const ImagePointsPairs& imagePointsPairs,
PinholeCamera& optimizedCamera,
SquareMatrices3& optimizedHomographies,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
271 static bool optimizeDistortionCameraHomographies(
const PinholeCamera& pinholeCamera,
const SquareMatrices3& homographies,
const ImagePointsPairs& imagePointsPairs,
PinholeCamera& optimizedCamera,
SquareMatrices3& optimizedHomographies,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
EstimatorType
Definition of individual robust estimator types.
Definition: Estimator.h:34
@ ET_SQUARE
The standard square error estimator (L2).
Definition: Estimator.h:52
This class implements non linear optimization algorithms for homographies.
Definition: NonLinearOptimizationHomography.h:28
static bool optimizeDistortionCameraHomographies(const PinholeCamera &pinholeCamera, const SquareMatrices3 &homographies, const ImagePointsPairs &imagePointsPairs, PinholeCamera &optimizedCamera, SquareMatrices3 &optimizedHomographies, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr)
Optimizes only the distortion parameters of a camera profile and concurrently a set of homographies w...
static bool optimizeHomography(const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, const unsigned int modelParameters, SquareMatrix3 &optimizedHomography, const unsigned int iterations=20u, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediates=nullptr)
Optimizes the homography defining the transformation between two sets of corresponding image points w...
std::vector< ImagePointsPair > ImagePointsPairs
Definition of a vector holding pairs of corresponding image points.
Definition: NonLinearOptimizationHomography.h:39
static bool optimizeHomography(const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, const unsigned int modelParameters, SquareMatrix3 &optimizedHomography, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediates=nullptr)
Optimizes the homography defining the transformation between two sets of corresponding image points w...
static bool optimizeHomography(const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedHomography, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr)
Optimizes the planar homography defining the transformation between projected 3D plane points in two ...
static bool optimizeSimilarity(const SquareMatrix3 &similarity, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedSimilarity, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediates=nullptr)
Optimizes a similarity transformation defining the transformation between two sets of corresponding i...
static bool optimizeCameraHomographies(const PinholeCamera &pinholeCamera, const SquareMatrices3 &homographies, const ImagePointsPairs &imagePointsPairs, PinholeCamera &optimizedCamera, SquareMatrices3 &optimizedHomographies, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr)
Optimizes the camera profile and concurrently a set of homographies which come with corresponding pai...
static bool optimizeCameraHomography(const PinholeCamera &pinholeCamera, const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, PinholeCamera &optimizedCamera, SquareMatrix3 &optimizedHomography, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr)
TODO seems to be not correct TODO VALIDATE Optimizes the camera profile and the planar homography def...
static bool optimizeHomography(const PinholeCamera &pinholeCamera, const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedHomography, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr)
Optimizes homography defining the transformation between projected 3D plane points in two cameras fra...
static bool optimizeSimilarity(const SquareMatrix3 &similarity, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedSimilarity, const unsigned int iterations=20u, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediates=nullptr)
Optimizes a similarity defining the transformation between two sets of corresponding image points vis...
std::pair< Vectors2, Vectors2 > ImagePointsPair
Definition of a pair holding to sets of corresponding image points.
Definition: NonLinearOptimizationHomography.h:34
This class implements the basic functions for least square or robust optimization algorithms for non ...
Definition: NonLinearOptimization.h:34
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Scalar > Scalars
Definition of a vector holding Scalar objects.
Definition: Math.h:144
std::vector< SquareMatrix3 > SquareMatrices3
Definition of a vector holding SquareMatrix3 objects.
Definition: SquareMatrix3.h:71
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15