Ocean
Ocean::Geometry::NonLinearOptimizationTransformation Class Reference

This class implements non linear optimization algorithms for coordinate transformations. More...

Inheritance diagram for Ocean::Geometry::NonLinearOptimizationTransformation:

Static Public Member Functions

static bool optimizeObjectTransformation (const AnyCamera &camera, const HomogenousMatrices4 &world_T_cameras, const HomogenousMatrix4 &world_T_object, const ObjectPointGroups &objectPointGroups, const ImagePointGroups &imagePointGroups, HomogenousMatrix4 &optimized_world_T_object, 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, Scalars *intermediateErrors=nullptr)
 Minimizes the projection error for several 3D object points projected into several camera images via a 6-DOF object transformation (to be optimized). More...
 
static bool optimizeObjectTransformationIF (const AnyCamera &camera, const HomogenousMatrices4 &flippedCameras_T_world, const HomogenousMatrix4 &world_T_object, const ObjectPointGroups &objectPointGroups, const ImagePointGroups &imagePointGroups, HomogenousMatrix4 &optimized_world_T_object, 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, Scalars *intermediateErrors=nullptr)
 Minimizes the projection error for several 3D object points projected into several camera images via a 6-DOF object transformation (to be optimized). More...
 
static bool optimizeObjectTransformationStereo (const AnyCamera &cameraA, const AnyCamera &cameraB, const HomogenousMatrices4 &world_T_camerasA, const HomogenousMatrices4 &world_T_camerasB, const HomogenousMatrix4 &world_T_object, const ObjectPointGroups &objectPointGroupsA, const ObjectPointGroups &objectPointGroupsB, const ImagePointGroups &imagePointGroupsA, const ImagePointGroups &imagePointGroupsB, HomogenousMatrix4 &optimized_world_T_object, 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, Scalars *intermediateErrors=nullptr)
 Minimizes the projection error for several 3D object points projected into several stereo camera images via a 6-DOF object transformation (to be optimized). More...
 
static bool optimizeObjectTransformationStereoIF (const AnyCamera &cameraA, const AnyCamera &cameraB, const HomogenousMatrices4 &flippedCamerasA_T_world, const HomogenousMatrices4 &flippedCamerasB_T_world, const HomogenousMatrix4 &world_T_object, const ObjectPointGroups &objectPointGroupsA, const ObjectPointGroups &objectPointGroupsB, const ImagePointGroups &imagePointGroupsA, const ImagePointGroups &imagePointGroupsB, HomogenousMatrix4 &optimized_world_T_object, 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, Scalars *intermediateErrors=nullptr)
 Minimizes the projection error for several 3D object points projected into several stereo camera images via a 6-DOF object transformation (to be optimized). 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 coordinate transformations.

Member Function Documentation

◆ optimizeObjectTransformation()

bool Ocean::Geometry::NonLinearOptimizationTransformation::optimizeObjectTransformation ( const AnyCamera camera,
const HomogenousMatrices4 world_T_cameras,
const HomogenousMatrix4 world_T_object,
const ObjectPointGroups objectPointGroups,
const ImagePointGroups imagePointGroups,
HomogenousMatrix4 optimized_world_T_object,
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,
Scalars intermediateErrors = nullptr 
)
inlinestatic

Minimizes the projection error for several 3D object points projected into several camera images via a 6-DOF object transformation (to be optimized).

The individual camera poses and the camera profile will not be adjusted.
The entire projection pipeline has the following equation:

q = K * (world_T_camera)^-1 * world_T_object * X

With:
q               Projected 2D image point
K               Static camera projection matrix
world_T_camera  Static 6-DOF camera pose transforming points from world coordinate system to camera coordinate system
world_T_object  6-DOF object transformation for which the projection error will be minimized, transforming points in the object coordinate system to points in the world coordinate system
X               3D object point, defined in the object coordinate system
Parameters
cameraThe camera profile defining the projection between 3D object points and 2D image points, must be valid
world_T_camerasSeveral 6-DOF camera pose which will not be adjusted, transforming points from the world coordinate system to points in the camera coordinate systems, (world_T_camera), one pose for each group of 2D image points
world_T_objectThe 6-DOF object transformation to be optimized, with orthonormal rotation matrix, must be valid
objectPointGroupsThe groups of 3D object points to be projected into the camera image, one group for each camera pose, one 3D object point for each 2D image point visible in each camera frame
imagePointGroupsThe groups of 2D image points, one group for each camera pose, each image point has a corresponding 3D object point
optimized_world_T_objectThe resulting optimized 6-DOF object point transformation
iterationsNumber of iterations to be applied at most, if no convergence can be reached, with range [1, infinity)
estimatorThe robust 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
intermediateErrorsOptional resulting averaged pixel errors for each intermediate optimization step, in relation to the defined estimator
Returns
True, if the optimization succeeded
See also
optimizeObjectTransformationIF(), optimizeObjectTransformationStereo().

