8 #ifndef META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_ORIENTATION_H
9 #define META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_ORIENTATION_H
36 class OrientationOptimizationProvider;
41 class CameraOrientationOptimizationProvider;
64 static inline bool optimizeOrientation(
const AnyCamera& camera,
const SquareMatrix3& world_R_camera,
const ConstIndexedAccessor<ObjectPoint>& objectPoints,
const ConstIndexedAccessor<ImagePoint>& imagePoints,
SquareMatrix3& world_R_optimizedCamera,
const unsigned int iterations,
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* intermediateErrors =
nullptr);
85 static bool optimizeOrientationIF(
const AnyCamera& camera,
const SquareMatrix3& flippedCamera_R_world,
const ConstIndexedAccessor<ObjectPoint>& objectPoints,
const ConstIndexedAccessor<ImagePoint>& imagePoints,
SquareMatrix3& optimizedFlippedCamera_R_world,
const unsigned int iterations,
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* intermediateErrors =
nullptr);
108 static inline bool optimizeCameraOrientation(
const PinholeCamera& pinholeCamera,
const SquareMatrix3& world_R_camera,
const ConstIndexedAccessor<ObjectPoint>& objectPoints,
const ConstIndexedAccessor<ImagePoint>& imagePoints,
const bool distortImagePoints,
SquareMatrix3& world_R_optimizedCamera,
PinholeCamera& optimizedCamera,
const unsigned int iterations,
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* intermediateErrors =
nullptr);
131 static bool optimizeCameraOrientationIF(
const PinholeCamera& pinholeCamera,
const SquareMatrix3& flippedCamera_R_world,
const ConstIndexedAccessor<ObjectPoint>& objectPoints,
const ConstIndexedAccessor<ImagePoint>& imagePoints,
const bool distortImagePoints,
SquareMatrix3& optimizedFlippedCamera_R_world,
PinholeCamera& optimizedCamera,
const unsigned int iterations,
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* intermediateErrors =
nullptr);
134 inline bool NonLinearOptimizationOrientation::optimizeOrientation(
const AnyCamera& camera,
const SquareMatrix3& world_R_camera,
const ConstIndexedAccessor<ObjectPoint>& objectPoints,
const ConstIndexedAccessor<ImagePoint>& imagePoints,
SquareMatrix3& world_R_optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
const Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances,
Scalars* intermediateErrors)
136 ocean_assert(objectPoints.
size() >= 3u && objectPoints.
size() >= imagePoints.
size());
141 if (!
optimizeOrientationIF(camera, flippedCamera_R_world, objectPoints, imagePoints, optimizedFlippedCamera_R_world, iterations, estimator, lambda, lambdaFactor, initialError, finalError, invertedCovariances, intermediateErrors))
151 inline bool NonLinearOptimizationOrientation::optimizeCameraOrientation(
const PinholeCamera& pinholeCamera,
const SquareMatrix3& world_R_camera,
const ConstIndexedAccessor<ObjectPoint>& objectPoints,
const ConstIndexedAccessor<ImagePoint>& imagePoints,
const bool distortImagePoints,
SquareMatrix3& world_R_optimizedCamera,
PinholeCamera& optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
const Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances,
Scalars* intermediateErrors)
153 ocean_assert(objectPoints.
size() >= 3u && objectPoints.
size() >= imagePoints.
size());
158 if (!
optimizeCameraOrientationIF(pinholeCamera, flippedCamera_R_world, objectPoints, imagePoints, distortImagePoints, optimizedFlippedCamera_R_world, optimizedCamera, iterations, estimator, lambda, lambdaFactor, initialError, finalError, invertedCovariances, intermediateErrors))
virtual size_t size() const =0
Returns the number of accessible elements of this accessor object.
This class implements the abstract base class for all AnyCamera objects.
Definition: AnyCamera.h:130
static HomogenousMatrixT4< U > standard2InvertedFlipped(const HomogenousMatrixT4< U > &world_T_camera)
Transforms a standard homogenous 4x4 viewing (extrinsic camera) matrix into an inverted and flipped c...
Definition: Camera.h:734
static HomogenousMatrixT4< U > invertedFlipped2Standard(const HomogenousMatrixT4< U > &flippedCamera_T_world)
Transforms an inverted and flipped camera pose into a standard camera pose.
Definition: Camera.h:757
This class implements a base class for all indexed-based accessors allowing a constant reference acce...
Definition: Accessor.h:241
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 the basic functions for least square or robust optimization algorithms for non ...
Definition: NonLinearOptimization.h:34
This class implements least square or robust optimization algorithms for orientations.
Definition: NonLinearOptimizationOrientation.h:30
static bool optimizeCameraOrientationIF(const PinholeCamera &pinholeCamera, const SquareMatrix3 &flippedCamera_R_world, const ConstIndexedAccessor< ObjectPoint > &objectPoints, const ConstIndexedAccessor< ImagePoint > &imagePoints, const bool distortImagePoints, SquareMatrix3 &optimizedFlippedCamera_R_world, PinholeCamera &optimizedCamera, const unsigned int iterations, 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 *intermediateErrors=nullptr)
Minimizes the projection error of a given inverted and flipped 3DOF orientation and the entire camera...
static bool optimizeCameraOrientation(const PinholeCamera &pinholeCamera, const SquareMatrix3 &world_R_camera, const ConstIndexedAccessor< ObjectPoint > &objectPoints, const ConstIndexedAccessor< ImagePoint > &imagePoints, const bool distortImagePoints, SquareMatrix3 &world_R_optimizedCamera, PinholeCamera &optimizedCamera, const unsigned int iterations, 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 *intermediateErrors=nullptr)
Minimizes the projection error of a given 3DOF orientation and the entire camera parameters (intrinsi...
Definition: NonLinearOptimizationOrientation.h:151
static bool optimizeOrientation(const AnyCamera &camera, const SquareMatrix3 &world_R_camera, const ConstIndexedAccessor< ObjectPoint > &objectPoints, const ConstIndexedAccessor< ImagePoint > &imagePoints, SquareMatrix3 &world_R_optimizedCamera, const unsigned int iterations, 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 *intermediateErrors=nullptr)
Minimizes the projection error of a given 3DOF orientation.
Definition: NonLinearOptimizationOrientation.h:134
static bool optimizeOrientationIF(const AnyCamera &camera, const SquareMatrix3 &flippedCamera_R_world, const ConstIndexedAccessor< ObjectPoint > &objectPoints, const ConstIndexedAccessor< ImagePoint > &imagePoints, SquareMatrix3 &optimizedFlippedCamera_R_world, const unsigned int iterations, 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 *intermediateErrors=nullptr)
Minimizes the projection error of a given inverted and flipped 3DOF orientation.
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
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15