Ocean
Ocean::Geometry::NonLinearOptimizationCamera Class Reference

This class implements least square or robust optimization algorithms for camera profiles. More...

Inheritance diagram for Ocean::Geometry::NonLinearOptimizationCamera:

Data Structures

class  CameraObjectPointsPosesData
 Forward declaration of the data class allowing to optimized the camera parameters for unconstrained (translational and rotational) camera motion. More...
 
class  CameraOrientationsData
 Forward declaration of the data class allowing to optimized the camera parameters for rotational camera motion. More...
 
class  CameraProfileBaseData
 Forward declaration of a base class allowing to optimized the camera profile. More...
 
class  CameraProvider
 Forward declaration of an optimization provider allowing to optimize the individual parameters of a camera profile. More...
 

Static Public Member Functions

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 correspondences of ids of 3D object points and 2D image point locations from the individual frames. More...
 
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 correspondences between pose indices and 2D image points locations within the pose frames while also the provided object points are optimized. More...
 
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 normalized image points (projected 3D object points) and their corresponding 2D image point observations. More...
 
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 orientation and groups of 2D/3D point correspondences from individual frames. More...
 
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 corresponding image points in several 6DOF camera poses. More...
 
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 corresponding image points in several 6DOF camera poses. More...
 
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 of given 3D object points by minimizing the projection error between the 3D object points and the corresponding 2D image points. More...
 

Static Protected Member Functions

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 correspondences of ids of 3D object points and 2D image point locations from the individual frames. More...
 
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 correspondences between pose indices and 2D image points locations within the pose frames. More...
 
- 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 camera profiles.

Member Function Documentation

◆ findInitialFieldOfView() [1/2]

static bool Ocean::Geometry::NonLinearOptimizationCamera::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 
)
static

Determines the initial field of view for a set of camera frames with known poses and groups of correspondences between pose indices and 2D image points locations within the pose frames while also the provided object points are optimized.

The number of correspondences may vary between the individual frames (groups).
Each group may address individual object points, however the larger the intersection of sets between the individual 3D object points in the individual frames the better the optimization result.

Parameters
pinholeCameraThe pinhole camera profile for which the better field of view will be determined, must be valid
posesThe accessor for the known poses of the individual camera frames
objectPointsThe accessor for the individual 3D object points
correspondenceGroupsThe accessor for the individual groups of correspondences between pose ids and image point location, one group for each object point
optimizedCameraThe resulting camera profile with best matching field of view
optimizedPosesOptional accessor for the resulting optimized camera poses matching with the new camera profile
optimizedObjectPointsOptional accessor for the resulting optimized object point locations
lowerFovXThe lower bound of the possible horizontal field of view in radian, with range (0, upperFovX]
upperFovXThe upper bound of the possible horizontal field of view in radian, with range [lowerFovX, PI)
stepsThe number of steps in which the defined angle range is subdivided, with range [4, infinity)
recursiveIterationsThe number of recursive iterations that will be applied to improve the accuracy, start with the second iteration the search for the best fov is centered at the position of the previous iteration, with range [1, infinity)
onlyFrontObjectPointsTrue, to avoid that the optimized 3D position lies behind any camera
significantResultOptional resulting whether the resulting field of view has an significant impact on the error; True, of so
finalErrorOptional resulting averaged square pixel error for the camera profile with the best matching field of view
workerOptional worker object to distribute the computation
abortOptional abort statement allowing to stop the execution; True, if the execution has to stop
Returns
True, if succeeded and the execution has not been aborted

◆ findInitialFieldOfView() [2/2]

static bool Ocean::Geometry::NonLinearOptimizationCamera::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 
)
static

Determines the initial field of view for a set of camera frames with known orientations and groups of correspondences of ids of 3D object points and 2D image point locations from the individual frames.

The number of correspondences may vary between the individual frames (groups).
Each group may address individual object points, however the larger the intersection of sets between the individual 3D object points in the individual frames the better the optimization result.

