Class Corrector

java.lang.Object
com.irurueta.ar.epipolar.Corrector
Direct Known Subclasses:
GoldStandardCorrector, SampsonCorrector

public abstract class Corrector extends Object
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 Details

    • DEFAULT_TYPE

      public static final CorrectorType DEFAULT_TYPE
      Default corrector type.
    • DEFAULT_PROGRESS_DELTA

      public static final float DEFAULT_PROGRESS_DELTA
      Default 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_DELTA
      Minimum allowed value for progress delta.
      See Also:
    • MAX_PROGRESS_DELTA

      public static final float MAX_PROGRESS_DELTA
      Maximum allowed value for progress delta.
      See Also:
    • fundamentalMatrix

      protected FundamentalMatrix fundamentalMatrix
      A fundamental matrix defining an epipolar geometry.
    • leftPoints

      protected List<com.irurueta.geometry.Point2D> leftPoints
      List of points on left view to be corrected.
    • rightPoints

      protected List<com.irurueta.geometry.Point2D> rightPoints
      List of points on right view to be corrected.
    • leftCorrectedPoints

      protected List<com.irurueta.geometry.Point2D> leftCorrectedPoints
      List of points on left view after correction.
    • rightCorrectedPoints

      protected List<com.irurueta.geometry.Point2D> rightCorrectedPoints
      List of points on right view after correction.
    • listener

      protected CorrectorListener listener
      Listener to notify start, stop and progress events.
    • locked

      protected boolean locked
      Indicates whether this instance is locked or not while doing computations.
    • progressDelta

      protected float progressDelta
      Amount of progress variation before notifying a progress change during estimation.
  • Constructor Details

    • Corrector

      protected Corrector()
      Constructor.
    • Corrector

      protected Corrector(FundamentalMatrix fundamentalMatrix)
      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

      protected Corrector(CorrectorListener listener)
      Constructor.
      Parameters:
      listener - listener to handle events generated by this class.
    • Corrector

      protected Corrector(FundamentalMatrix fundamentalMatrix, CorrectorListener listener)
      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

      public FundamentalMatrix getFundamentalMatrix()
      Returns fundamental matrix defining epipolar geometry.
      Returns:
      fundamental matrix defining epipolar geometry.
    • getLeftPoints

      public List<com.irurueta.geometry.Point2D> getLeftPoints()
      Returns list of points to be corrected on left view.
      Returns:
      list of points to be corrected on left view.
    • getRightPoints

      public List<com.irurueta.geometry.Point2D> 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

      public List<com.irurueta.geometry.Point2D> getLeftCorrectedPoints()
      Returns list of points on left view obtained after correction.
      Returns:
      list of points on left view obtained after correction.
    • getRightCorrectedPoints

      public List<com.irurueta.geometry.Point2D> 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

      public CorrectorListener 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, CorrectionException
      Corrects 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

      public abstract CorrectorType getType()
      Gets type of correction being used.
      Returns:
      type of correction.
    • create

      public static Corrector create(CorrectorType type)
      Creates an instance of a corrector using provided type.
      Parameters:
      type - a corrector type.
      Returns:
      an instance of a corrector.
    • create

      public static Corrector create(FundamentalMatrix fundamentalMatrix, CorrectorType type)
      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

      public static Corrector create(CorrectorListener listener, CorrectorType type)
      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

      public static Corrector create(CorrectorListener listener)
      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

      public static Corrector create(FundamentalMatrix fundamentalMatrix, CorrectorListener listener)
      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

      public static Corrector create()
      Creates an instance of a corrector using default type.
      Returns:
      an instance of a corrector.
    • create

      public static Corrector create(FundamentalMatrix fundamentalMatrix)
      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

      private void internalSetFundamentalMatrix(FundamentalMatrix fundamentalMatrix)
      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.