Ocean
Ocean::Geometry::NonLinearOptimizationPlane Class Reference

This class implements least square or robust optimization algorithms for 3D planes. More...

Inheritance diagram for Ocean::Geometry::NonLinearOptimizationPlane:

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 optimizePlane (const Plane3 &plane, const ConstIndexedAccessor< Vector3 > &pointAccessor, Plane3 &optimizedPlane, 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 a 3D plane by reducing the distance between 3D object points and their projected plane point. More...
 
static bool optimizeOnePoseOnePlane (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_cameraFirst, const HomogenousMatrix4 &world_T_cameraSecond, const Plane3 &plane, const ConstIndexedAccessor< Vector2 > &imagePointsFirst, const ConstIndexedAccessor< Vector2 > &imagePointsSecond, const bool distortImagePoints, HomogenousMatrix4 &world_T_optimizedCameraSecond, Plane3 &optimizedPlane, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
 Optimizes the orientation of a plane in 3D spaces and the pose of one camera pose. More...
 
static bool optimizeOnePoseOnePlaneIF (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCameraFirst_T_world, const HomogenousMatrix4 &flippedCameraSecond_T_world, const Plane3 &plane, const ConstIndexedAccessor< Vector2 > &imagePointsFirst, const ConstIndexedAccessor< Vector2 > &imagePointsSecond, const bool distortImagePoints, HomogenousMatrix4 &optimizedFlippedCameraSecond_T_world, Plane3 &optimizedPlane, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
 Optimizes the orientation of a plane in 3D spaces and the pose of one camera pose. More...
 
static bool optimizePosesPlane (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vectors2 &imagePointsFirst, const HomogenousMatrices4 &world_T_cameras, const Plane3 &plane, const ImagePointGroups &imagePointGroups, const bool distortImagePoints, HomogenousMatrices4 &world_T_optimizedCameras, Plane3 &optimizedPlane, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
 Optimizes the orientation of a plane in 3D spaces and several camera poses concurrently. More...
 
static bool optimizePosesPlaneIF (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const Vectors2 &imagePointsFirst, const HomogenousMatrices4 &flippedCameras_T_world, const Plane3 &plane, const ImagePointGroups &imagePointGroups, const bool distortImagePoints, HomogenousMatrices4 &optimizedFlippedCameras_T_world, Plane3 &optimizedPlane, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
 Optimizes the orientation of a plane in 3D spaces and several (inverted and flipped) camera poses concurrently. More...
 
static bool optimizePosesPlane (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const HomogenousMatrices4 &world_T_cameras, const ImagePointsPairs &imagePointPairGroups, const Plane3 &plane, const bool distortImagePoints, HomogenousMatrices4 &world_T_optimizedCameras, Plane3 &optimizedPlane, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
 Optimizes the orientation of a plane in 3D spaces and several camera poses concurrently. More...
 
static bool optimizePosesPlaneIF (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const HomogenousMatrices4 &flippedCameras_T_world, const ImagePointsPairs &imagePointPairGroups, const Plane3 &plane, const bool distortImagePoints, HomogenousMatrices4 &optimizedFlippedCameras_T_world, Plane3 &optimizedPlane, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
 Optimizes the orientation of a plane in 3D spaces and several (inverted and flipped) camera poses concurrently. 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 least square or robust optimization algorithms for 3D planes.

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

◆ optimizeOnePoseOnePlane()

bool Ocean::Geometry::NonLinearOptimizationPlane::optimizeOnePoseOnePlane ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 world_T_cameraFirst,
const HomogenousMatrix4 world_T_cameraSecond,
const Plane3 plane,
const ConstIndexedAccessor< Vector2 > &  imagePointsFirst,
const ConstIndexedAccessor< Vector2 > &  imagePointsSecond,
const bool  distortImagePoints,
HomogenousMatrix4 world_T_optimizedCameraSecond,
Plane3 optimizedPlane,
const unsigned int  iterations = 20u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
const bool  onlyFrontObjectPoints = true,
Scalar initialError = nullptr,
Scalar finalError = nullptr 
)
inlinestatic

Optimizes the orientation of a plane in 3D spaces and the pose of one camera pose.

The projected 2D image points of several 3D plane object points are observed in two views.
The second pose will be optimized while the first pose defines the static reference system.
The given poses are equivalent to extrinsic camera matrices and thus define a transformation from the camera coordinate system into the world coordinate system.

Parameters
pinholeCameraThe pinhole camera object that defines the point projection
world_T_cameraFirstFirst camera pose that corresponds to the first image points
world_T_cameraSecondSecond camera pose that corresponds to the second image points
planeInitial plane on that all object points are located
imagePointsFirstThe accessor providing the projected plane object points that are visible in the first camera frame
imagePointsSecondThe accessor providing the projected plane object points that are visible in the second camera frame, one image point for each image point as defined for the first camera frame
distortImagePointsTrue, to apply the distortion parameters of the camera
world_T_optimizedCameraSecondResulting optimized second camera pose providing minimal projection errors
optimizedPlaneOptimized plane that minimizes the projection errors
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)
onlyFrontObjectPointsTrue, to avoid that the optimized 3D position lies behind any camera
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

◆ optimizeOnePoseOnePlaneIF()

static bool Ocean::Geometry::NonLinearOptimizationPlane::optimizeOnePoseOnePlaneIF ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 flippedCameraFirst_T_world,
const HomogenousMatrix4 flippedCameraSecond_T_world,
const Plane3 plane,
const ConstIndexedAccessor< Vector2 > &  imagePointsFirst,
const ConstIndexedAccessor< Vector2 > &  imagePointsSecond,
const bool  distortImagePoints,
HomogenousMatrix4 optimizedFlippedCameraSecond_T_world,
Plane3 optimizedPlane,
const unsigned int  iterations = 20u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
const bool  onlyFrontObjectPoints = true,
Scalar initialError = nullptr,
Scalar finalError = nullptr 
)
static

Optimizes the orientation of a plane in 3D spaces and the pose of one camera pose.

The projected 2D image points of several 3D plane object points are observed in two views.
The second pose will be optimized while the first pose defines the static reference system.
The given poses must be inverted and flipped around the new x axis by 180 degree.

See also
optimizeOnePoseOnePlane().

◆ optimizePlane()

static bool Ocean::Geometry::NonLinearOptimizationPlane::optimizePlane ( const Plane3 plane,
const ConstIndexedAccessor< Vector3 > &  pointAccessor,
Plane3 optimizedPlane,
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 a 3D plane by reducing the distance between 3D object points and their projected plane point.

Parameters
planeThe plane in 3D space that as to be optimized
pointAccessorThe accessor providing the 3D object points that define the 3D plane, at least three points
optimizedPlaneThe resulting optimized 3D plane with reduced (optimized) distance between object points and projected plane points
iterationsThe number of iterations to be applied at most, if no convergence can be reached in the meantime, with range [1, infinity)
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, w.r.t. the defined estimator
finalErrorOptional resulting averaged pixel error for the final optimized parameters, w.r.t. the defined estimator
Returns
True, if succeeded

◆ optimizePosesPlane() [1/2]

bool Ocean::Geometry::NonLinearOptimizationPlane::optimizePosesPlane ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 world_T_camera,
const HomogenousMatrices4 world_T_cameras,
const ImagePointsPairs imagePointPairGroups,
const Plane3 plane,
const bool  distortImagePoints,
HomogenousMatrices4 world_T_optimizedCameras,
Plane3 optimizedPlane,
const unsigned int  iterations = 20u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
const bool  onlyFrontObjectPoints = true,
Scalar initialError = nullptr,
Scalar finalError = nullptr 
)
inlinestatic

Optimizes the orientation of a plane in 3D spaces and several camera poses concurrently.

3D plane object points are observed in several individual camera frames (with individual camera poses).
The first pose defines the static reference system while the remaining poses will be optimized accordingly.
The given poses are equivalent to extrinsic camera matrices and thus define a transformation from the camera coordinate system into the world coordinate system.

Parameters
pinholeCameraThe pinhole camera profile defining the projection
world_T_cameraFirst camera pose of the first frame (corresponding with the first set of image points)
world_T_camerasFurther camera poses, at least 1
imagePointPairGroupsGroups of image pairs, one group for each further camera pose, each pair combines the observation of an plane object point in the first camera frame with the observation of the same object point in the further camera frame
planeInitial plane on that all object points are located
distortImagePointsTrue, to apply the distortion parameters of the camera
world_T_optimizedCamerasResulting optimized camera poses providing minimal projection errors
optimizedPlaneOptimized plane that minimizes the projection errors
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)
onlyFrontObjectPointsTrue, to avoid that the optimized 3D position lies behind any camera
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

◆ optimizePosesPlane() [2/2]

bool Ocean::Geometry::NonLinearOptimizationPlane::optimizePosesPlane ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 world_T_camera,
const Vectors2 imagePointsFirst,
const HomogenousMatrices4 world_T_cameras,
const Plane3 plane,
const ImagePointGroups imagePointGroups,
const bool  distortImagePoints,
HomogenousMatrices4 world_T_optimizedCameras,
Plane3 optimizedPlane,
const unsigned int  iterations = 20u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
const bool  onlyFrontObjectPoints = true,
Scalar initialError = nullptr,
Scalar finalError = nullptr 
)
inlinestatic

Optimizes the orientation of a plane in 3D spaces and several camera poses concurrently.

3D plane object points are observed in several individual camera frames (with individual camera poses).
The first pose defines the static reference system while the remaining poses will be optimized accordingly.
The given poses are equivalent to extrinsic camera matrices and thus define a transformation from the camera coordinate system into the world coordinate system.

Parameters
pinholeCameraThe pinhole camera profile defining the projection
world_T_cameraFirst camera pose of the first frame (corresponding with the first set of image points)
imagePointsFirstThe first set of observations of the plane object points (visible in the first camera frame)
world_T_camerasFurther camera poses, at least 1
planeInitial plane on that all object points are located
imagePointGroupsThe group of observations of the plane object points, one group for each further pose
distortImagePointsTrue, to apply the distortion parameters of the camera
world_T_optimizedCamerasResulting optimized camera poses providing minimal projection errors
optimizedPlaneOptimized plane that minimizes the projection errors
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)
onlyFrontObjectPointsTrue, to avoid that the optimized 3D position lies behind any camera
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

◆ optimizePosesPlaneIF() [1/2]

static bool Ocean::Geometry::NonLinearOptimizationPlane::optimizePosesPlaneIF ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 flippedCamera_T_world,
const HomogenousMatrices4 flippedCameras_T_world,
const ImagePointsPairs imagePointPairGroups,
const Plane3 plane,
const bool  distortImagePoints,
HomogenousMatrices4 optimizedFlippedCameras_T_world,
Plane3 optimizedPlane,
const unsigned int  iterations = 20u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
const bool  onlyFrontObjectPoints = true,
Scalar initialError = nullptr,
Scalar finalError = nullptr 
)
static

