8 #ifndef META_OCEAN_GEOMETRY_MULTIPLE_VIEW_GEOMETRY_H
9 #define META_OCEAN_GEOMETRY_MULTIPLE_VIEW_GEOMETRY_H
68 inline const SquareMatrix3& operator[](
const unsigned int index)
const;
288 template<
bool tUseIF>
362 tensorMatrices[0] = matrix0;
363 tensorMatrices[1] = matrix1;
364 tensorMatrices[2] = matrix2;
369 ocean_assert(matrices !=
nullptr);
371 tensorMatrices[0] = matrices[0];
372 tensorMatrices[1] = matrices[1];
373 tensorMatrices[2] = matrices[2];
378 ocean_assert(index < 3u);
379 return tensorMatrices[index];
384 ocean_assert(index < 3u);
385 return tensorMatrices[index];
390 return tensorMatrices;
395 return tensorMatrices;
536 ocean_assert(triangle2d.
isValid() && threshold > 0);
This class implements a base class for all indexed-based accessors allowing a constant reference acce...
Definition: Accessor.h:241
This class implements self-calibration for multiple views.
Definition: MultipleViewGeometry.h:403
static bool transformProjectiveToMetricIF(const SquareMatrix4 &Q, const ConstIndexedAccessor< HomogenousMatrix4 > &iFlippedProjectionMatrices, HomogenousMatrix4 *iFlippedMetricProjectionMatrices, SquareMatrix4 *transformation=nullptr)
Transforms a projective reconstruction towards a metric reconstruction.
static bool transformProjectionsZeroPrinciplePoint(const ConstIndexedAccessor< HomogenousMatrix4 > &iFlippedProjectionMatrices, const unsigned int imageWidth, const unsigned int imageHeight, HomogenousMatrix4 *iFlippedNormalizedProjectionMatrices, SquareMatrix3 *backTransformation=nullptr)
Transforms an inverted and flipped camera projection matrix P = K * [R|t] in a way that the principle...
static bool findCommonIntrinsicsFromProjectionMatricesIF(const ConstIndexedAccessor< HomogenousMatrix4 > &iFlippedProjectionMatrices, SquareMatrix3 &cameraIntrinsics, SquareMatrix4 *Q=nullptr, SquareMatrix3 *omega=nullptr)
Estimate the common intrinsic camera matrix based on an Absolute Conic omega (ω): omega = K * K^T — ...
static bool getTransformProjectiveToMetricMatrix(const SquareMatrix4 &Q, SquareMatrix4 &transformation)
Determines the perspective transformation to get a metric reconstruction.
static bool upperTriangleCholeskyDecomposition(const SquareMatrix3 &omega, SquareMatrix3 &cameraIntrinsic)
Performs the decomposition of an absolute conic omega (ω) into the intrinsic camera matrix: omega = ...
static bool findCommonIntrinsicsFromProjectionMatricesIF(const ConstIndexedAccessor< HomogenousMatrix4 > &iFlippedProjectionMatrices, const unsigned int imageWidth, const unsigned int imageHeight, SquareMatrix3 &cameraIntrinsics, SquareMatrix4 *Q=nullptr, SquareMatrix3 *omega=nullptr)
Estimate a common intrinsic camera matrix based on an Absolute Conic ω: ω_j = ω = KK^T.
static bool intrinsicsFromAbsoluteDualQuadricIF(const SquareMatrix4 &symmetricQ, const ConstIndexedAccessor< HomogenousMatrix4 > &iFlippedProjectionMatrices, SquareMatrix3 *intrinsics)
Determines individual intrinsic camera matrices from a known absolute dual quadric Q_infinity (Q∞) an...
static bool determineAbsoluteDualQuadricLinearIF(const ConstIndexedAccessor< HomogenousMatrix4 > &iFlippedProjectionMatrices, SquareMatrix4 &matrixQ, const unsigned int imageWidth, const unsigned int imageHeight, bool equalFxFy=true)
Estimates the absolute dual quadric Q_infinity (Q∞) from several projection-pose matrices by solving ...
static Matrix createLinearSystemForAbsoluteDualQuadric(const unsigned int omegaRowIndex, const unsigned int omegaColumnIndex, const HomogenousMatrix4 &iFlippedProjectionMatrix)
Creates a line for the linear system for the zero condition of absolute conic ω(i,...
static bool metricProjectionMatricesToPosesIF(const ConstIndexedAccessor< HomogenousMatrix4 > &metricProjectionsIF, const SquareMatrix3 &intrinsic, HomogenousMatrix4 *posesIF)
Decomposes metric camera projection matrices all containing/sharing the same known camera matrix (int...
Definition of a trifocal tensor matrix.
Definition: MultipleViewGeometry.h:40
const SquareMatrix3 * operator()() const
Data operator returning the pointer to the first matrix of this tensor.
Definition: MultipleViewGeometry.h:388
const SquareMatrix3 & operator[](const unsigned int index) const
Element operator.
Definition: MultipleViewGeometry.h:376
TrifocalTensor()
Creates a new tensor object without initialization.
Definition: MultipleViewGeometry.h:355
This class implements epipolar geometry functions for multiple views.
Definition: MultipleViewGeometry.h:33
static bool epipolesIF(const TrifocalTensor &trifocal, Vector3 &iFlippedNormedEpipole2, Vector3 &iFlippedNormedEpipole3)
Calculates the normalized epipoles of second and third view from trifocal tensor for inverted flipped...
static bool trifocalTensorMinimizingError(const ImagePoint *points1, const ImagePoint *points2, const ImagePoint *points3, const size_t correspondences, TrifocalTensor &trifocal)
Computing a geometric valid trifocal tensor minimizing algebraic error.
static bool calibrateFromProjectionsMatricesIF(const ConstIndexedAccessor< HomogenousMatrix4 > &iFlippedProjectionMatrices, const unsigned int imageWidth, const unsigned int imageHeight, SquareMatrix3 &cameraIntrinsic, HomogenousMatrix4 *iFlippedPoses)
Calibrate multiple projection matrices from a single camera.
static bool calculateProjectiveBasisTransform(const Vector2 &imagePointForTargetPoint100, const Vector2 &imagePointForTargetPoint010, const Vector2 &imagePointForTargetPoint001, const Vector2 &imagePointForTargetPoint111, SquareMatrix3 &baseTransformation)
Calculates a transformation for a projective basis defined by four individual (image) target points e...
static bool projectiveReconstructionFrom6PointsIF(const ImagePoint *points1, const ImagePoint *points2, const ImagePoint *points3, const size_t correspondences, HomogenousMatrix4 &iFlippedProjectionMatrix1, HomogenousMatrix4 &iFlippedProjectionMatrix2, HomogenousMatrix4 &iFlippedProjectionMatrix3, const Scalar squaredSuccessThreshold=(2.5 *2.5), Scalar *squaredProjectionError=nullptr)
Computes geometric valid camera projection matrices which are determined up to a common 3d projection...
static bool trifocalTensorLinear(const ImagePoint *points1, const ImagePoint *points2, const ImagePoint *points3, const size_t correspondences, Scalar *trifocal3x9, Matrix *matrixA=nullptr)
Calculates the trifocal tensor using linear system.
static Scalar errorMatrix(const TrifocalTensor &trifocal, const ImagePoint *points1, const ImagePoint *points2, const ImagePoint *points3, const size_t correspondences, SquareMatrix3 *errorMatrix=nullptr)
Calculates the trifocal tensor error in point–point–point correspondence equation: [x_2]_x * (sum_i(x...
static bool fundamentalMatricesIF(const TrifocalTensor &trifocal, const Vector3 &iFlippedEpipole2, const Vector3 &iFlippedEpipole3, SquareMatrix3 &fundamental21, SquareMatrix3 &fundamental31)
Calculates the fundamental matrices of second view and third view from trifocal tensor.
static bool epipoles(const Scalar *const trifocal1, const Scalar *const trifocal2, const Scalar *const trifocal3, Vector3 &normedEpipole2, Vector3 &normedEpipole3)
Calculates the normalized epipoles of second and third view from trifocal tensor.
static bool cameraProjectionMatricesIF(const TrifocalTensor &trifocal, const Vector3 &iFlippedNormedEpipole2, const Vector3 &iFlippedNormedEpipole3, HomogenousMatrix4 &iFlippedProjectionMatrix2, HomogenousMatrix4 &iFlippedProjectionMatrix3)
Calculates the camera projection matrices of second and third view.
static bool projectiveReconstructionFrom6PointsIF(const ConstIndexedAccessor< ImagePoints > &imagePointsPerPose, NonconstIndexedAccessor< HomogenousMatrix4 > *posesIF, const Scalar squaredSuccessThreshold=Scalar(2.5 *2.5), Scalar *squaredProjectionError=nullptr)
Computes geometric valid camera projection matrices which are determined up to a common 3d projection...
static bool trifocalTensorFromProjectionMatrices(const HomogenousMatrix4 &iFlippedProjectionMatrixA, const HomogenousMatrix4 &iFlippedProjectionMatrixB, const HomogenousMatrix4 &iFlippedProjectionMatrixC, TrifocalTensor &trifocal)
Calculates the trifocal tensor by three projection matrix given: P_1 = [A | a4], P_2 = [B | b4],...
static bool trifocalTensorNormalizedLinear(const ImagePoint *points1, const ImagePoint *points2, const ImagePoint *points3, const size_t correspondences, TrifocalTensor &trifocal)
The normalized linear algorithm of computation of trifocal tensor.
static bool pointIsCollinear(const Triangle2 &triangle, const Vector2 &point, const Scalar threshold=Scalar(0.01))
Checks if a given 2D point is collinear to three given 2D points (defined by a 2D triangle).
Definition: MultipleViewGeometry.h:534
static bool trifocalTensorIF(const ImagePoint *points1, const ImagePoint *points2, const ImagePoint *points3, const size_t correspondences, HomogenousMatrix4 &iFlippedProjectionMatrix1, HomogenousMatrix4 &iFlippedProjectionMatrix2, HomogenousMatrix4 &iFlippedProjectionMatrix3, TrifocalTensor *trifocalTensor=nullptr)
The normalized linear algorithm of computation of trifocal tensor.
static bool epipoles(const TrifocalTensor &trifocal, Vector3 &normedEpipole2, Vector3 &normedEpipole3)
Calculates the normalized epipoles of second and third view from trifocal tensor.
static bool trifocalTensorNormalizedLinear(const ImagePoint *points1, const ImagePoint *points2, const ImagePoint *points3, const size_t correspondences, Scalar *trifocal3x9, Matrix *matrixA=nullptr)
The normalized linear algorithm of computation of trifocal tensor.
static bool calibrateFromProjectionsMatricesIF(const HomogenousMatrix4 &iFlippedProjectionMatrix1, const HomogenousMatrix4 &iFlippedProjectionMatrix2, const HomogenousMatrix4 &iFlippedProjectionMatrix3, const unsigned int imageWidth, const unsigned int imageHeight, SquareMatrix3 &cameraIntrinsics, HomogenousMatrix4 &iFlippedPose1, HomogenousMatrix4 &iFlippedPose2, HomogenousMatrix4 &iFlippedPose3)
Calibrate three projection matrices from a single camera.
static bool trifocalTensorFromProjectionMatrices(const HomogenousMatrix4 &iFlippedProjectionMatrixB, const HomogenousMatrix4 &iFlippedProjectionMatrixC, TrifocalTensor &trifocal)
Calculates the trifocal tensor by two projection matrix given: P_1 = [I | 0], P_2 = [A | a4],...
This class implements a base class for all indexed-based accessors allowing a non-constant reference ...
Definition: Accessor.h:284
static T abs(const T value)
Returns the absolute value of a given value.
Definition: Numeric.h:1220
static constexpr bool isBelow(const T value, const T upper, const T epsilon=NumericT< T >::eps())
Returns whether a parameter lies on or below a given border tolerating a small epsilon.
Definition: Numeric.h:2927
This class implements a 2D triangle with Cartesian coordinates.
Definition: Triangle2.h:81
VectorT3< T > cartesian2barycentric(const VectorT2< T > &cartesian) const
Returns the barycentric coordinate of a given 2D Cartesian coordinate defined in relation to this tri...
Definition: Triangle2.h:767
bool isValid() const
Returns whether this triangle can provide valid barycentric coordinates (for 64 bit floating point va...
Definition: Triangle2.h:806
const T & y() const noexcept
Returns the y value.
Definition: Vector3.h:812
const T & x() const noexcept
Returns the x value.
Definition: Vector3.h:800
const T & z() const noexcept
Returns the z value.
Definition: Vector3.h:824
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15