Parameters
pinholeCameraThe pinhole camera profile for which the better field of view will be determined, must be valid
orientationsThe accessor for the known orientations of the individual camera frames
correspondenceGroupsThe accessor for the individual groups of point correspondences, one group for each orientation
optimizedCameraThe resulting camera profile with best matching field of view
optimizedOrientationsOptional accessor for the optimized camera orientations matching with the new camera profile
lowerFovXThe lower bound of the possible horizontal field of view in radian, with range (0, upperFovX]
upperFovXThe upper bound of the possible horizontal field of view in radian, with range [lowerFovX, PI)
stepsThe number of steps in which the defined angle range is subdivided, with range [4, infinity)
recursiveIterationsThe number of recursive iterations that will be applied to improve the accuracy, start with the second iteration the search for the best fov is centered at the position of the previous iteration, with range [1, infinity)
onlyFrontObjectPointsTrue, to avoid that the optimized 3D position lies behind any camera
significantResultOptional resulting whether the resulting field of view has an significant impact on the error; True, of so
finalErrorOptional resulting averaged square pixel error for the camera profile with the best matching field of view
workerOptional worker object to distribute the computation
abortOptional abort statement allowing to stop the execution; True, if the execution has to stop
Returns
True, if succeeded and the execution has not been aborted

◆ findInitialFieldOfViewSubset() [1/2]

static void Ocean::Geometry::NonLinearOptimizationCamera::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 
)
staticprotected

Determines the initial field of view for a set of camera frames with known poses and groups of correspondences between pose indices and 2D image points locations within the pose frames.

The number of correspondences may vary between the individual frames (groups).
Each group may address individual object points, however the larger the intersection of sets between the individual 3D object points in the individual frames the better the optimization result.

Parameters
pinholeCameraThe pinhole camera profile for which the better field of view will be determined, must be valid
posesThe accessor for the known poses of the individual camera frames
objectPointsThe accessor for the individual 3D object points
correspondenceGroupsThe accessor for the individual groups of correspondences between pose ids and image point location, one group for each object point
optimizedCameraThe resulting camera profile with best matching field of view
optimizedPosesOptional accessor for the resulting optimized camera poses matching with the new camera profile
optimizedObjectPointsOptional accessor for the resulting optimized object point locations
lowerFovXThe lower bound of the possible horizontal field of view in radian, with range (0, upperFovX]
upperFovXThe upper bound of the possible horizontal field of view in radian, with range [lowerFovX, PI)
overallStepsThe overall number of steps in which the defined angle range is subdivided, with range [4, infinity)
onlyFrontObjectPointsTrue, to avoid that the optimized 3D position lies behind any camera
bestErrorResulting averaged square pixel error for the camera profile with the best matching field of view
allErrorsOptional vector of all errors that have been determined (can be used to decide whether a resulting best camera profile is significantly different from all other camera profiles)
lockLock object, must be defined if this function is executed in parallel on individual threads, nullptr otherwise
abortOptional abort statement allowing to stop the execution; True, if the execution has to stop
firstStepThe first step to be handled, with range [0, overallSteps)
stepsThe number of steps which will be handled (from the entire number of overall steps), with range [1, overallSteps]

◆ findInitialFieldOfViewSubset() [2/2]

static void Ocean::Geometry::NonLinearOptimizationCamera::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 
)
staticprotected

Determines the initial field of view for a set of camera frames with known orientations and groups of correspondences of ids of 3D object points and 2D image point locations from the individual frames.

The number of correspondences may vary between the individual frames (groups).
Each group may address individual object points, however the larger the intersection of sets between the individual 3D object points in the individual frames the better the optimization result.

Parameters
pinholeCameraThe pinhole camera profile for which the better field of view will be determined, must be valid
orientationsThe accessor for the known orientations of the individual camera frames
correspondenceGroupsThe accessor for the individual groups of point correspondences, one group for each orientation
optimizedCameraThe resulting camera profile with best matching field of view
optimizedOrientationsOptional accessor for the optimized camera orientations matching with the new camera profile
lowerFovXThe lower bound of the possible horizontal field of view in radian, with range (0, upperFovX]
upperFovXThe upper bound of the possible horizontal field of view in radian, with range [lowerFovX, PI)
overallStepsThe overall number of steps in which the defined angle range is subdivided, with range [4, infinity)
onlyFrontObjectPointsTrue, to avoid that the optimized 3D position lies behind any camera
bestErrorResulting averaged square pixel error for the camera profile with the best matching field of view
allErrorsOptional vector of all errors that have been determined (can be used to decide whether a resulting best camera profile is significantly different from all other camera profiles)
lockLock object, must be defined if this function is executed in parallel on individual threads, nullptr otherwise
abortOptional abort statement allowing to stop the execution; True, if the execution has to stop
firstStepThe first step to be handled, with range [0, overallSteps)
stepsThe number of steps which will be handled (from the entire number of overall steps), with range [1, overallSteps]

