Class EpipolarDistanceFundamentalMatrixComparator

java.lang.Object
com.irurueta.ar.epipolar.FundamentalMatrixComparator
com.irurueta.ar.epipolar.EpipolarDistanceFundamentalMatrixComparator

public class EpipolarDistanceFundamentalMatrixComparator extends FundamentalMatrixComparator
Compares two fundamental matrices by estimating average epipolar distances. This class uses epipolar geometry to determine how similar fundamental matrices are. This is done by assuming a certain size on the retinal planes and generating random 2D points to obtain their associated epipolar lines and the distances of matched points to those epipolar lines This class simply computes the norm of the difference of both fundamental matrices. The smaller the value the more similar the fundamental matrices will be from a pure algebraic point of view.
  • Field Details

    • DEFAULT_MIN_X

      public static final double DEFAULT_MIN_X
      Defines default minimum horizontal coordinate when generating random samples.
      See Also:
    • DEFAULT_MAX_X

      public static final double DEFAULT_MAX_X
      Defines default maximum horizontal coordinate when generating random samples.
      See Also:
    • DEFAULT_MIN_Y

      public static final double DEFAULT_MIN_Y
      Defines default minimum vertical coordinate when generating random samples.
      See Also:
    • DEFAULT_MAX_Y

      public static final double DEFAULT_MAX_Y
      Defines default maximum vertical coordinate when generating random samples.
      See Also:
    • DEFAULT_N_SAMPLES

      public static final int DEFAULT_N_SAMPLES
      Default number of random samples to generate to compare fundamental matrices.
      See Also:
    • MIN_N_SAMPLES

      public static final int MIN_N_SAMPLES
      Minimum number of samples that must be generated to compare fundamental matrices.
      See Also:
    • DEFAULT_MIN_DISPARITY_FACTOR

      public static final double DEFAULT_MIN_DISPARITY_FACTOR
      Minimum disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      See Also:
    • DEFAULT_MAX_DISPARITY_FACTOR

      public static final double DEFAULT_MAX_DISPARITY_FACTOR
      Maximum disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      See Also:
    • DEFAULT_MAX_ITERATIONS_FACTOR

      public static final double DEFAULT_MAX_ITERATIONS_FACTOR
      Default factor to determine maximum number of iterations respect to the number of samples to compute comparison.
      See Also:
    • MIN_MAX_ITERATIONS_FACTOR

      public static final double MIN_MAX_ITERATIONS_FACTOR
      Minimum value for the factor to determine maximum number of iterations respect to the number of samples to compute comparison.
      See Also:
    • DEFAULT_PROGRESS_DELTA

      public static final float DEFAULT_PROGRESS_DELTA
      Default amount of progress variation before notifying a change in comparison 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:
    • minX

      private double minX
      Minimum horizontal coordinate when generating random samples.
    • maxX

      private double maxX
      Maximum horizontal coordinate when generating random samples.
    • minY

      private double minY
      Minimum vertical coordinate when generating random samples.
    • maxY

      private double maxY
      Maximum vertical coordinate when generating random samples.
    • nSamples

      private int nSamples
      Number of random samples to generate to compare fundamental matrices.
    • minHorizontalDisparityFactor

      private double minHorizontalDisparityFactor
      Minimum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
    • maxHorizontalDisparityFactor

      private double maxHorizontalDisparityFactor
      Maximum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
    • minVerticalDisparityFactor

      private double minVerticalDisparityFactor
      Minimum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
    • maxVerticalDisparityFactor

      private double maxVerticalDisparityFactor
      Maximum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
    • maxIterationsFactor

      private double maxIterationsFactor
      Factor to determine maximum number of iterations respect to the number of samples to compute comparison.
    • progressDelta

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

    • EpipolarDistanceFundamentalMatrixComparator

      public EpipolarDistanceFundamentalMatrixComparator()
      Constructor.
    • EpipolarDistanceFundamentalMatrixComparator

      public EpipolarDistanceFundamentalMatrixComparator(FundamentalMatrix groundTruthFundamentalMatrix, FundamentalMatrix otherFundamentalMatrix)
      Constructor.
      Parameters:
      groundTruthFundamentalMatrix - fundamental matrix to be considered as ground truth to compare against.
      otherFundamentalMatrix - other fundamental matrix being compared.
    • EpipolarDistanceFundamentalMatrixComparator

      public EpipolarDistanceFundamentalMatrixComparator(FundamentalMatrixComparatorListener listener)
      Constructor.
      Parameters:
      listener - listener to handle events generated by this class.
    • EpipolarDistanceFundamentalMatrixComparator

      public EpipolarDistanceFundamentalMatrixComparator(FundamentalMatrix groundTruthFundamentalMatrix, FundamentalMatrix otherFundamentalMatrix, FundamentalMatrixComparatorListener listener)
      Constructor.
      Parameters:
      groundTruthFundamentalMatrix - fundamental matrix to be considered as ground truth to compare against.
      otherFundamentalMatrix - other fundamental matrix being compared.
      listener - listener to handle events generated by this class.
  • Method Details

    • getMinX

      public double getMinX()
      Returns minimum horizontal coordinate when generating random samples.
      Returns:
      minimum horizontal coordinate when generating random samples.
    • getMaxX

      public double getMaxX()
      Returns maximum horizontal coordinate when generating random samples.
      Returns:
      maximum horizontal coordinate when generating random samples.
    • setMinMaxX

      public void setMinMaxX(double minX, double maxX) throws com.irurueta.geometry.estimators.LockedException
      Sets minimum and maximum horizontal coordinates when generating random samples.
      Parameters:
      minX - minimum horizontal coordinate when generating random samples.
      maxX - maximum horizontal coordinate when generating random samples.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      IllegalArgumentException - if minimum value is larger or equal than maximum one.
    • getMinY

      public double getMinY()
      Returns minimum vertical coordinate when generating random samples.
      Returns:
      minimum vertical coordinate when generating random samples.
    • getMaxY

      public double getMaxY()
      Returns maximum vertical coordinate when generating random samples.
      Returns:
      maximum vertical coordinate when generating random samples.
    • setMinMaxY

      public void setMinMaxY(double minY, double maxY) throws com.irurueta.geometry.estimators.LockedException
      Sets minimum and maximum vertical coordinates when generating random samples.
      Parameters:
      minY - minimum vertical coordinate when generating random samples.
      maxY - maximum vertical coordinate when generating random samples.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      IllegalArgumentException - if minimum value is larger or equal than maximum one.
    • getNSamples

      public int getNSamples()
      Returns number of random samples to generate to compare fundamental matrices.
      Returns:
      number of random samples to generate to compare fundamental matrices.
    • setNSamples

      public void setNSamples(int nSamples) throws com.irurueta.geometry.estimators.LockedException
      Sets number of random samples to generate to compare fundamental matrices.
      Parameters:
      nSamples - number of random samples to generate to compare fundamental matrices.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      IllegalArgumentException - if provided value is less than 1.
    • getMinHorizontalDisparityFactor

      public double getMinHorizontalDisparityFactor()
      Returns minimum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      Returns:
      minimum horizontal disparity factor.
    • getMaxHorizontalDisparityFactor

      public double getMaxHorizontalDisparityFactor()
      Returns maximum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      Returns:
      maximum horizontal disparity factor.
    • setMinMaxHorizontalDisparityFactor

      public void setMinMaxHorizontalDisparityFactor(double minHorizontalDisparityFactor, double maxHorizontalDisparityFactor) throws com.irurueta.geometry.estimators.LockedException
      Sets minimum and maximum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      Parameters:
      minHorizontalDisparityFactor - minimum horizontal disparity factor.
      maxHorizontalDisparityFactor - maximum horizontal disparity factor.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      IllegalArgumentException - if minimum value is larger or equal than maximum one.
    • getMinVerticalDisparityFactor

      public double getMinVerticalDisparityFactor()
      Returns minimum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      Returns:
      minimum vertical disparity factor.
    • getMaxVerticalDisparityFactor

      public double getMaxVerticalDisparityFactor()
      Returns maximum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      Returns:
      maximum vertical disparity factor.
    • setMinMaxVerticalDisparityFactor

      public void setMinMaxVerticalDisparityFactor(double minVerticalDisparityFactor, double maxVerticalDisparityFactor) throws com.irurueta.geometry.estimators.LockedException
      Sets minimum and maximum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates. When computing residuals, matched samples are created along the corresponding epipolar lines with a random disparity within provided range of disparities, and then the epipolar line for the randomly generated matched sample is generated on the original view to determine the distance to such line and the original sample.
      Parameters:
      minVerticalDisparityFactor - minimum vertical disparity factor.
      maxVerticalDisparityFactor - maximum vertical disparity factor.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      IllegalArgumentException - if minimum value is larger or equal than maximum one.
    • getMaxIterationsFactor

      public double getMaxIterationsFactor()
      Returns factor to determine maximum number of iterations respect to the number of samples to compute comparison.
      Returns:
      factor to determine maximum number of iterations respect to the number of samples to compute comparison.
    • setMaxIterationsFactor

      public void setMaxIterationsFactor(double maxIterationsFactor) throws com.irurueta.geometry.estimators.LockedException
      Sets factor to determine maximum number of iterations respect to the number of samples to compute comparison.
      Parameters:
      maxIterationsFactor - maximum number of iterations respect to the number of samples to compute comparison.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      IllegalArgumentException - if provided value is less than 1.0.
    • getProgressDelta

      public float getProgressDelta()
      Returns amount of progress variation before notifying a progress change during comparison computation.
      Returns:
      amount of progress variation before notifying a progress change during comparison computation.
    • setProgressDelta

      public void setProgressDelta(float progressDelta) throws com.irurueta.geometry.estimators.LockedException
      Sets amount of progress variation before notifying a progress change during comparison computation.
      Parameters:
      progressDelta - amount of progress variation before notifying a progress change during comparison computation.
      Throws:
      IllegalArgumentException - if progress delta is less than zero or greater than 1.
      com.irurueta.geometry.estimators.LockedException - if this estimator is locked.
    • compare

      public double compare() throws com.irurueta.geometry.estimators.NotReadyException, com.irurueta.geometry.estimators.LockedException, FundamentalMatrixComparatorException
      Compares two fundamental matrices and returns the comparison value. Comparison value will depend on the method implemented to compare both fundamental matrices.
      Specified by:
      compare in class FundamentalMatrixComparator
      Returns:
      comparison value. Typically, the smaller the absolute value the more similar the fundamental matrices are.
      Throws:
      com.irurueta.geometry.estimators.NotReadyException - if this comparator is not yet ready to start the comparison.
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      FundamentalMatrixComparatorException - if comparison fails due to some other reason.
    • getType

      Returns type of comparator.
      Specified by:
      getType in class FundamentalMatrixComparator
      Returns:
      type of comparator.
    • init

      private void init()
      Initializes default settings.