Class RightEpipoleRefiner
java.lang.Object
com.irurueta.geometry.refiners.Refiner<com.irurueta.geometry.Point2D>
com.irurueta.geometry.refiners.InliersDataRefiner<com.irurueta.geometry.Point2D>
com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner<com.irurueta.geometry.Point2D,com.irurueta.geometry.Point2D,com.irurueta.geometry.Point2D>
com.irurueta.ar.epipolar.refiners.RightEpipoleRefiner
- Direct Known Subclasses:
HomogeneousRightEpipoleRefiner,InhomogeneousRightEpipoleRefiner
public abstract class RightEpipoleRefiner
extends com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner<com.irurueta.geometry.Point2D,com.irurueta.geometry.Point2D,com.irurueta.geometry.Point2D>
Base class to refine the epipole of a fundamental matrix formed by an initial
epipole estimation and an estimated homography.
Any fundamental matrix can be expressed as F = [e']x*H, where
e' is the epipole on the right view and H is a non-degenerate homography.
This class refines an initial epipole so that residuals from provided point
correspondences generating fundamental matrix F are reduced.
This class is especially useful in cases where geometry of the scene is
degenerate (e.g. planar scene) and provided point correspondences would
generate an inaccurate fundamental matrix.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.irurueta.geometry.Transformation2DHomography relating two views through a given planar scene.private doubleStandard deviation used for Levenberg-Marquardt fitting during refinement.protected final com.irurueta.geometry.Line2DTest line to compute epipolar residuals.Fields inherited from class com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner
samples1, samples2Fields inherited from class com.irurueta.geometry.refiners.InliersDataRefiner
inliers, numInliers, residualsFields inherited from class com.irurueta.geometry.refiners.Refiner
covariance, DEFAULT_KEEP_COVARIANCE, initialEstimation, keepCovariance, listener, locked -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedRightEpipoleRefiner(com.irurueta.geometry.Point2D initialEpipoleEstimation, boolean keepCovariance, com.irurueta.numerical.robust.InliersData inliersData, List<com.irurueta.geometry.Point2D> samples1, List<com.irurueta.geometry.Point2D> samples2, double refinementStandardDeviation, com.irurueta.geometry.Transformation2D homography) Constructor.protectedRightEpipoleRefiner(com.irurueta.geometry.Point2D initialEpipoleEstimation, boolean keepCovariance, BitSet inliers, double[] residuals, int numInliers, List<com.irurueta.geometry.Point2D> samples1, List<com.irurueta.geometry.Point2D> samples2, double refinementStandardDeviation, com.irurueta.geometry.Transformation2D homography) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcomputeFundamentalMatrix(com.irurueta.geometry.Transformation2D homography, com.irurueta.geometry.Point2D rightEpipole, FundamentalMatrix result) Computes a fundamental matrix from a 2D homography and provided epipole on right view.com.irurueta.geometry.Transformation2DGets homography relating samples in two views, which is used to generate a fundamental matrix and its corresponding epipolar geometry.doubleGets standard deviation used for Levenberg-Marquardt fitting during refinement.booleanisReady()Indicates whether this refiner is ready to start refinement computation.com.irurueta.geometry.Point2Drefine()Refines provided initial right epipole estimation.protected doubleresidual(FundamentalMatrix fundamentalMatrix, com.irurueta.geometry.Point2D leftPoint, com.irurueta.geometry.Point2D rightPoint) Computes the residual between a fundamental matrix and a pair of matched points.voidsetHomography(com.irurueta.geometry.Transformation2D homography) Sets homography relating samples in two views, which is used to generate a fundamental matrix and its corresponding epipolar geometry.voidsetRefinementStandardDeviation(double refinementStandardDeviation) Sets standard deviation used for Levenberg-Marquardt fitting during refinement.protected doubletotalResidual(FundamentalMatrix fundamentalMatrix) Computes total residual among all provided inlier samples.Methods inherited from class com.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner
getSamples1, getSamples2, setSamples1, setSamples2Methods inherited from class com.irurueta.geometry.refiners.InliersDataRefiner
getInliers, getNumInliers, getResiduals, getTotalSamples, setInliers, setInliersData, setNumInliers, setResidualsMethods inherited from class com.irurueta.geometry.refiners.Refiner
getCovariance, getInitialEstimation, getListener, isCovarianceKept, isLocked, refine, setCovarianceKept, setInitialEstimation, setListener
-
Field Details
-
testLine
protected final com.irurueta.geometry.Line2D testLineTest line to compute epipolar residuals. -
homography
protected com.irurueta.geometry.Transformation2D homographyHomography relating two views through a given planar scene. -
refinementStandardDeviation
private double refinementStandardDeviationStandard deviation used for Levenberg-Marquardt fitting during refinement. Returned value gives an indication of how much variance each residual has. Typically, this value is related to the threshold used on each robust estimation, since residuals of found inliers are within the range of such threshold.
-
-
Constructor Details
-
RightEpipoleRefiner
protected RightEpipoleRefiner()Constructor. -
RightEpipoleRefiner
protected RightEpipoleRefiner(com.irurueta.geometry.Point2D initialEpipoleEstimation, boolean keepCovariance, BitSet inliers, double[] residuals, int numInliers, List<com.irurueta.geometry.Point2D> samples1, List<com.irurueta.geometry.Point2D> samples2, double refinementStandardDeviation, com.irurueta.geometry.Transformation2D homography) Constructor.- Parameters:
initialEpipoleEstimation- initial right epipole estimation to be set and refined.keepCovariance- true if covariance of estimation must be kept after refinement, false otherwise.inliers- set indicating which of the provided matches are inliers.residuals- residuals for matched samples.numInliers- number of inliers on initial estimation.samples1- 1st set of paired samples.samples2- 2nd set of paired samples.refinementStandardDeviation- standard deviation used for Levenberg-Marquardt fitting.homography- homography relating samples in two views, which is used to generate a fundamental matrix and its corresponding epipolar geometry.
-
RightEpipoleRefiner
protected RightEpipoleRefiner(com.irurueta.geometry.Point2D initialEpipoleEstimation, boolean keepCovariance, com.irurueta.numerical.robust.InliersData inliersData, List<com.irurueta.geometry.Point2D> samples1, List<com.irurueta.geometry.Point2D> samples2, double refinementStandardDeviation, com.irurueta.geometry.Transformation2D homography) Constructor.- Parameters:
initialEpipoleEstimation- initial right epipole estimation to be set and refined.keepCovariance- true if covariance of estimation must be kept after refinement, false otherwise.inliersData- inlier data, typically obtained from a robust estimator.samples1- 1st set of paired samples.samples2- 2nd set of paired samples.refinementStandardDeviation- standard deviation used for Levenberg-Marquardt fitting.homography- homography relating samples in two views, which is used to generate a fundamental matrix and its corresponding epipolar geometry.
-
-
Method Details
-
getRefinementStandardDeviation
public double getRefinementStandardDeviation()Gets standard deviation used for Levenberg-Marquardt fitting during refinement. Returned value gives an indication of how much variance each residual has. Typically, this value is related to the threshold used on each robust estimation, since residuals of found inliers are within the range of such threshold.- Returns:
- standard deviation used for refinement.
-
setRefinementStandardDeviation
public void setRefinementStandardDeviation(double refinementStandardDeviation) throws com.irurueta.geometry.estimators.LockedException Sets standard deviation used for Levenberg-Marquardt fitting during refinement. Returned value gives an indication of how much variance each residual has. Typically, this value is related to the threshold used on each robust estimation, since residuals of found inliers are within the range of such threshold.- Parameters:
refinementStandardDeviation- standard deviation used for refinement.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.
-
getHomography
public com.irurueta.geometry.Transformation2D getHomography()Gets homography relating samples in two views, which is used to generate a fundamental matrix and its corresponding epipolar geometry.- Returns:
- homography relating samples in two views.
-
setHomography
public void setHomography(com.irurueta.geometry.Transformation2D homography) throws com.irurueta.geometry.estimators.LockedException Sets homography relating samples in two views, which is used to generate a fundamental matrix and its corresponding epipolar geometry.- Parameters:
homography- homography relating samples in two views.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.
-
isReady
public boolean isReady()Indicates whether this refiner is ready to start refinement computation.- Overrides:
isReadyin classcom.irurueta.geometry.refiners.PairMatchesAndInliersDataRefiner<com.irurueta.geometry.Point2D,com.irurueta.geometry.Point2D, com.irurueta.geometry.Point2D> - Returns:
- true if refiner is ready, false otherwise.
-
refine
public com.irurueta.geometry.Point2D refine() throws com.irurueta.geometry.estimators.NotReadyException, com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.refiners.RefinerExceptionRefines provided initial right epipole estimation.- Specified by:
refinein classcom.irurueta.geometry.refiners.Refiner<com.irurueta.geometry.Point2D>- Returns:
- refined estimation.
- Throws:
com.irurueta.geometry.estimators.NotReadyException- if not enough input data has been provided.com.irurueta.geometry.estimators.LockedException- if estimator is locked because refinement is already in progress.com.irurueta.geometry.refiners.RefinerException- if refinement fails for some reason (e.g. unable to converge to a result).
-
computeFundamentalMatrix
public static void computeFundamentalMatrix(com.irurueta.geometry.Transformation2D homography, com.irurueta.geometry.Point2D rightEpipole, FundamentalMatrix result) throws InvalidFundamentalMatrixException Computes a fundamental matrix from a 2D homography and provided epipole on right view.- Parameters:
homography- a 2D homography. Must be invertible.rightEpipole- epipole on right view.result- instance where computed fundamental matrix will be stored.- Throws:
InvalidFundamentalMatrixException- if provided homography is not invertible, which would generate a degenerate fundamental matrix.
-
residual
protected double residual(FundamentalMatrix fundamentalMatrix, com.irurueta.geometry.Point2D leftPoint, com.irurueta.geometry.Point2D rightPoint) Computes the residual between a fundamental matrix and a pair of matched points.- Parameters:
fundamentalMatrix- a fundamental matrix.leftPoint- left 2D point.rightPoint- right 2D point.- Returns:
- residual (distance of point to epipolar line).
-
totalResidual
Computes total residual among all provided inlier samples.- Parameters:
fundamentalMatrix- a fundamental matrix.- Returns:
- total residual.
-