Optimizes the orientation of a plane in 3D spaces and several (inverted and flipped) camera poses concurrently.

3D plane object points are observed in several individual camera frames (with individual camera poses).
The first pose defines the static reference system while the remaining poses will be optimized accordingly.
The given poses must be inverted and flipped around the new x axis by 180 degree.

See also
optimizePosesPlaneIF().

◆ optimizePosesPlaneIF() [2/2]

static bool Ocean::Geometry::NonLinearOptimizationPlane::optimizePosesPlaneIF ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 flippedCamera_T_world,
const Vectors2 imagePointsFirst,
const HomogenousMatrices4 flippedCameras_T_world,
const Plane3 plane,
const ImagePointGroups imagePointGroups,
const bool  distortImagePoints,
HomogenousMatrices4 optimizedFlippedCameras_T_world,
Plane3 optimizedPlane,
const unsigned int  iterations = 20u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
const bool  onlyFrontObjectPoints = true,
Scalar initialError = nullptr,
Scalar finalError = nullptr 
)
static

Optimizes the orientation of a plane in 3D spaces and several (inverted and flipped) camera poses concurrently.

3D plane object points are observed in several individual camera frames (with individual camera poses).
The first pose defines the static reference system while the remaining poses will be optimized accordingly.
The given poses must be inverted and flipped around the new x axis by 180 degree.

See also
minimizePosesPlane().

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