8 #ifndef META_OCEAN_GEOMETRY_EPIPOLAR_GEOMETRY_H
9 #define META_OCEAN_GEOMETRY_EPIPOLAR_GEOMETRY_H
228 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);
245 static ObjectPoints triangulateImagePointsIF(
const PinholeCamera& camera1,
const HomogenousMatrix4& iFlippedPose1,
const PinholeCamera& camera2,
const HomogenousMatrix4& iFlippedPose2,
const ImagePoint* points1,
const ImagePoint* points2,
const size_t correspondences,
const Vector3& invalidObjectPoint =
Vector3(
Numeric::minValue(),
Numeric::minValue(),
Numeric::minValue()),
Indices32* invalidIndices =
nullptr);
295 static inline Line2 epipolarLine2Line(
const Vector3& line);
310 const Vector2 normal(line[0], line[1]);
311 ocean_assert(!normal.
isNull());
319 return Line2(line / normalLength);
This class implements the abstract base class for all AnyCamera objects.
Definition: AnyCamera.h:130
This class implements epipolar geometry functions.
Definition: EpipolarGeometry.h:34
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:298
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 unsigned int factorizeEssential(const SquareMatrix3 &essential, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera, const ImagePoints &leftPoints, const ImagePoints &rightPoints, HomogenousMatrix4 &transformation)
Factorizes an essential matrix into a camera pose composed of rotation and translation.
static Line2 epipolarLine2Line(const Vector3 &line)
Converts a epipolar line to a line object.
Definition: EpipolarGeometry.h:308
static SquareMatrix3 fundamental2essential(const SquareMatrix3 &fundamental, const SquareMatrix3 &leftIntrinsic, const SquareMatrix3 &rightIntrinsic)
Calculates the essential matrix by the given fundamental matrix and the two intrinsic camera matrices...
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:303
static SquareMatrix3 essentialMatrix(const HomogenousMatrix4 extrinsic)
Calculates the essential matrix by the rotation and translation between two cameras.
static SquareMatrix3 fundamental2essential(const SquareMatrix3 &fundamental, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera)
Calculates the essential matrix by the given fundamental matrix and the two cameras.
static bool epipolesFast(const SquareMatrix3 &fundamental, Vector2 &leftEpipole, Vector2 &rightEpipole)
Finds the two epipoles corresponding to a fundamental matrix.
static unsigned int solveAmbiguousTransformations(const HomogenousMatrix4 &transformation0, const HomogenousMatrix4 &transformation1, const HomogenousMatrix4 &transformation2, const HomogenousMatrix4 &transformation3, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera, const ImagePoints &leftPoints, const ImagePoints &rightPoints, HomogenousMatrix4 &transformation)
Determines one transformation from a set of four transformations with most given image point correspo...
static SquareMatrix3 essential2fundamental(const SquareMatrix3 &essential, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera)
Calculates the fundamental matrix by the given essential matrix and the two cameras.
static ObjectPoints triangulateImagePointsIF(const PinholeCamera &camera1, const HomogenousMatrix4 &iFlippedPose1, const PinholeCamera &camera2, const HomogenousMatrix4 &iFlippedPose2, const ImagePoint *points1, const ImagePoint *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 unsigned int validateTransformation(const HomogenousMatrix4 &transformation, 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 bool epipoles(const SquareMatrix3 &fundamental, Vector2 &leftEpipole, Vector2 &rightEpipole)
Determines the two epipoles corresponding to a fundamental matrix.
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 inverseFundamentalMatrix(const SquareMatrix3 &fundamental)
Returns the inverse fundamental matrix.
static SquareMatrix3 essential2fundamental(const SquareMatrix3 &essential, const SquareMatrix3 &leftIntrinsic, const SquareMatrix3 &rightIntrinsic)
Calculates the fundamental matrix by the given essential matrix and the two intrinsic camera matrices...
static ObjectPoints triangulateImagePointsIF(const ConstIndexedAccessor< HomogenousMatrix4 > &posesIF, const ConstIndexedAccessor< ImagePoints > &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 fundamentalMatrix(const ImagePoint *leftPoints, const ImagePoint *rightPoints, const size_t correspondences, SquareMatrix3 &fundamental)
Calculates the fundamental matrix by two sets of at least eight corresponding image points.
static bool factorizeEssential(const SquareMatrix3 &essential, const PinholeCamera &leftCamera, const PinholeCamera &rightCamera, const ImagePoint &leftPoint, const ImagePoint &rightPoint, HomogenousMatrix4 &transformation)
Factorizes the essential matrix into rotation and translation.
This class implements an infinite line in 2D space.
Definition: Line2.h:83
static constexpr T minValue()
Returns the min scalar value.
Definition: Numeric.h:3250
static constexpr bool isNotEqualEps(const T value)
Returns whether a value is not smaller than or equal to a small epsilon.
Definition: Numeric.h:2237
SquareMatrixT3< T > transposed() const
Returns the transposed of this matrix.
Definition: SquareMatrix3.h:1144
bool isNull() const
Returns whether this vector is a null vector up to a small epsilon.
Definition: Vector2.h:734
T length() const
Returns the length of the vector.
Definition: Vector2.h:615
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
std::vector< ImagePoint > ImagePoints
Definition of a vector holding 2D image points.
Definition: geometry/Geometry.h:123
float Scalar
Definition of a scalar type.
Definition: Math.h:128
LineT2< Scalar > Line2
Definition of the Line2 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single o...
Definition: Line2.h:21
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition: Vector3.h:22
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