8 #ifndef META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_POSE_H
9 #define META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_POSE_H
35 class PoseOptimizationProvider;
40 class AdvancedPinholeCameraPoseOptimizationProvider;
45 class AdvancedAnyCameraPoseOptimizationProvider;
50 class PoseZoomOptimizationProvider;
77 static inline bool optimizePose(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor = 10,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
96 static inline bool optimizePose(
const AnyCamera& anyCamera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor = 10,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
117 static inline bool optimizePose(
const AnyCamera& camera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances);
142 static inline bool optimizePose(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances);
165 static inline bool optimizePoseZoom(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& world_T_camera,
const Scalar zoom,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
Scalar& optimizedZoom,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor = 10,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
const Matrix* invertedCovariances =
nullptr);
190 static bool optimizePoseIF(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& flippedCamera_T_world,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& optimizedInvertedFlippedPose,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor = 10,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
209 static bool optimizePoseIF(
const AnyCamera& anyCamera,
const HomogenousMatrix4& flippedCamera_T_world,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
HomogenousMatrix4& optimizedPose_flippedCamera_T_world,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor = 10,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr);
230 static bool optimizePoseIF(
const AnyCamera& camera,
const HomogenousMatrix4& flippedCamera_T_world,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
HomogenousMatrix4& optimizedFlippedCamera_T_world,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances);
256 static bool optimizePoseIF(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& flippedCamera_T_world,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& optimizedInvertedFlippedPose,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances);
279 static bool optimizePoseZoomIF(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& flippedCamera_T_world,
const Scalar zoom,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& optimizedInvertedFlippedPose,
Scalar& optimizedZoom,
const unsigned int iterations = 20u,
const Estimator::EstimatorType estimator =
Estimator::ET_SQUARE,
Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor = 10,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
const Matrix* invertedCovariances =
nullptr);
282 inline bool NonLinearOptimizationPose::optimizePose(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError)
284 ocean_assert(pinholeCamera.
isValid());
285 ocean_assert(world_T_camera.
isValid());
286 ocean_assert(objectPoints.
size() >= 3);
287 ocean_assert(objectPoints.
size() == imagePoints.
size());
292 if (!
optimizePoseIF(pinholeCamera, flippedCamera_T_world, objectPoints, imagePoints, distortImagePoints, optimizedInvertedFlippedPose, iterations, estimator, lambda, lambdaFactor, initialError, finalError))
301 inline bool NonLinearOptimizationPose::optimizePose(
const AnyCamera& anyCamera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError)
303 ocean_assert(anyCamera.
isValid());
304 ocean_assert(world_T_camera.
isValid());
305 ocean_assert(objectPoints.
size() >= 3);
306 ocean_assert(objectPoints.
size() == imagePoints.
size());
311 if (!
optimizePoseIF(anyCamera, flippedCamera_T_world, objectPoints, imagePoints, optimizedFlippedCamera_T_world, iterations, estimator, lambda, lambdaFactor, initialError, finalError))
320 inline bool NonLinearOptimizationPose::optimizePose(
const AnyCamera& camera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances)
322 ocean_assert(camera.
isValid());
323 ocean_assert(world_T_camera.
isValid());
325 ocean_assert(objectPoints.
size() >= 3u);
326 ocean_assert(objectPoints.
size() == imagePoints.
size());
331 if (!
optimizePoseIF(camera, flippedCamera_T_world, objectPoints, imagePoints, optimizedFlippedCamera_T_world, iterations, estimator, lambda, lambdaFactor, initialError, finalError, invertedCovariances))
340 inline bool NonLinearOptimizationPose::optimizePose(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& world_T_camera,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances)
344 return optimizePose(anyCamera, world_T_camera, objectPoints, imagePoints, world_T_optimizedCamera, iterations, estimator, lambda, lambdaFactor, initialError, finalError, invertedCovariances);
347 inline bool NonLinearOptimizationPose::optimizePoseZoom(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& world_T_camera,
const Scalar zoom,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const bool distortImagePoints,
HomogenousMatrix4& world_T_optimizedCamera,
Scalar& optimizedZoom,
const unsigned int iterations,
const Estimator::EstimatorType estimator,
Scalar lambda,
const Scalar lambdaFactor,
Scalar* initialError,
Scalar* finalError,
const Matrix* invertedCovariances)
350 ocean_assert(objectPoints.
size() >= 3u);
351 ocean_assert(objectPoints.
size() == imagePoints.
size());
356 if (!
optimizePoseZoomIF(pinholeCamera, flippedCamera_T_world, zoom, objectPoints, imagePoints, distortImagePoints, optimizedInvertedFlippedPose, optimizedZoom, iterations, estimator, lambda, lambdaFactor, initialError, finalError, invertedCovariances))
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
virtual bool isValid() const =0
Returns whether this camera is valid.
This class implements a specialized AnyCamera object wrapping the actual camera model.
Definition: AnyCamera.h:494
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
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 non linear optimization algorithms for camera poses.
Definition: NonLinearOptimizationPose.h:29
static bool optimizePose(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const ConstIndexedAccessor< Vector3 > &objectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, const bool distortImagePoints, HomogenousMatrix4 &world_T_optimizedCamera, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=10, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
Deprecated.
Definition: NonLinearOptimizationPose.h:282
static bool optimizePoseIF(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const ConstIndexedAccessor< Vector3 > &objectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, const bool distortImagePoints, HomogenousMatrix4 &optimizedInvertedFlippedPose, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=10, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
Deprecated.
static bool optimizePoseIF(const AnyCamera &camera, const HomogenousMatrix4 &flippedCamera_T_world, const ConstIndexedAccessor< Vector3 > &objectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, HomogenousMatrix4 &optimizedFlippedCamera_T_world, const unsigned int iterations, const Estimator::EstimatorType estimator, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError, Scalar *finalError, const Matrix *invertedCovariances)
Minimizes the projection error of a given 6-DOF camera pose.
static bool optimizePoseZoom(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Scalar zoom, const ConstIndexedAccessor< Vector3 > &objectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, const bool distortImagePoints, HomogenousMatrix4 &world_T_optimizedCamera, Scalar &optimizedZoom, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=10, Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr)
Minimizes the projection error of a given 6DOF pose holding orientation and translation parameters to...
Definition: NonLinearOptimizationPose.h:347
static bool optimizePoseIF(const AnyCamera &anyCamera, const HomogenousMatrix4 &flippedCamera_T_world, const ConstIndexedAccessor< Vector3 > &objectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, HomogenousMatrix4 &optimizedPose_flippedCamera_T_world, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=10, Scalar *initialError=nullptr, Scalar *finalError=nullptr)
Minimizes the projection error of a given inverted and flipped 6DOF pose holding orientation and tran...
static bool optimizePoseZoomIF(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const Scalar zoom, const ConstIndexedAccessor< Vector3 > &objectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, const bool distortImagePoints, HomogenousMatrix4 &optimizedInvertedFlippedPose, Scalar &optimizedZoom, const unsigned int iterations=20u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=10, Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr)
Minimizes the projection error of a given inverted and flipped 6DOF pose holding orientation and tran...
static bool optimizePoseIF(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const ConstIndexedAccessor< Vector3 > &objectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, const bool distortImagePoints, HomogenousMatrix4 &optimizedInvertedFlippedPose, const unsigned int iterations, const Estimator::EstimatorType estimator, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError, Scalar *finalError, const Matrix *invertedCovariances)
Deprecated.
bool isValid() const
Returns whether this matrix is a valid homogeneous transformation.
Definition: HomogenousMatrix4.h:1806
static constexpr T eps()
Returns a small epsilon.
bool isValid() const
Returns whether this camera is valid.
Definition: PinholeCamera.h:1572
float Scalar
Definition of a scalar type.
Definition: Math.h:128
PinholeCameraT< Scalar > PinholeCamera
Definition of an pinhole camera object with Scalar precision.
Definition: PinholeCamera.h:32
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15