Package com.irurueta.ar.epipolar
Class EssentialMatrix
java.lang.Object
com.irurueta.ar.epipolar.FundamentalMatrix
com.irurueta.ar.epipolar.EssentialMatrix
- All Implemented Interfaces:
Serializable
The essential matrix defines the relation between two views in a similar way
that the fundamental matrix does, but taking into account the intrinsic
parameters of the cameras associated to both views. That ways the relation
between their extrinsic parameters (rotation and translation) can be precisely
obtained.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Default threshold to determine that the two non-zero singular values are equal.private boolean
private com.irurueta.geometry.Rotation3D
private com.irurueta.geometry.Rotation3D
private com.irurueta.geometry.Point2D
private com.irurueta.geometry.Point2D
Fields inherited from class com.irurueta.ar.epipolar.FundamentalMatrix
FUNDAMENTAL_MATRIX_COLS, FUNDAMENTAL_MATRIX_RANK, FUNDAMENTAL_MATRIX_ROWS, internalMatrix, leftEpipole, normalized, rightEpipole
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.EssentialMatrix
(com.irurueta.algebra.Matrix internalMatrix) Constructor.EssentialMatrix
(com.irurueta.algebra.Matrix internalMatrix, double singularValuesThreshold) Constructor.EssentialMatrix
(FundamentalMatrix fundamentalMatrix, com.irurueta.geometry.PinholeCameraIntrinsicParameters leftIntrinsicParameters, com.irurueta.geometry.PinholeCameraIntrinsicParameters rightIntrinsicParameters) Constructor from fundamental matrix and intrinsic camera parameters.EssentialMatrix
(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) Constructor from a pair of cameras.EssentialMatrix
(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, double singularValuesThreshold) Constructor from a pair of cameras.EssentialMatrix
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation) Constructor from rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.EssentialMatrix
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation, double singularValuesThreshold) Constructor from rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.EssentialMatrix
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter) Constructor from rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.EssentialMatrix
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter, double singularValuesThreshold) Constructor from rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether possible camera rotations and translations that can generate this essential matrix have already been computed or not.void
Computes all possible camera rotations and translations that can generate this essential matrix.com.irurueta.geometry.Rotation3D
Gets first possible rotation that can generate this essential matrix.com.irurueta.geometry.Point2D
Gets first possible translation that can generate this essential matrix.com.irurueta.geometry.Rotation3D
Gets second possible rotation that can generate this essential matrix.com.irurueta.geometry.Point2D
Gets second possible translation that can generate this essential matrix.static boolean
isValidInternalMatrix
(com.irurueta.algebra.Matrix internalMatrix) Returns a boolean indicating whether provided matrix is a valid essential matrix (i.e. has size 3x3, rank 2 and two non-zero and equal singular values).static boolean
isValidInternalMatrix
(com.irurueta.algebra.Matrix internalMatrix, double singularValuesThreshold) Returns a boolean indicating whether provided matrix is a valid essential matrix (i.e. has size 3x3, rank 2 and his two non-zero singular values are equal up to provided threshold).final void
setFromFundamentalMatrixAndIntrinsics
(FundamentalMatrix fundamentalMatrix, com.irurueta.geometry.PinholeCameraIntrinsicParameters leftIntrinsicParameters, com.irurueta.geometry.PinholeCameraIntrinsicParameters rightIntrinsicParameters) Sets essential matrix from provided fundamental matrix and intrinsic camera parameters.void
setFromPairOfCameras
(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) Sets essential matrix from provided a pair of cameras.final void
setFromPairOfCameras
(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, double singularValuesThreshold) Sets essential matrix from provided a pair of cameras.void
setFromRotationAndCameraCenter
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter) Sets essential matrix from provided rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.final void
setFromRotationAndCameraCenter
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter, double singularValuesThreshold) Sets essential matrix from provided rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.void
setFromRotationAndTranslation
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation) Sets essential matrix from provided rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.final void
setFromRotationAndTranslation
(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation, double singularValuesThreshold) Sets essential matrix from provided rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.final void
setInternalMatrix
(com.irurueta.algebra.Matrix internalMatrix) Sets internal matrix associated to this instance.final void
setInternalMatrix
(com.irurueta.algebra.Matrix internalMatrix, double singularValuesThreshold) Sets internal matrix associated to this instance.toFundamentalMatrix
(com.irurueta.geometry.PinholeCameraIntrinsicParameters leftIntrinsicParameters, com.irurueta.geometry.PinholeCameraIntrinsicParameters rightIntrinsicParameters) Converts this essential matrix into a fundamental matrix by applying provided intrinsic parameters on left and right views.Methods inherited from class com.irurueta.ar.epipolar.FundamentalMatrix
areEpipolesAvailable, computeEpipoles, generateCamerasInArbitraryProjectiveSpace, generateCamerasInArbitraryProjectiveSpace, getInternalMatrix, getLeftEpipolarLine, getLeftEpipole, getRightEpipolarLine, getRightEpipole, isInternalMatrixAvailable, isNormalized, leftEpipolarLine, normalize, rightEpipolarLine, setFromHomography
-
Field Details
-
DEFAULT_SINGULAR_VALUES_THRESHOLD
public static final double DEFAULT_SINGULAR_VALUES_THRESHOLDDefault threshold to determine that the two non-zero singular values are equal.- See Also:
-
rotation1
private com.irurueta.geometry.Rotation3D rotation1 -
rotation2
private com.irurueta.geometry.Rotation3D rotation2 -
translation1
private com.irurueta.geometry.Point2D translation1 -
translation2
private com.irurueta.geometry.Point2D translation2 -
possibleRotationsAndTranslationsAvailable
private boolean possibleRotationsAndTranslationsAvailable
-
-
Constructor Details
-
EssentialMatrix
public EssentialMatrix()Constructor. -
EssentialMatrix
public EssentialMatrix(com.irurueta.algebra.Matrix internalMatrix, double singularValuesThreshold) throws InvalidEssentialMatrixException Constructor.- Parameters:
internalMatrix
- matrix to be set internally.singularValuesThreshold
- threshold to determine that both singular values are equal.- Throws:
InvalidEssentialMatrixException
- if provided matrix is not 3x3, does not have rank 2 or its two non-zero singular values are not equal up to provided threshold.IllegalArgumentException
- if provided threshold is negative.
-
EssentialMatrix
public EssentialMatrix(com.irurueta.algebra.Matrix internalMatrix) throws InvalidEssentialMatrixException Constructor.- Parameters:
internalMatrix
- matrix to be set internally.- Throws:
InvalidEssentialMatrixException
- if provided matrix is not 3x3, does not have rank 2 or its two non-zero singular values are not equal.
-
EssentialMatrix
public EssentialMatrix(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, double singularValuesThreshold) throws InvalidPairOfCamerasException Constructor from a pair of cameras.- Parameters:
leftCamera
- camera corresponding to left view.rightCamera
- camera corresponding to right view.singularValuesThreshold
- threshold to determine that both singular values of generated essential matrix are equal.- Throws:
InvalidPairOfCamerasException
- if provided cameras do not span a valid epipolar geometry (i.e. they are set in a degenerate configuration).IllegalArgumentException
- if provided threshold is negative.
-
EssentialMatrix
public EssentialMatrix(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) throws InvalidPairOfCamerasException Constructor from a pair of cameras.- Parameters:
leftCamera
- camera corresponding to left view.rightCamera
- camera corresponding to right view.- Throws:
InvalidPairOfCamerasException
- if provided cameras do not span a valid epipolar geometry (i.e. they are set in a degenerate configuration).
-
EssentialMatrix
public EssentialMatrix(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation, double singularValuesThreshold) throws InvalidRotationAndTranslationException Constructor from rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.translation
- translation of the image of world origin on right camera relative to left camera.singularValuesThreshold
- threshold to determine that both singular values of generated essential matrix are equal.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and translation yield a degenerate epipolar geometry.IllegalArgumentException
- if provided threshold is negative.
-
EssentialMatrix
public EssentialMatrix(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation) throws InvalidRotationAndTranslationException Constructor from rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.translation
- translation of the image of world origin on right camera relative to left camera.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and translation yield a degenerate epipolar geometry.
-
EssentialMatrix
public EssentialMatrix(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter, double singularValuesThreshold) throws InvalidRotationAndTranslationException Constructor from rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.cameraCenter
- camera center of right camera relative to left camera.singularValuesThreshold
- threshold to determine that both singular values of generated essential matrix are equal.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and translation yield a degenerate epipolar geometry.IllegalArgumentException
- if provided threshold is negative.
-
EssentialMatrix
public EssentialMatrix(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter) throws InvalidRotationAndTranslationException Constructor from rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.cameraCenter
- camera center of right camera relative to left camera.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and translation yield a degenerate epipolar geometry.
-
EssentialMatrix
public EssentialMatrix(FundamentalMatrix fundamentalMatrix, com.irurueta.geometry.PinholeCameraIntrinsicParameters leftIntrinsicParameters, com.irurueta.geometry.PinholeCameraIntrinsicParameters rightIntrinsicParameters) throws InvalidPairOfIntrinsicParametersException Constructor from fundamental matrix and intrinsic camera parameters.- Parameters:
fundamentalMatrix
- a fundamental matrix.leftIntrinsicParameters
- intrinsic camera parameters of left view.rightIntrinsicParameters
- intrinsic camera parameters of right view.- Throws:
InvalidPairOfIntrinsicParametersException
- if provided intrinsic parameters generate an invalid essential matrix.
-
-
Method Details
-
setInternalMatrix
public final void setInternalMatrix(com.irurueta.algebra.Matrix internalMatrix) throws InvalidEssentialMatrixException Sets internal matrix associated to this instance. This method makes a copy of provided matrix.- Overrides:
setInternalMatrix
in classFundamentalMatrix
- Parameters:
internalMatrix
- matrix to be assigned to this instance.- Throws:
InvalidEssentialMatrixException
- if provided matrix is not 3x3, does not have rank 2 or its two non-zero singular values are not equal.
-
setInternalMatrix
public final void setInternalMatrix(com.irurueta.algebra.Matrix internalMatrix, double singularValuesThreshold) throws InvalidEssentialMatrixException Sets internal matrix associated to this instance. This method makes a copy of provided matrix.- Parameters:
internalMatrix
- matrix to be assigned to this instance.singularValuesThreshold
- threshold to determine that both singular values are equal.- Throws:
IllegalArgumentException
- if provided threshold is negative.InvalidEssentialMatrixException
- if provided matrix is not 3x3, does not have rank 2 or its two non-zero singular values are not equal up to provided threshold.
-
isValidInternalMatrix
public static boolean isValidInternalMatrix(com.irurueta.algebra.Matrix internalMatrix) Returns a boolean indicating whether provided matrix is a valid essential matrix (i.e. has size 3x3, rank 2 and two non-zero and equal singular values).- Parameters:
internalMatrix
- matrix to be checked.- Returns:
- true if provided matrix is a valid essential matrix, false otherwise.
-
isValidInternalMatrix
public static boolean isValidInternalMatrix(com.irurueta.algebra.Matrix internalMatrix, double singularValuesThreshold) Returns a boolean indicating whether provided matrix is a valid essential matrix (i.e. has size 3x3, rank 2 and his two non-zero singular values are equal up to provided threshold).- Parameters:
internalMatrix
- matrix to be checked.singularValuesThreshold
- threshold to determine that both singular values are equal.- Returns:
- true if provided matrix is a valid essential matrix, false otherwise.
- Throws:
IllegalArgumentException
- if provided threshold is negative.
-
setFromPairOfCameras
public void setFromPairOfCameras(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera) throws InvalidPairOfCamerasException Sets essential matrix from provided a pair of cameras.- Overrides:
setFromPairOfCameras
in classFundamentalMatrix
- Parameters:
leftCamera
- camera corresponding to left view.rightCamera
- camera corresponding to right view.- Throws:
InvalidPairOfCamerasException
- if provided cameras do not span a valid epipolar geometry (i.e. they are set in a degenerate configuration).
-
setFromPairOfCameras
public final void setFromPairOfCameras(com.irurueta.geometry.PinholeCamera leftCamera, com.irurueta.geometry.PinholeCamera rightCamera, double singularValuesThreshold) throws InvalidPairOfCamerasException Sets essential matrix from provided a pair of cameras.- Parameters:
leftCamera
- camera corresponding to left view.rightCamera
- camera corresponding to right view.singularValuesThreshold
- threshold to determine that both singular values of generated essential matrix are equal.- Throws:
InvalidPairOfCamerasException
- if provided cameras do not span a valid epipolar geometry (i.e. they are set in a degenerate configuration).IllegalArgumentException
- if provided threshold is negative.
-
setFromRotationAndTranslation
public void setFromRotationAndTranslation(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation) throws InvalidRotationAndTranslationException Sets essential matrix from provided rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.translation
- translation of the image of world origin on right camera relative to left camera.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and translation yield a degenerate epipolar geometry.
-
setFromRotationAndTranslation
public final void setFromRotationAndTranslation(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point2D translation, double singularValuesThreshold) throws InvalidRotationAndTranslationException Sets essential matrix from provided rotation and translation of the image of world origin relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.translation
- translation of the image of world origin on right camera relative to left camera.singularValuesThreshold
- threshold to determine that both singular values of generated essential matrix are equal.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and translation yield a degenerate epipolar geometry.IllegalArgumentException
- if provided threshold is negative.
-
setFromRotationAndCameraCenter
public void setFromRotationAndCameraCenter(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter) throws InvalidRotationAndTranslationException Sets essential matrix from provided rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.cameraCenter
- camera center of right camera relative to left camera.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and camera center yield a degenerate epipolar geometry.
-
setFromRotationAndCameraCenter
public final void setFromRotationAndCameraCenter(com.irurueta.geometry.Rotation3D rotation, com.irurueta.geometry.Point3D cameraCenter, double singularValuesThreshold) throws InvalidRotationAndTranslationException Sets essential matrix from provided rotation and translation of the camera center relative to left view camera, which is assumed to be located at origin of coordinates with no rotation.- Parameters:
rotation
- rotation of right camera relative to left camera.cameraCenter
- camera center of right camera relative to left camera.singularValuesThreshold
- threshold to determine that both singular values of generated essential matrix are equal.- Throws:
InvalidRotationAndTranslationException
- if provided rotation and camera center yield a degenerate epipolar geometry.IllegalArgumentException
- if provided threshold is negative.
-
setFromFundamentalMatrixAndIntrinsics
public final void setFromFundamentalMatrixAndIntrinsics(FundamentalMatrix fundamentalMatrix, com.irurueta.geometry.PinholeCameraIntrinsicParameters leftIntrinsicParameters, com.irurueta.geometry.PinholeCameraIntrinsicParameters rightIntrinsicParameters) throws InvalidPairOfIntrinsicParametersException Sets essential matrix from provided fundamental matrix and intrinsic camera parameters.- Parameters:
fundamentalMatrix
- a fundamental matrix.leftIntrinsicParameters
- intrinsic camera parameters of left view.rightIntrinsicParameters
- intrinsic camera parameters of right view.- Throws:
InvalidPairOfIntrinsicParametersException
- if provided intrinsic parameters generate an invalid essential matrix.
-
toFundamentalMatrix
public FundamentalMatrix toFundamentalMatrix(com.irurueta.geometry.PinholeCameraIntrinsicParameters leftIntrinsicParameters, com.irurueta.geometry.PinholeCameraIntrinsicParameters rightIntrinsicParameters) throws EpipolarException Converts this essential matrix into a fundamental matrix by applying provided intrinsic parameters on left and right views. The essential matrix only contains information about rotation and translation relating two views, while fundamental matrix also contains information about the intrinsic parameters in both views. NOTE: although essential matrix is a subclass of fundamental matrix, it does not behave like a fundamental matrix.- Parameters:
leftIntrinsicParameters
- intrinsic parameters in left view.rightIntrinsicParameters
- intrinsic parameters in right view.- Returns:
- a fundamental matrix.
- Throws:
EpipolarException
- if something fails.
-
computePossibleRotationAndTranslations
Computes all possible camera rotations and translations that can generate this essential matrix.- Throws:
InvalidEssentialMatrixException
- if essential matrix contains numerically unstable values.
-
arePossibleRotationsAndTranslationsAvailable
public boolean arePossibleRotationsAndTranslationsAvailable()Indicates whether possible camera rotations and translations that can generate this essential matrix have already been computed or not.- Returns:
- true if possible camera rotations and translations have been computed, false otherwise.
-
getFirstPossibleRotation
public com.irurueta.geometry.Rotation3D getFirstPossibleRotation() throws com.irurueta.geometry.NotAvailableExceptionGets first possible rotation that can generate this essential matrix.- Returns:
- first possible rotation.
- Throws:
com.irurueta.geometry.NotAvailableException
- if possible rotation has not yet been computed.
-
getSecondPossibleRotation
public com.irurueta.geometry.Rotation3D getSecondPossibleRotation() throws com.irurueta.geometry.NotAvailableExceptionGets second possible rotation that can generate this essential matrix.- Returns:
- second possible rotation.
- Throws:
com.irurueta.geometry.NotAvailableException
- if possible rotation has not yet been computed.
-
getFirstPossibleTranslation
public com.irurueta.geometry.Point2D getFirstPossibleTranslation() throws com.irurueta.geometry.NotAvailableExceptionGets first possible translation that can generate this essential matrix.- Returns:
- first possible translation.
- Throws:
com.irurueta.geometry.NotAvailableException
- if possible translation has not yet been computed.
-
getSecondPossibleTranslation
public com.irurueta.geometry.Point2D getSecondPossibleTranslation() throws com.irurueta.geometry.NotAvailableExceptionGets second possible translation that can generate this essential matrix.- Returns:
- second possible translation.
- Throws:
com.irurueta.geometry.NotAvailableException
- if possible translation has not yet been computed.
-