8 #ifndef META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_CAMERA_H
9 #define META_OCEAN_GEOMETRY_NON_LINEAR_OPTIMIZATION_CAMERA_H
35 class CameraOrientationsBaseData;
41 template <
unsigned int tParameters>
47 class CameraOrientationsFovData;
53 template <PinholeCamera::OptimizationStrategy tOptimizationStrategy>
60 template <
unsigned int tParameters>
66 class CameraPosesOptimizationProvider;
72 template <
unsigned int tParameters>
97 static bool findInitialFieldOfView(
const PinholeCamera& pinholeCamera,
const ConstIndexedAccessor<SquareMatrix3>& orientations,
const PoseGroupsAccessor& correspondenceGroups,
PinholeCamera& optimizedCamera,
NonconstIndexedAccessor<SquareMatrix3>* optimizedOrientations,
const Scalar lowerFovX =
Numeric::deg2rad(40),
const Scalar upperFovX =
Numeric::deg2rad(90),
const unsigned int steps = 10u,
const unsigned int recursiveIterations = 3u,
const bool onlyFrontObjectPoints =
true,
bool* significantResult =
nullptr,
Scalar* finalError =
nullptr,
Worker* worker =
nullptr,
bool* abort =
nullptr);
121 static bool findInitialFieldOfView(
const PinholeCamera& pinholeCamera,
const ConstIndexedAccessor<HomogenousMatrix4>& poses,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ObjectPointGroupsAccessor& correspondenceGroups,
PinholeCamera& optimizedCamera,
NonconstIndexedAccessor<HomogenousMatrix4>* optimizedPoses,
NonconstIndexedAccessor<Vector3>* optimizedObjectPoints,
const Scalar lowerFovX =
Numeric::deg2rad(40),
const Scalar upperFovX =
Numeric::deg2rad(90),
const unsigned int steps = 10u,
const unsigned int recursiveIterations = 3u,
const bool onlyFrontObjectPoints =
true,
bool* significantResult =
nullptr,
Scalar* finalError =
nullptr,
Worker* worker =
nullptr,
bool* abort =
nullptr);
139 static bool optimizeCamera(
const PinholeCamera& pinholeCamera,
const ConstIndexedAccessor<Vector2>& normalizedObjectPoints,
const ConstIndexedAccessor<Vector2>& imagePoints,
const PinholeCamera::OptimizationStrategy optimizationStrategy,
PinholeCamera& optimizedCamera,
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);
161 static bool optimizeCameraOrientations(
const PinholeCamera& pinholeCamera,
const ConstIndexedAccessor<SquareMatrix3>& orientations,
const PoseGroupsAccessor& correspondenceGroups,
const PinholeCamera::OptimizationStrategy optimizationStrategy,
PinholeCamera& optimizedCamera,
NonconstIndexedAccessor<SquareMatrix3>* optimizedOrientations,
const unsigned int iterations,
const Geometry::Estimator::EstimatorType estimator =
Geometry::Estimator::ET_SQUARE,
const Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
const bool onlyFrontObjectPoints =
true,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
Scalars* intermediateErrors =
nullptr);
184 static bool optimizeCameraPoses(
const PinholeCamera& pinholeCamera,
const ConstIndexedAccessor<HomogenousMatrix4>& poses,
const ConstIndexedAccessor<Vectors3>& objectPointGroups,
const ConstIndexedAccessor<Vectors2>& imagePointGroups,
PinholeCamera& optimizedCamera,
NonconstIndexedAccessor<HomogenousMatrix4>* optimizedPoses,
const unsigned int iterations,
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,
Scalars* intermediateErrors =
nullptr);
192 static bool optimizeCameraPosesIF(
const PinholeCamera& pinholeCamera,
const ConstIndexedAccessor<HomogenousMatrix4>& posesIF,
const ConstIndexedAccessor<Vectors3>& objectPointGroups,
const ConstIndexedAccessor<Vectors2>& imagePointGroups,
PinholeCamera& optimizedCamera,
NonconstIndexedAccessor<HomogenousMatrix4>* optimizedPosesIF,
const unsigned int iterations,
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,
Scalars* intermediateErrors =
nullptr);
217 static bool optimizeCameraObjectPointsPoses(
const PinholeCamera& pinholeCamera,
const ConstIndexedAccessor<HomogenousMatrix4>& poses,
const ConstIndexedAccessor<Vector3>& objectPoints,
const ObjectPointGroupsAccessor& correspondenceGroups,
const PinholeCamera::OptimizationStrategy optimizationStrategy,
PinholeCamera& optimizedCamera,
NonconstIndexedAccessor<HomogenousMatrix4>* optimizedPoses,
NonconstIndexedAccessor<Vector3>* optimizedObjectPoints,
const unsigned int iterations,
const Geometry::Estimator::EstimatorType estimator =
Geometry::Estimator::ET_SQUARE,
const Scalar lambda =
Scalar(0.001),
const Scalar lambdaFactor =
Scalar(5),
const bool onlyFrontObjectPoints =
true,
Scalar* initialError =
nullptr,
Scalar* finalError =
nullptr,
Scalars* intermediateErrors =
nullptr);
241 static void findInitialFieldOfViewSubset(
const PinholeCamera* pinholeCamera,
const ConstIndexedAccessor<SquareMatrix3>* orientations,
const PoseGroupsAccessor* correspondenceGroups,
PinholeCamera* optimizedCamera,
SquareMatrices3* optimizedOrientations,
const Scalar lowerFovX,
const Scalar upperFovX,
const unsigned int overallSteps,
const bool onlyFrontObjectPoints,
Scalar* bestError,
Scalars* allErrors,
Lock* lock,
bool* abort,
const unsigned int firstStep,
const unsigned int steps);
265 static void findInitialFieldOfViewSubset(
const PinholeCamera* pinholeCamera,
const ConstIndexedAccessor<HomogenousMatrix4>* poses,
const ConstIndexedAccessor<Vector3>* objectPoints,
const ObjectPointGroupsAccessor* correspondenceGroups,
PinholeCamera* optimizedCamera,
HomogenousMatrices4* optimizedPoses,
Vectors3* optimizedObjectPoints,
const Scalar lowerFovX,
const Scalar upperFovX,
const unsigned int overallSteps,
const bool onlyFrontObjectPoints,
Scalar* bestError,
Scalars* allErrors,
Lock* lock,
bool* abort,
const unsigned int firstStep,
const unsigned int steps);
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 an abstract specialization of the accessor for groups of pairs for object point...
Definition: NonLinearOptimization.h:159
This class implements an abstract specialization of the accessor for groups of pairs for poses.
Definition: NonLinearOptimization.h:185
Forward declaration of the data class allowing to optimized the camera parameters for unconstrained (...
Definition: NonLinearOptimizationCamera.h:73
Forward declaration of the data class allowing to optimized the camera parameters for rotational came...
Definition: NonLinearOptimizationCamera.h:61
Forward declaration of a base class allowing to optimized the camera profile.
Definition: NonLinearOptimizationCamera.h:42
Forward declaration of an optimization provider allowing to optimize the individual parameters of a c...
Definition: NonLinearOptimizationCamera.h:54
This class implements least square or robust optimization algorithms for camera profiles.
Definition: NonLinearOptimizationCamera.h:29
static bool optimizeCameraPoses(const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< HomogenousMatrix4 > &poses, const ConstIndexedAccessor< Vectors3 > &objectPointGroups, const ConstIndexedAccessor< Vectors2 > &imagePointGroups, PinholeCamera &optimizedCamera, NonconstIndexedAccessor< HomogenousMatrix4 > *optimizedPoses, const unsigned int iterations, 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, Scalars *intermediateErrors=nullptr)
Minimizes the projection error between the projections of static 3D object points and their correspon...
static bool optimizeCameraObjectPointsPoses(const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< HomogenousMatrix4 > &poses, const ConstIndexedAccessor< Vector3 > &objectPoints, const ObjectPointGroupsAccessor &correspondenceGroups, const PinholeCamera::OptimizationStrategy optimizationStrategy, PinholeCamera &optimizedCamera, NonconstIndexedAccessor< HomogenousMatrix4 > *optimizedPoses, NonconstIndexedAccessor< Vector3 > *optimizedObjectPoints, const unsigned int iterations, const Geometry::Estimator::EstimatorType estimator=Geometry::Estimator::ET_SQUARE, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
Optimizes the camera parameters of a given camera profile for a set of given camera poses and a set o...
static bool findInitialFieldOfView(const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< HomogenousMatrix4 > &poses, const ConstIndexedAccessor< Vector3 > &objectPoints, const ObjectPointGroupsAccessor &correspondenceGroups, PinholeCamera &optimizedCamera, NonconstIndexedAccessor< HomogenousMatrix4 > *optimizedPoses, NonconstIndexedAccessor< Vector3 > *optimizedObjectPoints, const Scalar lowerFovX=Numeric::deg2rad(40), const Scalar upperFovX=Numeric::deg2rad(90), const unsigned int steps=10u, const unsigned int recursiveIterations=3u, const bool onlyFrontObjectPoints=true, bool *significantResult=nullptr, Scalar *finalError=nullptr, Worker *worker=nullptr, bool *abort=nullptr)
Determines the initial field of view for a set of camera frames with known poses and groups of corres...
static bool optimizeCamera(const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< Vector2 > &normalizedObjectPoints, const ConstIndexedAccessor< Vector2 > &imagePoints, const PinholeCamera::OptimizationStrategy optimizationStrategy, PinholeCamera &optimizedCamera, 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 individual parameters of a camera profile by minimizing the pixel error between normali...
static void findInitialFieldOfViewSubset(const PinholeCamera *pinholeCamera, const ConstIndexedAccessor< HomogenousMatrix4 > *poses, const ConstIndexedAccessor< Vector3 > *objectPoints, const ObjectPointGroupsAccessor *correspondenceGroups, PinholeCamera *optimizedCamera, HomogenousMatrices4 *optimizedPoses, Vectors3 *optimizedObjectPoints, const Scalar lowerFovX, const Scalar upperFovX, const unsigned int overallSteps, const bool onlyFrontObjectPoints, Scalar *bestError, Scalars *allErrors, Lock *lock, bool *abort, const unsigned int firstStep, const unsigned int steps)
Determines the initial field of view for a set of camera frames with known poses and groups of corres...
static bool findInitialFieldOfView(const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< SquareMatrix3 > &orientations, const PoseGroupsAccessor &correspondenceGroups, PinholeCamera &optimizedCamera, NonconstIndexedAccessor< SquareMatrix3 > *optimizedOrientations, const Scalar lowerFovX=Numeric::deg2rad(40), const Scalar upperFovX=Numeric::deg2rad(90), const unsigned int steps=10u, const unsigned int recursiveIterations=3u, const bool onlyFrontObjectPoints=true, bool *significantResult=nullptr, Scalar *finalError=nullptr, Worker *worker=nullptr, bool *abort=nullptr)
Determines the initial field of view for a set of camera frames with known orientations and groups of...
static void findInitialFieldOfViewSubset(const PinholeCamera *pinholeCamera, const ConstIndexedAccessor< SquareMatrix3 > *orientations, const PoseGroupsAccessor *correspondenceGroups, PinholeCamera *optimizedCamera, SquareMatrices3 *optimizedOrientations, const Scalar lowerFovX, const Scalar upperFovX, const unsigned int overallSteps, const bool onlyFrontObjectPoints, Scalar *bestError, Scalars *allErrors, Lock *lock, bool *abort, const unsigned int firstStep, const unsigned int steps)
Determines the initial field of view for a set of camera frames with known orientations and groups of...
static bool optimizeCameraOrientations(const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< SquareMatrix3 > &orientations, const PoseGroupsAccessor &correspondenceGroups, const PinholeCamera::OptimizationStrategy optimizationStrategy, PinholeCamera &optimizedCamera, NonconstIndexedAccessor< SquareMatrix3 > *optimizedOrientations, const unsigned int iterations, const Geometry::Estimator::EstimatorType estimator=Geometry::Estimator::ET_SQUARE, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), const bool onlyFrontObjectPoints=true, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
Optimizes the camera parameters of a given camera profile for a set of camera frames with known orien...
static bool optimizeCameraPosesIF(const PinholeCamera &pinholeCamera, const ConstIndexedAccessor< HomogenousMatrix4 > &posesIF, const ConstIndexedAccessor< Vectors3 > &objectPointGroups, const ConstIndexedAccessor< Vectors2 > &imagePointGroups, PinholeCamera &optimizedCamera, NonconstIndexedAccessor< HomogenousMatrix4 > *optimizedPosesIF, const unsigned int iterations, 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, Scalars *intermediateErrors=nullptr)
Minimizes the projection error between the projections of static 3D object points and their correspon...
This class implements the basic functions for least square or robust optimization algorithms for non ...
Definition: NonLinearOptimization.h:34
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a base class for all indexed-based accessors allowing a non-constant reference ...
Definition: Accessor.h:284
static constexpr T deg2rad(const T deg)
Converts deg to rad.
Definition: Numeric.h:3232
OptimizationStrategy
Definition of individual optimization strategies for camera parameters.
Definition: PinholeCamera.h:129
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< HomogenousMatrix4 > HomogenousMatrices4
Definition of a vector holding HomogenousMatrix4 objects.
Definition: HomogenousMatrix4.h:73
std::vector< Scalar > Scalars
Definition of a vector holding Scalar objects.
Definition: Math.h:144
std::vector< SquareMatrix3 > SquareMatrices3
Definition of a vector holding SquareMatrix3 objects.
Definition: SquareMatrix3.h:71
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15