Ocean
Ocean::Geometry::NonLinearOptimizationHomography Class Reference

This class implements non linear optimization algorithms for homographies. More...

Inheritance diagram for Ocean::Geometry::NonLinearOptimizationHomography:

Public Types

typedef std::pair< Vectors2, Vectors2ImagePointsPair
 Definition of a pair holding to sets of corresponding image points. More...
 
typedef std::vector< ImagePointsPairImagePointsPairs
 Definition of a vector holding pairs of corresponding image points. More...
 

Static Public Member Functions

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 which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames. More...
 
template<Estimator::EstimatorType tEstimator>
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 which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames. More...
 
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 image points visible in two individual camera frames. More...
 
template<Estimator::EstimatorType tEstimator>
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 visible in two individual camera frames. More...
 
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 cameras frames. More...
 
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 frames. More...
 
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 defining the transformation between projected 3D plane points in two cameras frames. More...
 
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 pairs of image point correspondences. More...
 
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 which come with corresponding pairs of image point correspondences. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Ocean::Geometry::NonLinearOptimization
template<typename T >
static bool denseOptimization (T &provider, const unsigned int iterations=5u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem. More...
 
template<typename T , Estimator::EstimatorType tEstimator>
static bool denseOptimization (T &provider, const unsigned int iterations=5u, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem. More...
 
template<typename T >
static bool sparseOptimization (T &provider, const unsigned int iterations=5u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem. More...
 
template<typename T , Estimator::EstimatorType tEstimator>
static bool sparseOptimization (T &provider, const unsigned int iterations=5u, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem. More...
 
template<typename T >
static bool advancedDenseOptimization (T &advancedDenseProvider, const unsigned int iterations, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem using an advanced optimization provider. More...
 
template<typename T >
static bool advancedSparseOptimization (T &advancedSparseProvider, const unsigned int iterations, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem using an advanced optimization provider. More...
 
template<Estimator::EstimatorType tEstimator>
static Scalar sqrErrors2robustErrors2 (const Scalars &sqrErrors, const size_t modelParameters, Vector2 *weightedErrors, Vector2 *weightVectors, const SquareMatrix2 *transposedInvertedCovariances)
 Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<Estimator::EstimatorType tEstimator, size_t tDimension>
static Scalar sqrErrors2robustErrors (const Scalars &sqrErrors, const size_t modelParameters, StaticBuffer< Scalar, tDimension > *weightedErrors, StaticBuffer< Scalar, tDimension > *weightVectors, const Matrix *transposedInvertedCovariances)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<Estimator::EstimatorType tEstimator>
static Scalar sqrErrors2robustErrors_i (const Scalars &sqrErrors, const size_t modelParameters, const size_t dimension, Scalar *weightedErrors_i, Scalar *weightVectors_i, const Matrix *transposedInvertedCovariances_i)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
static Scalar sqrErrors2robustErrors2 (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, Vector2 *weightedErrors, Vector2 *weightVectors, const SquareMatrix2 *transposedInvertedCovariances)
 Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<size_t tDimension>
static Scalar sqrErrors2robustErrors (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, StaticBuffer< Scalar, tDimension > *weightedErrors, StaticBuffer< Scalar, tDimension > *weightVectors, const Matrix *transposedInvertedCovariances)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
static Scalar sqrErrors2robustErrors_i (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, const size_t dimension, Scalar *weightedErrors_i, Scalar *weightVectors_i, const Matrix *transposedInvertedCovariances_i)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 

Detailed Description

This class implements non linear optimization algorithms for homographies.

Member Typedef Documentation

◆ ImagePointsPair

Definition of a pair holding to sets of corresponding image points.

◆ ImagePointsPairs

Definition of a vector holding pairs of corresponding image points.

Member Function Documentation

◆ optimizeCameraHomographies()

static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes the camera profile and concurrently a set of homographies which come with corresponding pairs of image point correspondences.

The given homographies transform image points defined in the 'first' camera frame into image points defined in the 'second' camera frame: p_second = H * p_first.
However, as more than one homography can be provided, each individual homography has an individual 'first' and 'second' camera frame.
The given pairs of points correspondences define the points in the 'first' camera frame (pair.first) and the corresponding points in the 'second' camera frame (pair.second).

Parameters
pinholeCameraThe pinhole camera profile that has been used to create the initial homographies
homographiesThe individual homographies each defines a transformation between two camera frames, the number of homographies must match the number of pairs of image point correspondences
imagePointsPairsThe individual pairs of image points correspondences, each paint pair corresponds with one homography
optimizedCameraThe resulting optimized camera profile
optimizedHomographiesThe set of optimized homographies
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorRobust error estimator to be used
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
Returns
True, if succeeded
See also
optimizeDistortionCameraHomographies().

◆ optimizeCameraHomography()

static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

TODO seems to be not correct TODO VALIDATE Optimizes the camera profile and the planar homography defining the transformation between projected 3D plane points in two cameras frames.

Parameters
pinholeCameraThe initial pinhole camera profile
homographyInitial homography that will be optimized
imagePointsLeftProjected 3D plane points visible in the left camera frame
imagePointsRightProjected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame
correspondencesNumber given image correspondences
optimizedCameraOptimized camera profile
optimizedHomographyResulting optimized homography
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorRobust error estimator to be used
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
Returns
True, if succeeded

◆ optimizeDistortionCameraHomographies()

static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes only the distortion parameters of a camera profile and concurrently a set of homographies which come with corresponding pairs of image point correspondences.

The given homographies transform image points defined in the 'first' camera frame into image points defined in the 'second' camera frame: p_second = H * p_first.
However, as more than one homography can be provided, each individual homography has an individual 'first' and 'second' camera frame.
The given pairs of points correspondences define the points in the 'first' camera frame (pair.first) and the corresponding points in the 'second' camera frame (pair.second).

Parameters
pinholeCameraThe pinhole camera profile that has been used to create the initial homographies
homographiesThe individual homographies each defines a transformation between two camera frames, the number of homographies must match the number of pairs of image point correspondences
imagePointsPairsThe individual pairs of image points correspondences, each paint pair corresponds with one homography
optimizedCameraThe resulting optimized camera profile
optimizedHomographiesThe set of optimized homographies
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorRobust error estimator to be used
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
Returns
True, if succeeded
See also
optimizeCameraHomographies().

◆ optimizeHomography() [1/4]

static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes homography defining the transformation between projected 3D plane points in two cameras frames.

Parameters
pinholeCameraThe pinhole camera profile defining the projection, must be valid
homographyInitial homography that will be optimized, rightPoint = homography * leftPoint, must be valid
imagePointsLeftProjected 3D plane points visible in the left camera frame
imagePointsRightProjected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame
correspondencesNumber given image correspondences
optimizedHomographyResulting optimized homography, rightPoint = optimizedHomography * leftPoint
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorRobust error estimator to be used
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
Returns
Result of the optimization

◆ optimizeHomography() [2/4]

static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes the homography defining the transformation between two sets of corresponding image points which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames.

This function can use 8 or 9 parameters to represent the optimization model of the homography.
A homography has 8 degrees of freedom so that 8 model parameters should be the correct choice.
However, due to numerical stability the application of 9 model parameters often provides a more robust/stable solution, especially for image point correspondences with complex distributions/locations. Beware: In case binary size matters, and in case you know which robust estimator to be used for optimizing the homography, please use the corresponding function using a template-parameter for the estimator.

Parameters
homographyInitial homography that will be optimized, rightPoint = homography * leftPoint, must be valid
imagePointsLeftProjected 3D plane points visible in the left camera frame
imagePointsRightProjected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame
correspondencesNumber given image correspondences, with range [4, infinity)
modelParametersThe number of parameters defining the model (of the homography) to be optimize, with range [8, 9]
optimizedHomographyResulting optimized homography, normalized so that the lower right element of the Homography is 1, rightPoint = optimizedHomography * leftPoint
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorThe robust error estimator to be used for calculating the accuracy/error of a homography
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
invertedCovariancesOptional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix)
intermediatesOptional resulting intermediate (improving) errors in relation to the defined estimator
Returns
True, if the homography could be optimized (at least within one iteration)
See also
optimizeHomography<tEstimator>().

◆ optimizeHomography() [3/4]

template<Estimator::EstimatorType tEstimator>
static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes the homography defining the transformation between two sets of corresponding image points which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames.

This function can use 8 or 9 parameters to represent the optimization model of the homography.
A homography has 8 degrees of freedom so that 8 model parameters should be the correct choice.
However, due to numerical stability the application of 9 model parameters often provides a more robust/stable solution, especially for image point correspondences with complex distributions/locations.

Parameters
homographyInitial homography that will be optimized, rightPoint = homography * leftPoint, must be valid
imagePointsLeftProjected 3D plane points visible in the left camera frame
imagePointsRightProjected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame
correspondencesNumber given image correspondences, with range [4, infinity)
modelParametersThe number of parameters defining the model (of the homography) to be optimize, with range [8, 9]
optimizedHomographyResulting optimized homography, normalized so that the lower right element of the Homography is 1, rightPoint = optimizedHomography * leftPoint
iterationsNumber of iterations to be applied at most, if no convergence can be reached
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
invertedCovariancesOptional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix)
intermediatesOptional resulting intermediate (improving) errors in relation to the defined estimator
Returns
True, if the homography could be optimized (at least within one iteration)
Template Parameters
tEstimatorThe robust error estimator to be used for calculating the accuracy/error of a homography
See also
optimizeHomography().

◆ optimizeHomography() [4/4]

static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes the planar homography defining the transformation between projected 3D plane points in two cameras frames.

Parameters
homographyInitial homography that will be optimized, rightPoint = homography * leftPoint, must be valid
imagePointsLeftProjected 3D plane points visible in the left camera frame
imagePointsRightProjected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame
correspondencesNumber given image correspondences
optimizedHomographyResulting optimized homography, rightPoint = optimizedHomography * leftPoint, must be valid
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorRobust error estimator to be used
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
Returns
Result of the optimization

◆ optimizeSimilarity() [1/2]

static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes a similarity transformation defining the transformation between two sets of corresponding image points visible in two individual camera frames.

Beware: In case binary size matters, and in case you know which robust estimator to be used for optimizing the similarity, please use the corresponding function using a template-parameter for the estimator.

Parameters
similarityInitial similarity that will be optimized, rightPoint = similarity * leftPoint, must be valid
imagePointsLeftProjected 3D plane points visible in the left camera frame
imagePointsRightProjected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame
correspondencesNumber given image correspondences, with range [2, infinity)
optimizedSimilarityResulting optimized similarity, rightPoint = optimizedSimilarity * leftPoint
iterationsNumber of iterations to be applied at most, if no convergence can be reached
estimatorThe robust error estimator to be used for calculating the accuracy/error of a similarity
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
invertedCovariancesOptional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix)
intermediatesOptional resulting intermediate (improving) errors in relation to the defined estimator
Returns
True, if the similarity could be optimized (at least within one iteration)
See also
optimizeSimilarity<tEstimator>().

◆ optimizeSimilarity() [2/2]

template<Estimator::EstimatorType tEstimator>
static bool Ocean::Geometry::NonLinearOptimizationHomography::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 
)
static

Optimizes a similarity defining the transformation between two sets of corresponding image points visible in two individual camera frames.

Parameters
similarityInitial similarity that will be optimized, rightPoint = similarity * leftPoint, must be valid
imagePointsLeftProjected 3D plane points visible in the left camera frame
imagePointsRightProjected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame
correspondencesNumber given image correspondences, with range [2, infinity)
optimizedSimilarityResulting optimized similarity, rightPoint = optimizedSimilarity * leftPoint
iterationsNumber of iterations to be applied at most, if no convergence can be reached
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator
invertedCovariancesOptional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix)
intermediatesOptional resulting intermediate (improving) errors in relation to the defined estimator
Returns
True, if the similarity could be optimized (at least within one iteration)
Template Parameters
tEstimatorThe robust error estimator to be used for calculating the accuracy/error of a similarity
See also
optimizeSimilarity().

The documentation for this class was generated from the following file: