Class SevenPointsFundamentalMatrixEstimator
java.lang.Object
com.irurueta.ar.epipolar.estimators.FundamentalMatrixEstimator
com.irurueta.ar.epipolar.estimators.SevenPointsFundamentalMatrixEstimator
Non-robust fundamental matrix estimator that uses 7 matched 2D points on
left and right views.
Although this algorithm requires one less point than the 8 points algorithm,
it might return up to three different fundamental matrices that must be
later checked (i.e. using a robust algorithm to maximize inliers) so that
the correct solution is picked.
If the correct solution is found, it typically obtains results with higher
accuracy than the 8 points algorithm, because rank-2 is not approximated
using SVD, and rather it is accurately enforced.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIndicates whether an LMSE (the Least Mean Square Error) solution is allowed or not.static final booleanConstant indicating that by default an LMSE solution is not allowed.static final booleanIndicates if by default provided point correspondences are normalized to increase the accuracy of the estimation.static final doubleTiniest value closest to zero.static final intMinimum number of matched 2D points to start the estimation.private booleanIndicates whether provided matched 2D points must be normalized to increase the accuracy of the estimation.Fields inherited from class com.irurueta.ar.epipolar.estimators.FundamentalMatrixEstimator
DEFAULT_METHOD, leftPoints, listener, locked, rightPoints -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.SevenPointsFundamentalMatrixEstimator(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor with matched 2D points. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether provided matched 2D points must be normalized to increase the accuracy of the estimation.private voidcomputeParams(double a, double b, double c, double d, double e, double f, double[] out) Computes parameters of third degree polynomial to obtain possible solutions.private booleanenforceRank2(com.irurueta.algebra.Matrix matrix, com.irurueta.algebra.SingularValueDecomposer decomposer) Enforces rank 2 into provided matrix.estimate()Estimates a fundamental matrix using provided lists of matched points on left and right views.Estimates all possible fundamental matrices found using provided points.voidestimateAll(List<FundamentalMatrix> result) Estimates all possible fundamental matrices found using provided points and adds the result to provided result list.Returns method of non-robust fundamental matrix estimator.intReturns minimum number of matched pair of points required to start the estimation.booleanReturns boolean indicating whether an LMSE (the Least Mean Square Error) solution is allowed or not.booleanisReady()Returns boolean indicating whether estimator is ready to start the fundamental matrix estimation.voidsetLMSESolutionAllowed(boolean allowed) Sets boolean indicating whether an LMSE (the Least Mean Square Error) solution is allowed or not.voidsetPointsNormalized(boolean normalizePoints) Sets boolean indicating whether provided matched 2D points must be normalized to increase the accuracy of the estimation.Methods inherited from class com.irurueta.ar.epipolar.estimators.FundamentalMatrixEstimator
create, create, create, create, getLeftPoints, getListener, getRightPoints, isLocked, setListener, setPoints
-
Field Details
-
DEFAULT_ALLOW_LMSE_SOLUTION
public static final boolean DEFAULT_ALLOW_LMSE_SOLUTIONConstant indicating that by default an LMSE solution is not allowed.- See Also:
-
MIN_REQUIRED_POINTS
public static final int MIN_REQUIRED_POINTSMinimum number of matched 2D points to start the estimation.- See Also:
-
DEFAULT_NORMALIZE_POINT_CORRESPONDENCES
public static final boolean DEFAULT_NORMALIZE_POINT_CORRESPONDENCESIndicates if by default provided point correspondences are normalized to increase the accuracy of the estimation.- See Also:
-
EPS
public static final double EPSTiniest value closest to zero.- See Also:
-
allowLMSESolution
private boolean allowLMSESolutionIndicates whether an LMSE (the Least Mean Square Error) solution is allowed or not. When an LMSE solution is allowed, more than 7 matched points can be used for fundamental matrix estimation. If LMSE solution is not allowed then only the 7 former matched points will be taken into account. -
normalizePoints
private boolean normalizePointsIndicates whether provided matched 2D points must be normalized to increase the accuracy of the estimation.
-
-
Constructor Details
-
SevenPointsFundamentalMatrixEstimator
public SevenPointsFundamentalMatrixEstimator()Constructor. -
SevenPointsFundamentalMatrixEstimator
public SevenPointsFundamentalMatrixEstimator(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor with matched 2D points.- Parameters:
leftPoints- 2D points on left view.rightPoints- 2D points on right view.- Throws:
IllegalArgumentException- if provided list of points do not have the same length.
-
-
Method Details
-
isLMSESolutionAllowed
public boolean isLMSESolutionAllowed()Returns boolean indicating whether an LMSE (the Least Mean Square Error) solution is allowed or not. When an LMSE solution is allowed, more than 8 matched points can be used for fundamental matrix estimation. If LMSE solution is not allowed then only the 7 former matched points will be taken into account.- Returns:
- true if an LMSE solution is allowed, false otherwise.
-
setLMSESolutionAllowed
public void setLMSESolutionAllowed(boolean allowed) throws com.irurueta.geometry.estimators.LockedException Sets boolean indicating whether an LMSE (the Least Mean Square Error) solution is allowed or not. When an LMSE solution is allowed, more than 8 matched points can be used for fundamental matrix estimation. If LMSE solution is not allowed then only the 7 former matched points will be taken into account.- Parameters:
allowed- true if an LMSE solution is allowed, false otherwise.- Throws:
com.irurueta.geometry.estimators.LockedException- if this instance is locked because an estimation is in progress.
-
arePointsNormalized
public boolean arePointsNormalized()Indicates whether provided matched 2D points must be normalized to increase the accuracy of the estimation.- Returns:
- true if points must be normalized, false otherwise.
-
setPointsNormalized
public void setPointsNormalized(boolean normalizePoints) throws com.irurueta.geometry.estimators.LockedException Sets boolean indicating whether provided matched 2D points must be normalized to increase the accuracy of the estimation.- Parameters:
normalizePoints- true if points must be normalized, false otherwise.- Throws:
com.irurueta.geometry.estimators.LockedException- if this instance is locked because an estimation is in progress.
-
isReady
public boolean isReady()Returns boolean indicating whether estimator is ready to start the fundamental matrix estimation. This is true when the required minimum number of matched points is provided to obtain a solution and both left and right views have the same number of matched points.- Specified by:
isReadyin classFundamentalMatrixEstimator- Returns:
- true if estimator is ready to start the fundamental matrix estimation, false otherwise.
-
estimateAll
public List<FundamentalMatrix> estimateAll() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, FundamentalMatrixEstimatorExceptionEstimates all possible fundamental matrices found using provided points. Because the algorithm uses 7 points and enforces rank 2 by solving a third degree polynomial, the algorithm might return 1 real solution (and 2 imaginary ones which are discarded), 3 real solutions, or 1 real solution with triple multiplicity.- Returns:
- all possible fundamental matrices found using provided points.
- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked doing an estimation.com.irurueta.geometry.estimators.NotReadyException- if estimator is not ready because required input points have not already been provided.FundamentalMatrixEstimatorException- if configuration of provided 2D points is degenerate and fundamental matrix estimation fails.
-
estimateAll
public void estimateAll(List<FundamentalMatrix> result) throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, FundamentalMatrixEstimatorException Estimates all possible fundamental matrices found using provided points and adds the result to provided result list. Because the algorithm uses 7 points and enforces rank 2 by solving a third degree polynomial, the algorithm might return 1 real solution (and 2 imaginary ones which are discarded), 3 real solutions, or 1 real solution with triple multiplicity.- Parameters:
result- list where results will be stored.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked doing an estimation.com.irurueta.geometry.estimators.NotReadyException- if estimator is not ready because required input points have not already been provided.FundamentalMatrixEstimatorException- if configuration of provided 2D points is degenerate and fundamental matrix estimation fails.
-
estimate
public FundamentalMatrix estimate() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, FundamentalMatrixEstimatorExceptionEstimates a fundamental matrix using provided lists of matched points on left and right views. This method returns a solution only if one possible solution exists. If more than one solution is available, this method will fail. Because this algorithm might return more than one solution, it is highly encouraged to use estimateAll method instead.- Specified by:
estimatein classFundamentalMatrixEstimator- Returns:
- a fundamental matrix.
- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked doing an estimation.com.irurueta.geometry.estimators.NotReadyException- if estimator is not ready because required input points have not already been provided.FundamentalMatrixEstimatorException- if configuration of provided 2D points is degenerate and fundamental matrix estimation fails or more than one solution exists.
-
getMethod
Returns method of non-robust fundamental matrix estimator.- Specified by:
getMethodin classFundamentalMatrixEstimator- Returns:
- method of fundamental matrix estimator.
-
getMinRequiredPoints
public int getMinRequiredPoints()Returns minimum number of matched pair of points required to start the estimation. This implementation requires a minimum of 7 points.- Specified by:
getMinRequiredPointsin classFundamentalMatrixEstimator- Returns:
- minimum number of matched pair of points required to start the estimation. Always returns 7.
-
enforceRank2
private boolean enforceRank2(com.irurueta.algebra.Matrix matrix, com.irurueta.algebra.SingularValueDecomposer decomposer) throws com.irurueta.algebra.AlgebraException Enforces rank 2 into provided matrix. This method modifies provided matrix.- Parameters:
matrix- matrix to be enforced to have rank 2.decomposer- an SVD decomposer.- Returns:
- false if rank was successfully enforced, true otherwise.
- Throws:
com.irurueta.algebra.AlgebraException- if an error occurs during SVD decomposition because of numerical instabilities.
-
computeParams
private void computeParams(double a, double b, double c, double d, double e, double f, double[] out) Computes parameters of third degree polynomial to obtain possible solutions.- Parameters:
a- 1st param.b- 2nd param.c- 3rd param.d- 4th param.e- 5th param.f- 6th param.out- array of length 4 where partial parameters of third degree polynomial are stored.
-