8#ifndef META_OCEAN_GEOMETRY_EPIPOLAR_GEOMETRY_H
9#define META_OCEAN_GEOMETRY_EPIPOLAR_GEOMETRY_H
240 static Vectors3 triangulateImagePoints(
const HomogenousMatrix4& world_T_cameraA,
const HomogenousMatrix4& world_T_cameraB,
const AnyCamera& anyCameraA,
const AnyCamera& anyCameraB,
const Vector2* imagePointsA,
const Vector2* imagePointsB,
const size_t numberPoints,
const bool onlyFrontObjectPoints =
true,
const Vector3& invalidObjectPoint =
Vector3(Numeric::minValue(), Numeric::minValue(), Numeric::minValue()),
Indices32* invalidIndices =
nullptr);
257 static ObjectPoints triangulateImagePointsIF(
const PinholeCamera& camera1,
const HomogenousMatrix4& iFlippedPose1,
const PinholeCamera& camera2,
const HomogenousMatrix4& iFlippedPose2,
const Vector2* points1,
const Vector2* points2,
const size_t correspondences,
const Vector3& invalidObjectPoint =
Vector3(Numeric::minValue(), Numeric::minValue(), Numeric::minValue()),
Indices32* invalidIndices =
nullptr);
288 template <
bool tRaysAreFlipped>
309 static inline Line2 epipolarLine2Line(
const Vector3& line);
329 const Vector2 normal(line[0], line[1]);
330 ocean_assert(!normal.
isNull());
338 return Line2(line / normalLength);
This class implements the abstract base class for all AnyCamera objects.
Definition AnyCamera.h:130
This class implements a base class for all indexed-based accessors allowing a constant reference acce...
Definition Accessor.h:241
This class implements epipolar geometry functions.
Definition EpipolarGeometry.h:33
static bool fundamentalMatrix(const Vector2 *leftPoints, const Vector2 *rightPoints, const size_t correspondences, SquareMatrix3 &right_F_left)
Calculates the fundamental matrix based on corresponding image points in a 'left' and in a 'right' ca...
static Line2 leftEpipolarLine(const SquareMatrix3 &fundamental, const Vector2 &rightPoint)
Returns the epipolar line in the left image corresponding to a given point in the right image.
Definition EpipolarGeometry.h:317
static Vectors3 triangulateImagePoints(const HomogenousMatrix4 &world_T_cameraA, const HomogenousMatrix4 &world_T_cameraB, const AnyCamera &anyCameraA, const AnyCamera &anyCameraB, const Vector2 *imagePointsA, const Vector2 *imagePointsB, const size_t numberPoints, const bool onlyFrontObjectPoints=true, const Vector3 &invalidObjectPoint=Vector3(Numeric::minValue(), Numeric::minValue(), Numeric::minValue()), Indices32 *invalidIndices=nullptr)
Calculates the 3D positions for a pair of image point correspondences with corresponding extrinsic ca...
static bool epipoles(const HomogenousMatrix4 &extrinsic, const SquareMatrix3 &leftIntrinsic, const SquareMatrix3 &rightIntrinsic, Vector2 &leftEpipole, Vector2 &rightEpipole)
Determines the two epipoles corresponding to two cameras separated by an extrinsic camera matrix.
static Line2 epipolarLine2Line(const Vector3 &line)
Converts a epipolar line to a line object.
Definition EpipolarGeometry.h:327
static bool essentialMatrix(const Vector3 *leftImageRays, const Vector3 *rightImageRays, const size_t correspondences, SquareMatrix3 &normalizedRight_E_normalizedLeft)
Calculates the essential matrix based on corresponding viewing rays from the 'left' and 'right' camer...
static Line2 rightEpipolarLine(const SquareMatrix3 &fundamental, const Vector2 &leftPoint)
Returns the epipolar line in the right image corresponding to a given point in the left image.
Definition EpipolarGeometry.h:322
static SquareMatrix3 reverseFundamentalMatrix(const SquareMatrix3 &right_F_left)
Returns the reverted fundamental matrix.
Definition EpipolarGeometry.h:312
static bool essentialMatrix(const Vector3 *leftImageRays, const Vector3 *rightImageRays, const size_t correspondences, SquareMatrix3 &normalizedRight_E_normalizedLeft)
Calculates the essential matrix based on corresponding viewing rays from the 'left' and 'right' camer...
static bool epipoles(const SquareMatrix3 &right_F_left, Vector2 &leftEpipole, Vector2 &rightEpipole)
Determines the two epipoles corresponding to a fundamental matrix.
static ObjectPoints triangulateImagePointsIF(const ConstIndexedAccessor< HomogenousMatrix4 > &posesIF, const ConstIndexedAccessor< Vectors2 > &imagePointsPerPose, const PinholeCamera *pinholeCamera=nullptr, const Vector3 &invalidObjectPoint=Vector3(Numeric::minValue(), Numeric::minValue(), Numeric::minValue()), Indices32 *invalidIndices=nullptr)
Calculates the 3D positions for a set of image point correspondences in multiple views with correspon...
static bool epipolesFast(const SquareMatrix3 &fundamental, Vector2 &leftEpipole, Vector2 &rightEpipole)
Finds the two epipoles corresponding to a fundamental matrix.
static SquareMatrix3 essential2fundamental(const SquareMatrix3 &normalizedRight_E_normalizedLeft, const SquareMatrix3 &leftIntrinsic, const SquareMatrix3 &rightIntrinsic)
Calculates the fundamental matrix from a given essential matrix and the two intrinsic camera matrices...
static size_t validateCameraPose(const HomogenousMatrix4 &leftCamera_T_rightCamera, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera, const Vector2 *leftPoints, const Vector2 *rightPoints, const size_t correspondences)
Returns the number of 3D object points lying in front of two cameras for a given transformation betwe...
static SquareMatrix3 fundamental2essential(const SquareMatrix3 &right_F_left, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera)
Calculates the essential matrix by the given fundamental matrix and the two cameras.
static SquareMatrix3 essentialMatrix(const HomogenousMatrix4 &rightCamera_T_leftCamera)
Calculates the essential matrix based on 6-DOF camera pose between two cameras.
static bool essentialMatrixF(const Vector3 *flippedLeftImageRays, const Vector3 *flippedRightImageRays, const size_t correspondences, SquareMatrix3 &normalizedRight_E_normalizedLeft)
Calculates the essential matrix based on corresponding viewing rays from the 'left' and 'right' camer...
static SquareMatrix3 essential2fundamental(const SquareMatrix3 &normalizedRight_E_normalizedLeft, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera)
Calculates the fundamental matrix from a given essential matrix and the two intrinsic camera matrices...
static bool rectificationHomography(const HomogenousMatrix4 &transformation, const PinholeCamera &pinholeCamera, SquareMatrix3 &leftHomography, SquareMatrix3 &rightHomography, Quaternion &appliedRotation, PinholeCamera *newCamera)
Determines the homograph for two (stereo) frames rectifying both images using the transformation betw...
static SquareMatrix3 fundamental2essential(const SquareMatrix3 &right_F_left, const SquareMatrix3 &leftIntrinsic, const SquareMatrix3 &rightIntrinsic)
Calculates the essential matrix from a given fundamental matrix and the two intrinsic camera matrices...
static ObjectPoints triangulateImagePointsIF(const PinholeCamera &camera1, const HomogenousMatrix4 &iFlippedPose1, const PinholeCamera &camera2, const HomogenousMatrix4 &iFlippedPose2, const Vector2 *points1, const Vector2 *points2, const size_t correspondences, const Vector3 &invalidObjectPoint=Vector3(Numeric::minValue(), Numeric::minValue(), Numeric::minValue()), Indices32 *invalidIndices=nullptr)
Calculates the 3D positions for a set of image point correspondences with corresponding poses (Rt) in...
static size_t factorizeEssential(const SquareMatrix3 &normalizedRight_E_normalizedLeft, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera, const Vector2 *leftPoints, const Vector2 *rightPoints, const size_t correspondences, HomogenousMatrix4 &left_T_right)
Factorizes an essential matrix into a 6-DOF camera pose composed of rotation and translation.
This class implements an infinite line in 2D space.
Definition Line2.h:83
static constexpr bool isNotEqualEps(const T value)
Returns whether a value is not smaller than or equal to a small epsilon.
Definition Numeric.h:2246
SquareMatrixT3< T > transposed() const
Returns the transposed of this matrix.
Definition SquareMatrix3.h:1145
bool isNull() const
Returns whether this vector is a null vector up to a small epsilon.
Definition Vector2.h:746
T length() const
Returns the length of the vector.
Definition Vector2.h:627
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition Base.h:96
std::vector< ObjectPoint > ObjectPoints
Definition of a vector holding 3D object points.
Definition geometry/Geometry.h:129
LineT2< Scalar > Line2
Definition of the Line2 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single o...
Definition Line2.h:28
float Scalar
Definition of a scalar type.
Definition Math.h:129
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition Vector3.h:65
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition Vector3.h:29
The namespace covering the entire Ocean framework.
Definition Accessor.h:15