◆ optimizeCamera()

static bool Ocean::Geometry::NonLinearOptimizationCamera::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 
)
static

Optimizes the individual parameters of a camera profile by minimizing the pixel error between normalized image points (projected 3D object points) and their corresponding 2D image point observations.

Which parameter of the camera profile will be optimized depends on the specified optimization strategy.

Parameters
pinholeCameraThe pinhole camera profile with initial distortion parameters to optimize
normalizedObjectPointsThe accessor for the projected 3D object points (the normalized image/object points)
imagePointsimagePoints The accessor for the observations of the projected 3D object points, defined in the pixel coordinate system, each point corresponds to one normalized object point
optimizationStrategyThe optimization strategy to be used
optimizedCameraResulting optimized camera object holding optimized intrinsic and distortion parameters
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)
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

◆ optimizeCameraObjectPointsPoses()

static bool Ocean::Geometry::NonLinearOptimizationCamera::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 
)
static

Optimizes the camera parameters of a given camera profile for a set of given camera poses and a set of given 3D object points by minimizing the projection error between the 3D object points and the corresponding 2D image points.

This function also optimized the camera poses and the locations of the 3D object point while the camera profile is optimized.
The number of 2D/3D point correspondences may vary between the individual frames (groups).
Each group may address individual object points, however the larger the intersection of sets between the individual 3D object points in the individual frames the better the optimization result.

Parameters
pinholeCameraThe pinhole camera profile to optimized
posesThe accessor for the known poses of the individual camera frames
objectPointsThe accessor for the known 3D object points locations
correspondenceGroupsThe accessor for the individual groups of correspondences between pose indices and image points, one group for each object point
optimizationStrategyThe optimization strategy for the camera profile
optimizedCameraThe resulting optimized camera profile
optimizedPosesOptional accessor for the resulting optimized camera poses, matching with the new camera profile
optimizedObjectPointsOptional accessor for the resulting optimized 3D object point locations, matching with the new camera profile
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
intermediateErrorsOptional resulting intermediate averaged pixel errors for the individual optimization steps, in relation to the defined estimator
Returns
True, if succeeded

◆ optimizeCameraOrientations()

static bool Ocean::Geometry::NonLinearOptimizationCamera::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 
)
static

Optimizes the camera parameters of a given camera profile for a set of camera frames with known orientation and groups of 2D/3D point correspondences from individual frames.

The number of points correspondences may vary between the individual frames (groups).
Each group may address individual object points.

Parameters
pinholeCameraThe pinhole camera profile to optimized
orientationsThe accessor for the known orientations of the individual camera frames
correspondenceGroupsThe accessor for the individual groups of point correspondences, one group for each orientation
optimizationStrategyThe optimization strategy
optimizedCameraThe resulting camera profile with ideal field of view
optimizedOrientationsOptional accessor for the optimized camera orientations matching with the new camera profile
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
intermediateErrorsOptional resulting intermediate averaged pixel errors for the individual optimization steps, in relation to the defined estimator
Returns
True, if succeeded

◆ optimizeCameraPoses()

static bool Ocean::Geometry::NonLinearOptimizationCamera::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 
)
static

Minimizes the projection error between the projections of static 3D object points and their corresponding image points in several 6DOF camera poses.

The camera profile as well as the camera poses are optimized concurrently. 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 holding intrinsic and distortion parameters to minimize the projection error for
posesThe individual camera poses, one pose for each pair of groups of object points and image points
objectPointGroupsThe accessor for the individual groups of 3D object points, one group for each camera pose with at least one object point
imagePointGroupsThe accessor for the individual groups of 2D image points, one group for each camera pose and one image point for each corresponding object point
optimizedCameraThe resulting optimized camera profile
optimizedPosesOptional accessor for the resulting optimized camera poses, matching with the new camera profile
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
intermediateErrorsOptional resulting intermediate averaged pixel errors for the individual optimization steps, in relation to the defined estimator
Returns
True, if succeeded
See also
optimizeCameraPoseIF().

◆ optimizeCameraPosesIF()

static bool Ocean::Geometry::NonLinearOptimizationCamera::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 
)
static

Minimizes the projection error between the projections of static 3D object points and their corresponding image points in several 6DOF camera poses.

Beware: The given poses are not equivalent to extrinsic camera matrices.
The given poses must be inverted and flipped around the new x axis by 180 degree.

See also
optimizeCameraPose().

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