Ocean
|
This class implements non linear optimization algorithms for homographies. More...
Public Types | |
typedef std::pair< Vectors2, Vectors2 > | ImagePointsPair |
Definition of a pair holding to sets of corresponding image points. More... | |
typedef std::vector< ImagePointsPair > | ImagePointsPairs |
Definition of a vector holding pairs of corresponding image points. More... | |
Static Public Member Functions | |
static bool | optimizeHomography (const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, const unsigned int modelParameters, SquareMatrix3 &optimizedHomography, const unsigned int iterations=20u, 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 *intermediates=nullptr) |
Optimizes the homography defining the transformation between two sets of corresponding image points which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames. More... | |
template<Estimator::EstimatorType tEstimator> | |
static bool | optimizeHomography (const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, const unsigned int modelParameters, SquareMatrix3 &optimizedHomography, const unsigned int iterations=20u, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediates=nullptr) |
Optimizes the homography defining the transformation between two sets of corresponding image points which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames. More... | |
static bool | optimizeSimilarity (const SquareMatrix3 &similarity, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedSimilarity, const unsigned int iterations=20u, 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 *intermediates=nullptr) |
Optimizes a similarity transformation defining the transformation between two sets of corresponding image points visible in two individual camera frames. More... | |
template<Estimator::EstimatorType tEstimator> | |
static bool | optimizeSimilarity (const SquareMatrix3 &similarity, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedSimilarity, const unsigned int iterations=20u, const Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediates=nullptr) |
Optimizes a similarity defining the transformation between two sets of corresponding image points visible in two individual camera frames. More... | |
static bool | optimizeHomography (const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedHomography, 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 planar homography defining the transformation between projected 3D plane points in two cameras frames. More... | |
static bool | optimizeHomography (const PinholeCamera &pinholeCamera, const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, SquareMatrix3 &optimizedHomography, 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 homography defining the transformation between projected 3D plane points in two cameras frames. More... | |
static bool | optimizeCameraHomography (const PinholeCamera &pinholeCamera, const SquareMatrix3 &homography, const Vector2 *imagePointsLeft, const Vector2 *imagePointsRight, const size_t correspondences, PinholeCamera &optimizedCamera, SquareMatrix3 &optimizedHomography, 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) |
TODO seems to be not correct TODO VALIDATE Optimizes the camera profile and the planar homography defining the transformation between projected 3D plane points in two cameras frames. More... | |
static bool | optimizeCameraHomographies (const PinholeCamera &pinholeCamera, const SquareMatrices3 &homographies, const ImagePointsPairs &imagePointsPairs, PinholeCamera &optimizedCamera, SquareMatrices3 &optimizedHomographies, 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 camera profile and concurrently a set of homographies which come with corresponding pairs of image point correspondences. More... | |
static bool | optimizeDistortionCameraHomographies (const PinholeCamera &pinholeCamera, const SquareMatrices3 &homographies, const ImagePointsPairs &imagePointsPairs, PinholeCamera &optimizedCamera, SquareMatrices3 &optimizedHomographies, 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 only the distortion parameters of a camera profile and concurrently a set of homographies which come with corresponding pairs of image point correspondences. 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... | |
This class implements non linear optimization algorithms for homographies.
typedef std::pair<Vectors2, Vectors2> Ocean::Geometry::NonLinearOptimizationHomography::ImagePointsPair |
Definition of a pair holding to sets of corresponding image points.
typedef std::vector<ImagePointsPair> Ocean::Geometry::NonLinearOptimizationHomography::ImagePointsPairs |
Definition of a vector holding pairs of corresponding image points.
|
static |
Optimizes the camera profile and concurrently a set of homographies which come with corresponding pairs of image point correspondences.
The given homographies transform image points defined in the 'first' camera frame into image points defined in the 'second' camera frame: p_second = H * p_first.
However, as more than one homography can be provided, each individual homography has an individual 'first' and 'second' camera frame.
The given pairs of points correspondences define the points in the 'first' camera frame (pair.first) and the corresponding points in the 'second' camera frame (pair.second).
pinholeCamera | The pinhole camera profile that has been used to create the initial homographies |
homographies | The individual homographies each defines a transformation between two camera frames, the number of homographies must match the number of pairs of image point correspondences |
imagePointsPairs | The individual pairs of image points correspondences, each paint pair corresponds with one homography |
optimizedCamera | The resulting optimized camera profile |
optimizedHomographies | The set of optimized homographies |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
estimator | Robust error estimator to be used |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
|
static |
TODO seems to be not correct TODO VALIDATE Optimizes the camera profile and the planar homography defining the transformation between projected 3D plane points in two cameras frames.
pinholeCamera | The initial pinhole camera profile |
homography | Initial homography that will be optimized |
imagePointsLeft | Projected 3D plane points visible in the left camera frame |
imagePointsRight | Projected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame |
correspondences | Number given image correspondences |
optimizedCamera | Optimized camera profile |
optimizedHomography | Resulting optimized homography |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
estimator | Robust error estimator to be used |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
|
static |
Optimizes only the distortion parameters of a camera profile and concurrently a set of homographies which come with corresponding pairs of image point correspondences.
The given homographies transform image points defined in the 'first' camera frame into image points defined in the 'second' camera frame: p_second = H * p_first.
However, as more than one homography can be provided, each individual homography has an individual 'first' and 'second' camera frame.
The given pairs of points correspondences define the points in the 'first' camera frame (pair.first) and the corresponding points in the 'second' camera frame (pair.second).
pinholeCamera | The pinhole camera profile that has been used to create the initial homographies |
homographies | The individual homographies each defines a transformation between two camera frames, the number of homographies must match the number of pairs of image point correspondences |
imagePointsPairs | The individual pairs of image points correspondences, each paint pair corresponds with one homography |
optimizedCamera | The resulting optimized camera profile |
optimizedHomographies | The set of optimized homographies |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
estimator | Robust error estimator to be used |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
|
static |
Optimizes homography defining the transformation between projected 3D plane points in two cameras frames.
pinholeCamera | The pinhole camera profile defining the projection, must be valid |
homography | Initial homography that will be optimized, rightPoint = homography * leftPoint, must be valid |
imagePointsLeft | Projected 3D plane points visible in the left camera frame |
imagePointsRight | Projected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame |
correspondences | Number given image correspondences |
optimizedHomography | Resulting optimized homography, rightPoint = optimizedHomography * leftPoint |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
estimator | Robust error estimator to be used |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
|
static |
Optimizes the homography defining the transformation between two sets of corresponding image points which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames.
This function can use 8 or 9 parameters to represent the optimization model of the homography.
A homography has 8 degrees of freedom so that 8 model parameters should be the correct choice.
However, due to numerical stability the application of 9 model parameters often provides a more robust/stable solution, especially for image point correspondences with complex distributions/locations. Beware: In case binary size matters, and in case you know which robust estimator to be used for optimizing the homography, please use the corresponding function using a template-parameter for the estimator.
homography | Initial homography that will be optimized, rightPoint = homography * leftPoint, must be valid |
imagePointsLeft | Projected 3D plane points visible in the left camera frame |
imagePointsRight | Projected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame |
correspondences | Number given image correspondences, with range [4, infinity) |
modelParameters | The number of parameters defining the model (of the homography) to be optimize, with range [8, 9] |
optimizedHomography | Resulting optimized homography, normalized so that the lower right element of the Homography is 1, rightPoint = optimizedHomography * leftPoint |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
estimator | The robust error estimator to be used for calculating the accuracy/error of a homography |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
invertedCovariances | Optional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix) |
intermediates | Optional resulting intermediate (improving) errors in relation to the defined estimator |
|
static |
Optimizes the homography defining the transformation between two sets of corresponding image points which are projections of 3D object points (lying on a common plane) and visible in two individual camera frames.
This function can use 8 or 9 parameters to represent the optimization model of the homography.
A homography has 8 degrees of freedom so that 8 model parameters should be the correct choice.
However, due to numerical stability the application of 9 model parameters often provides a more robust/stable solution, especially for image point correspondences with complex distributions/locations.
homography | Initial homography that will be optimized, rightPoint = homography * leftPoint, must be valid |
imagePointsLeft | Projected 3D plane points visible in the left camera frame |
imagePointsRight | Projected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame |
correspondences | Number given image correspondences, with range [4, infinity) |
modelParameters | The number of parameters defining the model (of the homography) to be optimize, with range [8, 9] |
optimizedHomography | Resulting optimized homography, normalized so that the lower right element of the Homography is 1, rightPoint = optimizedHomography * leftPoint |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
invertedCovariances | Optional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix) |
intermediates | Optional resulting intermediate (improving) errors in relation to the defined estimator |
tEstimator | The robust error estimator to be used for calculating the accuracy/error of a homography |
|
static |
Optimizes the planar homography defining the transformation between projected 3D plane points in two cameras frames.
homography | Initial homography that will be optimized, rightPoint = homography * leftPoint, must be valid |
imagePointsLeft | Projected 3D plane points visible in the left camera frame |
imagePointsRight | Projected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame |
correspondences | Number given image correspondences |
optimizedHomography | Resulting optimized homography, rightPoint = optimizedHomography * leftPoint, must be valid |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
estimator | Robust error estimator to be used |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
|
static |
Optimizes a similarity transformation defining the transformation between two sets of corresponding image points visible in two individual camera frames.
Beware: In case binary size matters, and in case you know which robust estimator to be used for optimizing the similarity, please use the corresponding function using a template-parameter for the estimator.
similarity | Initial similarity that will be optimized, rightPoint = similarity * leftPoint, must be valid |
imagePointsLeft | Projected 3D plane points visible in the left camera frame |
imagePointsRight | Projected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame |
correspondences | Number given image correspondences, with range [2, infinity) |
optimizedSimilarity | Resulting optimized similarity, rightPoint = optimizedSimilarity * leftPoint |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
estimator | The robust error estimator to be used for calculating the accuracy/error of a similarity |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
invertedCovariances | Optional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix) |
intermediates | Optional resulting intermediate (improving) errors in relation to the defined estimator |
|
static |
Optimizes a similarity defining the transformation between two sets of corresponding image points visible in two individual camera frames.
similarity | Initial similarity that will be optimized, rightPoint = similarity * leftPoint, must be valid |
imagePointsLeft | Projected 3D plane points visible in the left camera frame |
imagePointsRight | Projected 3D plane points visible in the right camera frame, each point corresponds the one point in the left camera frame |
correspondences | Number given image correspondences, with range [2, infinity) |
optimizedSimilarity | Resulting optimized similarity, rightPoint = optimizedSimilarity * leftPoint |
iterations | Number of iterations to be applied at most, if no convergence can be reached |
lambda | Initial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity) |
lambdaFactor | Levenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity) |
initialError | Optional resulting averaged pixel error for the given initial parameters, in relation to the defined estimator |
finalError | Optional resulting averaged pixel error for the final optimized parameters, in relation to the defined estimator |
invertedCovariances | Optional set of 2x2 inverted covariance matrices that represent the uncertainties of the image points (a 2*n x 2 matrix) |
intermediates | Optional resulting intermediate (improving) errors in relation to the defined estimator |
tEstimator | The robust error estimator to be used for calculating the accuracy/error of a similarity |