Class ConicRobustEstimator

java.lang.Object
com.irurueta.geometry.estimators.ConicRobustEstimator
Direct Known Subclasses:
LMedSConicRobustEstimator, MSACConicRobustEstimator, PROMedSConicRobustEstimator, PROSACConicRobustEstimator, RANSACConicRobustEstimator

public abstract class ConicRobustEstimator extends Object
This is an abstract class for algorithms to robustly find the best conic that fits in a collection of 2D points. Implementations of this class should be able to detect and discard outliers in order to find the best solution.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
    Amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).
    static final double
    Constant defining default confidence of the estimated result, which is 99%.
    static final int
    Default maximum allowed number of iterations.
    static final float
    Default amount of progress variation before notifying a change in estimation progress.
    static final com.irurueta.numerical.robust.RobustEstimatorMethod
    Default robust estimator method when none is provided.
    Listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    protected boolean
    Indicates if this estimator is locked because an estimation is being computed.
    static final double
    Maximum allowed confidence value.
    static final float
    Maximum allowed value for progress delta.
    protected int
    Maximum allowed number of iterations.
    static final double
    Minimum allowed confidence value.
    static final int
    Minimum allowed number of iterations.
    static final float
    Minimum allowed value for progress delta.
    static final int
    Minimum number of 2D points required to estimate a Conic.
    protected List<Point2D>
    List of points to be used to estimate a conic.
    protected float
    Amount of progress variation before notifying a progress change during estimation.
    private com.irurueta.algebra.Matrix
    Matrix representation of a conic to be reused when computing residuals.
    private com.irurueta.algebra.Matrix
    Matrix representation of a 2D point to be reused when computing residuals.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
    protected
    Constructor.
    protected
    Constructor.
    protected
    Constructor with points.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a conic robust estimator based on 2D point samples and using default robust estimator method.
    create(double[] qualityScores)
    Creates a conic robust estimator based on 2D point samples and using default robust estimator method.
    create(double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided robust estimator method.
    Creates a conic robust estimator based on 2D point samples and using provided listener and default robust estimator method.
    create(ConicRobustEstimatorListener listener, double[] qualityScores)
    Creates a conic robust estimator based on 2D point samples and using provided listener and default estimator method.
    create(ConicRobustEstimatorListener listener, double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided listener.
    create(ConicRobustEstimatorListener listener, com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided listener.
    Creates a conic robust estimator based on 2D point samples and using provided listener and points and default robust estimator method.
    create(ConicRobustEstimatorListener listener, List<Point2D> points, double[] qualityScores)
    Creates a conic robust estimator based on 2D point samples and using provided listener and points and default estimator method.
    create(ConicRobustEstimatorListener listener, List<Point2D> points, double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided listener and points.
    create(ConicRobustEstimatorListener listener, List<Point2D> points, com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided listener and points.
    create(com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided robust estimator method.
    create(List<Point2D> points)
    Creates a conic robust estimator based on 2D point samples and using provided points and default robust estimator method.
    create(List<Point2D> points, double[] qualityScores)
    Creates a conic robust estimator based on 2D point samples and using provided points and default estimator method.
    create(List<Point2D> points, double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided points and robust estimator method.
    create(List<Point2D> points, com.irurueta.numerical.robust.RobustEstimatorMethod method)
    Creates a conic robust estimator based on 2D point samples and using provided points and robust estimator method.
    abstract Conic
    Estimates a conic using a robust estimator and the best set of 2D points that fit into the locus of the estimated conic found using the robust estimator.
    double
    Returns amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).
    Returns reference to listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    int
    Returns maximum allowed number of iterations.
    abstract com.irurueta.numerical.robust.RobustEstimatorMethod
    Returns method being used for robust estimation.
    Returns list of points to be used to estimate a conic.
    float
    Returns amount of progress variation before notifying a progress change during estimation.
    double[]
    Returns quality scores corresponding to each point.
    private void
    Internal method to set lists of points to be used to estimate a conic.
    boolean
    Indicates whether listener has been provided and is available for retrieval.
    boolean
    Indicates if this instance is locked because estimation is being computed.
    boolean
    Indicates if estimator is ready to start the conic estimation.
    protected double
    residual(Conic c, Point2D point)
    Computes the residual between a conic and a point.
    void
    setConfidence(double confidence)
    Sets amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%).
    void
    Sets listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    void
    setMaxIterations(int maxIterations)
    Sets maximum allowed number of iterations.
    void
    Sets list of points to be used to estimate a conic.
    void
    setProgressDelta(float progressDelta)
    Sets amount of progress variation before notifying a progress change during estimation.
    void
    setQualityScores(double[] qualityScores)
    Sets quality scores corresponding to each point.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MINIMUM_SIZE

      public static final int MINIMUM_SIZE
      Minimum number of 2D points required to estimate a Conic.
      See Also:
    • 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:
    • DEFAULT_CONFIDENCE

      public static final double DEFAULT_CONFIDENCE
      Constant defining default confidence of the estimated result, which is 99%. This means that with a probability of 99% estimation will be accurate because chosen sub-samples will be inliers.
      See Also:
    • DEFAULT_MAX_ITERATIONS

      public static final int DEFAULT_MAX_ITERATIONS
      Default maximum allowed number of iterations.
      See Also:
    • MIN_CONFIDENCE

      public static final double MIN_CONFIDENCE
      Minimum allowed confidence value.
      See Also:
    • MAX_CONFIDENCE

      public static final double MAX_CONFIDENCE
      Maximum allowed confidence value.
      See Also:
    • MIN_ITERATIONS

      public static final int MIN_ITERATIONS
      Minimum allowed number of iterations.
      See Also:
    • DEFAULT_ROBUST_METHOD

      public static final com.irurueta.numerical.robust.RobustEstimatorMethod DEFAULT_ROBUST_METHOD
      Default robust estimator method when none is provided.
    • listener

      protected ConicRobustEstimatorListener listener
      Listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    • locked

      protected volatile boolean locked
      Indicates if this estimator is locked because an estimation is being computed.
    • progressDelta

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

      protected double confidence
      Amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%). The amount of confidence indicates the probability that the estimated result is correct. Usually this value will be close to 1.0, but not exactly 1.0.
    • maxIterations

      protected int maxIterations
      Maximum allowed number of iterations. When the maximum number of iterations is exceeded, result will not be available, however an approximate result will be available for retrieval.
    • points

      protected List<Point2D> points
      List of points to be used to estimate a conic. Provided list must have a size greater or equal than MINIMUM_SIZE.
    • testPoint

      private com.irurueta.algebra.Matrix testPoint
      Matrix representation of a 2D point to be reused when computing residuals.
    • testC

      private com.irurueta.algebra.Matrix testC
      Matrix representation of a conic to be reused when computing residuals.
  • Constructor Details

    • ConicRobustEstimator

      protected ConicRobustEstimator()
      Constructor.
    • ConicRobustEstimator

      protected ConicRobustEstimator(ConicRobustEstimatorListener listener)
      Constructor.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
    • ConicRobustEstimator

      protected ConicRobustEstimator(List<Point2D> points)
      Constructor with points.
      Parameters:
      points - 2D points to estimate a conic.
      Throws:
      IllegalArgumentException - if provided list of points don't have a size greater or equal than MINIMUM_SIZE.
    • ConicRobustEstimator

      protected ConicRobustEstimator(ConicRobustEstimatorListener listener, List<Point2D> points)
      Constructor.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      points - 2D points to estimate a conic.
      Throws:
      IllegalArgumentException - if provided list of points don't have a size greater or equal than MINIMUM_SIZE.
  • Method Details

    • getListener

      public ConicRobustEstimatorListener getListener()
      Returns reference to listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Returns:
      listener to be notified of events.
    • setListener

      public void setListener(ConicRobustEstimatorListener listener) throws LockedException
      Sets listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Parameters:
      listener - listener to be notified of events.
      Throws:
      LockedException - if robust estimator is locked.
    • isListenerAvailable

      public boolean isListenerAvailable()
      Indicates whether listener has been provided and is available for retrieval.
      Returns:
      true if available, false otherwise.
    • isLocked

      public boolean isLocked()
      Indicates if this instance is locked because estimation is being computed.
      Returns:
      true if 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 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.
      LockedException - if this estimator is locked because an estimation is being computed.
    • getConfidence

      public double getConfidence()
      Returns amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%). The amount of confidence indicates the probability that the estimated result is correct. Usually this value will be close to 1.0, but not exactly 1.0.
      Returns:
      amount of confidence as a value between 0.0 and 1.0.
    • setConfidence

      public void setConfidence(double confidence) throws LockedException
      Sets amount of confidence expressed as a value between 0.0 and 1.0 (which is equivalent to 100%). The amount of confidence indicates the probability that the estimated result is correct. Usually this value will be close to 1.0, but not exactly 1.0.
      Parameters:
      confidence - confidence to be set as a value between 0.0 and 1.0.
      Throws:
      IllegalArgumentException - if provided value is not between 0.0 and 1.0.
      LockedException - if this estimator is locked because an estimator is being computed.
    • getMaxIterations

      public int getMaxIterations()
      Returns maximum allowed number of iterations. If maximum allowed number of iterations is achieved without converging to a result when calling estimate(), a RobustEstimatorException will be raised.
      Returns:
      maximum allowed number of iterations.
    • setMaxIterations

      public void setMaxIterations(int maxIterations) throws LockedException
      Sets maximum allowed number of iterations. When the maximum number of iterations is exceeded, result will not be available, however an approximate result will be available for retrieval.
      Parameters:
      maxIterations - maximum allowed number of iterations to be set.
      Throws:
      IllegalArgumentException - if provided value is less than 1.
      LockedException - if this estimator is locked because an estimation is being computed.
    • getPoints

      public List<Point2D> getPoints()
      Returns list of points to be used to estimate a conic. Provided list must have a size greater or equal than MINIMUM_SIZE.
      Returns:
      list of points to be used to estimate a conic.
    • setPoints

      public void setPoints(List<Point2D> points) throws LockedException
      Sets list of points to be used to estimate a conic. Provided list must have a size greater or equal than MINIMUM_SIZE.
      Parameters:
      points - list of points to be used to estimate a conic.
      Throws:
      IllegalArgumentException - if provided list of points don't have a size greater or equal than MINIMUM_SIZE.
      LockedException - if estimator is locked because a computation is already in progress.
    • isReady

      public boolean isReady()
      Indicates if estimator is ready to start the conic estimation. This is true when a minimum if MINIMUM_SIZE points are available.
      Returns:
      true if estimator is ready, false otherwise.
    • getQualityScores

      public double[] getQualityScores()
      Returns quality scores corresponding to each point. The larger the score value the better the quality of the point measure. This implementation always returns null. Subclasses using quality scores must implement proper behaviour.
      Returns:
      quality scores corresponding to each point.
    • setQualityScores

      public void setQualityScores(double[] qualityScores) throws LockedException
      Sets quality scores corresponding to each point. The larger the score value the better the quality of the matching. This implementation makes no action. Subclasses using quality scores must implement proper behaviour.
      Parameters:
      qualityScores - quality scores corresponding to each pair of matched points.
      Throws:
      LockedException - if robust estimator is locked because an estimation is already in progress.
      IllegalArgumentException - if provided quality scores length is smaller than MINIMUM_SIZE (i.e. 5 samples).
    • create

      public static ConicRobustEstimator create(com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided robust estimator method.
      Parameters:
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
    • create

      public static ConicRobustEstimator create(List<Point2D> points, com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided points and robust estimator method.
      Parameters:
      points - 2D points to estimate a conic.
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have a size greater or equal than MINIMUM_SIZE.
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener, com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided listener.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener, List<Point2D> points, com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided listener and points.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      points - 2D points to estimate a conic.
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have a size greater or equal than MINIMUM_SIZE.
    • create

      public static ConicRobustEstimator create(double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided robust estimator method.
      Parameters:
      qualityScores - quality scores corresponding to each provided point.
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than MINIMUM_SIZE (i.e. 5 points).
    • create

      public static ConicRobustEstimator create(List<Point2D> points, double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided points and robust estimator method.
      Parameters:
      points - 2D points to estimate a conic.
      qualityScores - quality scores corresponding to each provided point.
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have the same size as the list of provided quality scores, or it their size is not greater or equal than MINIMUM_SIZE.
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener, double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided listener.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      qualityScores - quality scores corresponding to each provided point.
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than MINIMUM_SIZE (i.e. 5 points).
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener, List<Point2D> points, double[] qualityScores, com.irurueta.numerical.robust.RobustEstimatorMethod method)
      Creates a conic robust estimator based on 2D point samples and using provided listener and points.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      points - 2D points to estimate a conic.
      qualityScores - quality scores corresponding to each provided point.
      method - method of a robust estimator algorithm to estimate the best conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have the same size as the list of provided quality scores, or it their size is not greater or equal than MINIMUM_SIZE.
    • create

      public static ConicRobustEstimator create()
      Creates a conic robust estimator based on 2D point samples and using default robust estimator method.
      Returns:
      an instance of a conic robust estimator.
    • create

      public static ConicRobustEstimator create(List<Point2D> points)
      Creates a conic robust estimator based on 2D point samples and using provided points and default robust estimator method.
      Parameters:
      points - 2D points to estimate a conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have a size greater or equal than MINIMUM_SIZE.
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener)
      Creates a conic robust estimator based on 2D point samples and using provided listener and default robust estimator method.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Returns:
      an instance of a conic robust estimator.
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener, List<Point2D> points)
      Creates a conic robust estimator based on 2D point samples and using provided listener and points and default robust estimator method.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      points - 2D points to estimate a conic.
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have a size greater or equal than MINIMUM_SIZE.
    • create

      public static ConicRobustEstimator create(double[] qualityScores)
      Creates a conic robust estimator based on 2D point samples and using default robust estimator method.
      Parameters:
      qualityScores - quality scores corresponding to each provided point
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than MINIMUM_SIZE (i.e. 5 points).
    • create

      public static ConicRobustEstimator create(List<Point2D> points, double[] qualityScores)
      Creates a conic robust estimator based on 2D point samples and using provided points and default estimator method.
      Parameters:
      points - 2D points to estimate a conic.
      qualityScores - quality scores corresponding to each provided point
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have the same size as the list of provided quality scores, or if their size is not greater or equal than MINIMUM_SIZE.
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener, double[] qualityScores)
      Creates a conic robust estimator based on 2D point samples and using provided listener and default estimator method.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      qualityScores - quality scores corresponding to each provided point
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than MINIMUM_SIZE (i.e. 5 points).
    • create

      public static ConicRobustEstimator create(ConicRobustEstimatorListener listener, List<Point2D> points, double[] qualityScores)
      Creates a conic robust estimator based on 2D point samples and using provided listener and points and default estimator method.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      points - 2D points to estimate a conic.
      qualityScores - quality scores corresponding to each provided point
      Returns:
      an instance of a conic robust estimator.
      Throws:
      IllegalArgumentException - if provided list of points don't have the same size as the list of provided quality scores, or if their size is not greater or equal than MINIMUM_SIZE.
    • estimate

      public abstract Conic estimate() throws LockedException, NotReadyException, com.irurueta.numerical.robust.RobustEstimatorException
      Estimates a conic using a robust estimator and the best set of 2D points that fit into the locus of the estimated conic found using the robust estimator.
      Returns:
      a conic.
      Throws:
      LockedException - if robust estimator is locked because an estimation is already in progress.
      NotReadyException - if provided input data is not enough to start the estimation.
      com.irurueta.numerical.robust.RobustEstimatorException - if estimation fails for any reason (i.e. numerical instability, no solution available, etc).
    • getMethod

      public abstract com.irurueta.numerical.robust.RobustEstimatorMethod getMethod()
      Returns method being used for robust estimation.
      Returns:
      method being used for robust estimation.
    • internalSetPoints

      private void internalSetPoints(List<Point2D> points)
      Internal method to set lists of points to be used to estimate a conic. This method does not check whether estimator is locked or not.
      Parameters:
      points - list of points to be used to estimate a conic.
      Throws:
      IllegalArgumentException - if provided list of points doesn't have a size greater or equal than MINIMUM_SIZE.
    • residual

      protected double residual(Conic c, Point2D point)
      Computes the residual between a conic and a point.
      Parameters:
      c - a conic.
      point - a 2D point.
      Returns:
      residual.