Package com.irurueta.ar.epipolar
Class Corrector
java.lang.Object
com.irurueta.ar.epipolar.Corrector
- Direct Known Subclasses:
GoldStandardCorrector,SampsonCorrector
Fixes matched pairs of points so that they perfectly follow a given epipolar
geometry.
When matching points typically the matching precision is about 1 pixel,
however this makes that matched points under a given epipolar geometry (i.e.
fundamental or essential matrix), do not lie perfectly on the corresponding
epipolar plane or epipolar lines.
The consequence is that triangularization of these matches will fail or
produce inaccurate results.
By fixing matched points using a corrector following a given epipolar
geometry, this effect is alleviated.
This is an abstract class, subclasses will implement different methods to
fix matched points coordinates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatDefault amount of progress variation before notifying a change in estimation progress.static final CorrectorTypeDefault corrector type.protected FundamentalMatrixA fundamental matrix defining an epipolar geometry.protected List<com.irurueta.geometry.Point2D> List of points on left view after correction.protected List<com.irurueta.geometry.Point2D> List of points on left view to be corrected.protected CorrectorListenerListener to notify start, stop and progress events.protected booleanIndicates whether this instance is locked or not while doing computations.static final floatMaximum allowed value for progress delta.static final floatMinimum allowed value for progress delta.protected floatAmount of progress variation before notifying a progress change during estimation.protected List<com.irurueta.geometry.Point2D> List of points on right view after correction.protected List<com.irurueta.geometry.Point2D> List of points on right view to be corrected. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedCorrector(CorrectorListener listener) Constructor.protectedCorrector(FundamentalMatrix fundamentalMatrix) Constructor.protectedCorrector(FundamentalMatrix fundamentalMatrix, CorrectorListener listener) Constructor.protectedCorrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor.protectedCorrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorListener listener) Constructor.protectedCorrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix) Constructor.protectedCorrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareValidPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Indicates whether provided lists of points to be corrected on left and right views are valid.abstract voidcorrect()Corrects the lists of provided matched points to be corrected.static Correctorcreate()Creates an instance of a corrector using default type.static Correctorcreate(CorrectorListener listener) Creates an instance of a corrector using default type.static Correctorcreate(CorrectorListener listener, CorrectorType type) Creates an instance of a corrector using provided type.static Correctorcreate(CorrectorType type) Creates an instance of a corrector using provided type.static Correctorcreate(FundamentalMatrix fundamentalMatrix) Creates an instance of a corrector using provided fundamental matrix and default type.static Correctorcreate(FundamentalMatrix fundamentalMatrix, CorrectorListener listener) Creates an instance of a corrector using provided fundamental matrix and default type.static Correctorcreate(FundamentalMatrix fundamentalMatrix, CorrectorListener listener, CorrectorType type) Creates an instance of a corrector using provided fundamental matrix and provided type.static Correctorcreate(FundamentalMatrix fundamentalMatrix, CorrectorType type) Creates an instance of a corrector using provided fundamental matrix and provided type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Creates an instance of a corrector using provided left and right points to be corrected and default type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorListener listener) Creates an instance of a corrector using provided left and right points to be corrected and provided type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorListener listener, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected and provided type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected and provided type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and default type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorListener listener) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and provided type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorListener listener, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and provided type.static Correctorcreate(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and provided type.Returns fundamental matrix defining epipolar geometry.List<com.irurueta.geometry.Point2D> Returns list of points on left view obtained after correction.List<com.irurueta.geometry.Point2D> Returns list of points to be corrected on left view.Returns listener to handle events generated by this class.floatReturns amount of progress variation before notifying a progress change during estimation.List<com.irurueta.geometry.Point2D> Returns list of points on right view obtained after correction.List<com.irurueta.geometry.Point2D> Returns list of points to be corrected on right view.abstract CorrectorTypegetType()Gets type of correction being used.private voidinternalSetFundamentalMatrix(FundamentalMatrix fundamentalMatrix) Internal method to set fundamental matrix defining the epipolar geometry.private voidinternalSetLeftAndRightPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Internal method to set lists of points to be corrected on left and right views.booleanisLocked()Returns boolean indicating whether this instance is locked or not doing computations.booleanisReady()Indicates whether this instance is ready to correct provided left and right points using provided fundamental matrix.final voidsetFundamentalMatrix(FundamentalMatrix fundamentalMatrix) Sets the fundamental matrix defining the epipolar geometry.voidsetLeftAndRightPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Sets lists of points to be corrected on left and right views.voidsetListener(CorrectorListener listener) Sets listener to handle events generated by this class.voidsetPointsAndFundamentalMatrix(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix) Sets lists of points to be corrected on left and right views and fundamental matrix defining epipolar geometry.voidsetProgressDelta(float progressDelta) Sets amount of progress variation before notifying a progress change during estimation.
-
Field Details
-
DEFAULT_TYPE
Default corrector type. -
DEFAULT_PROGRESS_DELTA
public static final float DEFAULT_PROGRESS_DELTADefault amount of progress variation before notifying a change in estimation progress. By default, this is set to 5%.- See Also:
-
MIN_PROGRESS_DELTA
public static final float MIN_PROGRESS_DELTAMinimum allowed value for progress delta.- See Also:
-
MAX_PROGRESS_DELTA
public static final float MAX_PROGRESS_DELTAMaximum allowed value for progress delta.- See Also:
-
fundamentalMatrix
A fundamental matrix defining an epipolar geometry. -
leftPoints
List of points on left view to be corrected. -
rightPoints
List of points on right view to be corrected. -
leftCorrectedPoints
List of points on left view after correction. -
rightCorrectedPoints
List of points on right view after correction. -
listener
Listener to notify start, stop and progress events. -
locked
protected boolean lockedIndicates whether this instance is locked or not while doing computations. -
progressDelta
protected float progressDeltaAmount of progress variation before notifying a progress change during estimation.
-
-
Constructor Details
-
Corrector
protected Corrector()Constructor. -
Corrector
Constructor.- Parameters:
fundamentalMatrix- fundamental matrix to be set.
-
Corrector
protected Corrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Constructor.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
Corrector
protected Corrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix) Constructor.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.fundamentalMatrix- fundamental matrix to be set.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
Corrector
Constructor.- Parameters:
listener- listener to handle events generated by this class.
-
Corrector
Constructor.- Parameters:
fundamentalMatrix- fundamental matrix to be set.listener- listener to handle events generated by this class.
-
Corrector
protected Corrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorListener listener) Constructor.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.listener- listener to handle events generated by this class.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
Corrector
protected Corrector(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorListener listener) Constructor.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.fundamentalMatrix- fundamental matrix to be set.listener- listener to handle events generated by this class.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-
-
Method Details
-
setFundamentalMatrix
public final void setFundamentalMatrix(FundamentalMatrix fundamentalMatrix) throws com.irurueta.geometry.estimators.LockedException Sets the fundamental matrix defining the epipolar geometry.- Parameters:
fundamentalMatrix- fundamental matrix to be set.- Throws:
com.irurueta.geometry.estimators.LockedException- if this instance is locked.
-
getFundamentalMatrix
Returns fundamental matrix defining epipolar geometry.- Returns:
- fundamental matrix defining epipolar geometry.
-
getLeftPoints
Returns list of points to be corrected on left view.- Returns:
- list of points to be corrected on left view.
-
getRightPoints
Returns list of points to be corrected on right view.- Returns:
- list of points to be corrected on right view.
-
setLeftAndRightPoints
public void setLeftAndRightPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) throws com.irurueta.geometry.estimators.LockedException Sets lists of points to be corrected on left and right views.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.com.irurueta.geometry.estimators.LockedException- if instance is locked doing computations.
-
setPointsAndFundamentalMatrix
public void setPointsAndFundamentalMatrix(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix) throws com.irurueta.geometry.estimators.LockedException Sets lists of points to be corrected on left and right views and fundamental matrix defining epipolar geometry.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.fundamentalMatrix- fundamental matrix to be set.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.com.irurueta.geometry.estimators.LockedException- if instance is locked doing computations.
-
getLeftCorrectedPoints
Returns list of points on left view obtained after correction.- Returns:
- list of points on left view obtained after correction.
-
getRightCorrectedPoints
Returns list of points on right view obtained after correction.- Returns:
- list of points on right view obtained after correction.
-
isLocked
public boolean isLocked()Returns boolean indicating whether this instance is locked or not doing computations.- Returns:
- true if instance is locked, false otherwise.
-
getProgressDelta
public float getProgressDelta()Returns amount of progress variation before notifying a progress change during estimation.- Returns:
- amount of progress variation before notifying a progress change during estimation.
-
setProgressDelta
public void setProgressDelta(float progressDelta) throws com.irurueta.geometry.estimators.LockedException Sets amount of progress variation before notifying a progress change during estimation.- Parameters:
progressDelta- amount of progress variation before notifying a progress change during estimation.- Throws:
IllegalArgumentException- if progress delta is less than zero or greater than 1.com.irurueta.geometry.estimators.LockedException- if this estimator is locked because an estimation is being computed.
-
getListener
Returns listener to handle events generated by this class.- Returns:
- listener to handle events generated by this class.
-
setListener
public void setListener(CorrectorListener listener) throws com.irurueta.geometry.estimators.LockedException Sets listener to handle events generated by this class.- Parameters:
listener- listener to handle events generated by this class.- Throws:
com.irurueta.geometry.estimators.LockedException- if this estimator is locked because an estimation is being computed.
-
areValidPoints
public static boolean areValidPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Indicates whether provided lists of points to be corrected on left and right views are valid. Lists are valid when both have the same size.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.- Returns:
- true if lists of points are valid, false otherwise.
-
isReady
public boolean isReady()Indicates whether this instance is ready to correct provided left and right points using provided fundamental matrix.- Returns:
- true if ready, false otherwise.
-
correct
public abstract void correct() throws com.irurueta.geometry.estimators.NotReadyException, com.irurueta.geometry.estimators.LockedException, CorrectionExceptionCorrects the lists of provided matched points to be corrected.- Throws:
com.irurueta.geometry.estimators.NotReadyException- if this instance is not ready (either points or fundamental matrix has not been provided yet).com.irurueta.geometry.estimators.LockedException- if this instance is locked doing computations.CorrectionException- if correction fails.
-
getType
Gets type of correction being used.- Returns:
- type of correction.
-
create
Creates an instance of a corrector using provided type.- Parameters:
type- a corrector type.- Returns:
- an instance of a corrector.
-
create
Creates an instance of a corrector using provided fundamental matrix and provided type.- Parameters:
fundamentalMatrix- fundamental matrix defining the epipolar geometry.type- a corrector type.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected and provided type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.type- a corrector type.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and provided type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.fundamentalMatrix- fundamental matrix defining the epipolar geometry.type- a corrector type.- Returns:
- an instance of a corrector.
-
create
Creates an instance of a corrector using provided type.- Parameters:
listener- listener to handle events generated by this class.type- a corrector type.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(FundamentalMatrix fundamentalMatrix, CorrectorListener listener, CorrectorType type) Creates an instance of a corrector using provided fundamental matrix and provided type.- Parameters:
fundamentalMatrix- fundamental matrix defining the epipolar geometry.listener- listener to handle events generated by this class.type- a corrector type.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorListener listener, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected and provided type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.listener- listener to handle events generated by this class.type- a corrector type.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorListener listener, CorrectorType type) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and provided type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.fundamentalMatrix- fundamental matrix defining the epipolar geometry.listener- listener to handle events generated by this class.type- a corrector type.- Returns:
- an instance of a corrector.
-
create
Creates an instance of a corrector using default type.- Parameters:
listener- listener to handle events generated by this class.- Returns:
- an instance of a corrector.
-
create
Creates an instance of a corrector using provided fundamental matrix and default type.- Parameters:
fundamentalMatrix- fundamental matrix defining the epipolar geometry.listener- listener to handle events generated by this class.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, CorrectorListener listener) Creates an instance of a corrector using provided left and right points to be corrected and provided type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.listener- listener to handle events generated by this class.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix, CorrectorListener listener) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and provided type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.fundamentalMatrix- fundamental matrix defining the epipolar geometry.listener- listener to handle events generated by this class.- Returns:
- an instance of a corrector.
-
create
Creates an instance of a corrector using default type.- Returns:
- an instance of a corrector.
-
create
Creates an instance of a corrector using provided fundamental matrix and default type.- Parameters:
fundamentalMatrix- fundamental matrix defining the epipolar geometry.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Creates an instance of a corrector using provided left and right points to be corrected and default type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.- Returns:
- an instance of a corrector.
-
create
public static Corrector create(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints, FundamentalMatrix fundamentalMatrix) Creates an instance of a corrector using provided left and right points to be corrected, provided fundamental matrix and default type.- Parameters:
leftPoints- matched points on left view to be corrected.rightPoints- matched points on right view to be corrected.fundamentalMatrix- fundamental matrix defining the epipolar geometry.- Returns:
- an instance of a corrector.
-
internalSetFundamentalMatrix
Internal method to set fundamental matrix defining the epipolar geometry.- Parameters:
fundamentalMatrix- fundamental matrix to be set.
-
internalSetLeftAndRightPoints
private void internalSetLeftAndRightPoints(List<com.irurueta.geometry.Point2D> leftPoints, List<com.irurueta.geometry.Point2D> rightPoints) Internal method to set lists of points to be corrected on left and right views.- Parameters:
leftPoints- points to be corrected on left view.rightPoints- points to be corrected on right view.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size.
-