Package com.irurueta.ar.epipolar
Class EpipolarDistanceFundamentalMatrixComparator
java.lang.Object
com.irurueta.ar.epipolar.FundamentalMatrixComparator
com.irurueta.ar.epipolar.EpipolarDistanceFundamentalMatrixComparator
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleMaximum disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.static final doubleDefault factor to determine maximum number of iterations respect to the number of samples to compute comparison.static final doubleDefines default maximum horizontal coordinate when generating random samples.static final doubleDefines default maximum vertical coordinate when generating random samples.static final doubleMinimum disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.static final doubleDefines default minimum horizontal coordinate when generating random samples.static final doubleDefines default minimum vertical coordinate when generating random samples.static final intDefault number of random samples to generate to compare fundamental matrices.static final floatDefault amount of progress variation before notifying a change in comparison progress.static final floatMaximum allowed value for progress delta.private doubleMaximum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.private doubleFactor to determine maximum number of iterations respect to the number of samples to compute comparison.private doubleMaximum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.private doubleMaximum horizontal coordinate when generating random samples.private doubleMaximum vertical coordinate when generating random samples.static final doubleMinimum value for the factor to determine maximum number of iterations respect to the number of samples to compute comparison.static final intMinimum number of samples that must be generated to compare fundamental matrices.static final floatMinimum allowed value for progress delta.private doubleMinimum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.private doubleMinimum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.private doubleMinimum horizontal coordinate when generating random samples.private doubleMinimum vertical coordinate when generating random samples.private intNumber of random samples to generate to compare fundamental matrices.protected floatAmount of progress variation before notifying a progress change during comparison.Fields inherited from class com.irurueta.ar.epipolar.FundamentalMatrixComparator
groundTruthFundamentalMatrix, listener, locked, otherFundamentalMatrix -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor.EpipolarDistanceFundamentalMatrixComparator(FundamentalMatrix groundTruthFundamentalMatrix, FundamentalMatrix otherFundamentalMatrix) Constructor.EpipolarDistanceFundamentalMatrixComparator(FundamentalMatrix groundTruthFundamentalMatrix, FundamentalMatrix otherFundamentalMatrix, FundamentalMatrixComparatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondoublecompare()Compares two fundamental matrices and returns the comparison value.doubleReturns maximum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.doubleReturns factor to determine maximum number of iterations respect to the number of samples to compute comparison.doubleReturns maximum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.doublegetMaxX()Returns maximum horizontal coordinate when generating random samples.doublegetMaxY()Returns maximum vertical coordinate when generating random samples.doubleReturns minimum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.doubleReturns minimum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.doublegetMinX()Returns minimum horizontal coordinate when generating random samples.doublegetMinY()Returns minimum vertical coordinate when generating random samples.intReturns number of random samples to generate to compare fundamental matrices.floatReturns amount of progress variation before notifying a progress change during comparison computation.getType()Returns type of comparator.private voidinit()Initializes default settings.voidsetMaxIterationsFactor(double maxIterationsFactor) Sets factor to determine maximum number of iterations respect to the number of samples to compute comparison.voidsetMinMaxHorizontalDisparityFactor(double minHorizontalDisparityFactor, double maxHorizontalDisparityFactor) Sets minimum and maximum horizontal disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.voidsetMinMaxVerticalDisparityFactor(double minVerticalDisparityFactor, double maxVerticalDisparityFactor) Sets minimum and maximum vertical disparity factor respect to retinal plane size defined by minimum and maximum samples coordinates.voidsetMinMaxX(double minX, double maxX) Sets minimum and maximum horizontal coordinates when generating random samples.voidsetMinMaxY(double minY, double maxY) Sets minimum and maximum vertical coordinates when generating random samples.voidsetNSamples(int nSamples) Sets number of random samples to generate to compare fundamental matrices.voidsetProgressDelta(float progressDelta) Sets amount of progress variation before notifying a progress change during comparison computation.Methods inherited from class com.irurueta.ar.epipolar.FundamentalMatrixComparator
getGroundTruthFundamentalMatrix, getListener, getOtherFundamentalMatrix, isLocked, isReady, setGroundTruthFundamentalMatrix, setListener, setOtherFundamentalMatrix
-
Field Details
-
DEFAULT_MIN_X
public static final double DEFAULT_MIN_XDefines default minimum horizontal coordinate when generating random samples.- See Also:
-
DEFAULT_MAX_X
public static final double DEFAULT_MAX_XDefines default maximum horizontal coordinate when generating random samples.- See Also:
-
DEFAULT_MIN_Y
public static final double DEFAULT_MIN_YDefines default minimum vertical coordinate when generating random samples.- See Also:
-
DEFAULT_MAX_Y
public static final double DEFAULT_MAX_YDefines default maximum vertical coordinate when generating random samples.- See Also:
-
DEFAULT_N_SAMPLES
public static final int DEFAULT_N_SAMPLESDefault number of random samples to generate to compare fundamental matrices.- See Also:
-
MIN_N_SAMPLES
public static final int MIN_N_SAMPLESMinimum number of samples that must be generated to compare fundamental matrices.- See Also:
-
DEFAULT_MIN_DISPARITY_FACTOR
public static final double DEFAULT_MIN_DISPARITY_FACTORMinimum 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_FACTORMaximum 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_FACTORDefault 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_FACTORMinimum 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_DELTADefault 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_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:
-
minX
private double minXMinimum horizontal coordinate when generating random samples. -
maxX
private double maxXMaximum horizontal coordinate when generating random samples. -
minY
private double minYMinimum vertical coordinate when generating random samples. -
maxY
private double maxYMaximum vertical coordinate when generating random samples. -
nSamples
private int nSamplesNumber of random samples to generate to compare fundamental matrices. -
minHorizontalDisparityFactor
private double minHorizontalDisparityFactorMinimum 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 maxHorizontalDisparityFactorMaximum 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 minVerticalDisparityFactorMinimum 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 maxVerticalDisparityFactorMaximum 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 maxIterationsFactorFactor to determine maximum number of iterations respect to the number of samples to compute comparison. -
progressDelta
protected float progressDeltaAmount 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
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, FundamentalMatrixComparatorExceptionCompares two fundamental matrices and returns the comparison value. Comparison value will depend on the method implemented to compare both fundamental matrices.- Specified by:
comparein classFundamentalMatrixComparator- 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:
getTypein classFundamentalMatrixComparator- Returns:
- type of comparator.
-
init
private void init()Initializes default settings.
-