◆ optimizeObjectTransformationIF()

static bool Ocean::Geometry::NonLinearOptimizationTransformation::optimizeObjectTransformationIF ( const AnyCamera camera,
const HomogenousMatrices4 flippedCameras_T_world,
const HomogenousMatrix4 world_T_object,
const ObjectPointGroups objectPointGroups,
const ImagePointGroups imagePointGroups,
HomogenousMatrix4 optimized_world_T_object,
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,
Scalars intermediateErrors = nullptr 
)
static

Minimizes the projection error for several 3D object points projected into several camera images via a 6-DOF object transformation (to be optimized).

This function applies the same optimization as optimizeObjectTransformation() while uses 6-DOF camera poses with inverted and flipped coordinate system.

See also
optimizeObjectTransformation(), optimizeObjectTransformationStereoIF().

◆ optimizeObjectTransformationStereo()

bool Ocean::Geometry::NonLinearOptimizationTransformation::optimizeObjectTransformationStereo ( const AnyCamera cameraA,
const AnyCamera cameraB,
const HomogenousMatrices4 world_T_camerasA,
const HomogenousMatrices4 world_T_camerasB,
const HomogenousMatrix4 world_T_object,
const ObjectPointGroups objectPointGroupsA,
const ObjectPointGroups objectPointGroupsB,
const ImagePointGroups imagePointGroupsA,
const ImagePointGroups imagePointGroupsB,
HomogenousMatrix4 optimized_world_T_object,
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,
Scalars intermediateErrors = nullptr 
)
inlinestatic

Minimizes the projection error for several 3D object points projected into several stereo camera images via a 6-DOF object transformation (to be optimized).

The individual camera poses and the camera profile will not be adjusted.

Parameters
cameraAFirst camera profile defining the project for the first stereo camera, must be valid
cameraBSecond camera profile defining the project for the second stereo camera, must be valid
world_T_camerasASeveral 6-DOF camera pose connected with the first camera profile which will not be adjusted, transforming points from the world coordinate system to points in the camera coordinate systems, (world_T_camera), one pose for each group of 2D image points
world_T_camerasBSeveral 6-DOF camera pose connected with the second camera profile which will not be adjusted, transforming points from the world coordinate system to points in the camera coordinate systems, (world_T_camera), one pose for each group of 2D image points
world_T_objectThe 6-DOF object transformation to be optimized, with orthonormal rotation matrix, must be valid
objectPointGroupsAThe groups of 3D object points to be projected into the camera image with first camera profile, one group for each camera pose, one 3D object point for each 2D image point visible in each camera frame
objectPointGroupsBThe groups of 3D object points to be projected into the camera image with second camera profile, one group for each camera pose, one 3D object point for each 2D image point visible in each camera frame
imagePointGroupsAThe groups of 2D image points, one group for each camera pose with first camera profile, each image point has a corresponding 3D object point
imagePointGroupsBThe groups of 2D image points, one group for each camera pose with second camera profile, each image point has a corresponding 3D object point
optimized_world_T_objectThe resulting optimized 6-DOF object point transformation
iterationsNumber of iterations to be applied at most, if no convergence can be reached, with range [1, infinity)
estimatorThe robust 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
intermediateErrorsOptional resulting averaged pixel errors for each intermediate optimization step, in relation to the defined estimator
Returns
True, if the optimization succeeded
See also
optimizeObjectTransformationStereoIF(), optimizeObjectTransformation().

◆ optimizeObjectTransformationStereoIF()

static bool Ocean::Geometry::NonLinearOptimizationTransformation::optimizeObjectTransformationStereoIF ( const AnyCamera cameraA,
const AnyCamera cameraB,
const HomogenousMatrices4 flippedCamerasA_T_world,
const HomogenousMatrices4 flippedCamerasB_T_world,
const HomogenousMatrix4 world_T_object,
const ObjectPointGroups objectPointGroupsA,
const ObjectPointGroups objectPointGroupsB,
const ImagePointGroups imagePointGroupsA,
const ImagePointGroups imagePointGroupsB,
HomogenousMatrix4 optimized_world_T_object,
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,
Scalars intermediateErrors = nullptr 
)
static

Minimizes the projection error for several 3D object points projected into several stereo camera images via a 6-DOF object transformation (to be optimized).

This function applies the same optimization as optimizeObjectTransformation() while uses 6-DOF camera poses with inverted and flipped coordinate system.

See also
optimizeObjectTransformation().

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