Class PROSACRobustSinglePoint3DTriangulator

java.lang.Object
com.irurueta.ar.sfm.RobustSinglePoint3DTriangulator
com.irurueta.ar.sfm.PROSACRobustSinglePoint3DTriangulator

public class PROSACRobustSinglePoint3DTriangulator extends RobustSinglePoint3DTriangulator
Robustly triangulates 3D points from matched 2D points and their corresponding cameras on several views using PROSAC algorithm.
  • Field Details

    • DEFAULT_THRESHOLD

      public static final double DEFAULT_THRESHOLD
      Constant defining default threshold to determine whether samples are inliers or not. By default, 1.0 is considered a good value for cases where 2D point measures are done on pixels, since typically the minimum resolution is 1 pixel.
      See Also:
    • MIN_THRESHOLD

      public static final double MIN_THRESHOLD
      Minimum value that can be set as threshold. Threshold must be strictly greater than 0.0.
      See Also:
    • threshold

      private double threshold
      Threshold to determine whether samples are inliers or not when testing possible estimation solutions. The threshold refers to the amount of projection error (i.e. distance of projected solution using each camera).
    • qualityScores

      private double[] qualityScores
      Quality scores corresponding to each provided view. The larger the score value the better the quality of the sample.
  • Constructor Details

    • PROSACRobustSinglePoint3DTriangulator

      public PROSACRobustSinglePoint3DTriangulator()
      Constructor.
    • PROSACRobustSinglePoint3DTriangulator

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

      public PROSACRobustSinglePoint3DTriangulator(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras)
      Constructor.
      Parameters:
      points - Matched 2D points. Each point in the list is assumed to be projected by the corresponding camera in the list.
      cameras - List of cameras associated to the matched 2D point on the same position as the camera on the list.
      Throws:
      IllegalArgumentException - if provided lists don't have the same length or their length is less than 2 views, which is the minimum required to compute triangulation.
    • PROSACRobustSinglePoint3DTriangulator

      public PROSACRobustSinglePoint3DTriangulator(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, RobustSinglePoint3DTriangulatorListener listener)
      Constructor.
      Parameters:
      points - Matched 2D points. Each point in the list is assumed to be projected by the corresponding camera in the list.
      cameras - List of cameras associated to the matched 2D point on the same position as the camera on the list.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if provided lists don't have the same length or their length is less than 2 views, which is the minimum required to compute triangulation.
    • PROSACRobustSinglePoint3DTriangulator

      public PROSACRobustSinglePoint3DTriangulator(double[] qualityScores)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided view.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than required size (i.e. 2 views).
    • PROSACRobustSinglePoint3DTriangulator

      public PROSACRobustSinglePoint3DTriangulator(double[] qualityScores, RobustSinglePoint3DTriangulatorListener listener)
      Constructor.
      Parameters:
      qualityScores - quality scores corresponding to each provided view.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than required size (i.e. 2 views).
    • PROSACRobustSinglePoint3DTriangulator

      public PROSACRobustSinglePoint3DTriangulator(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, double[] qualityScores)
      Constructor.
      Parameters:
      points - Matched 2D points. Each point in the list is assumed to be projected by the corresponding camera in the list.
      cameras - List of cameras associated to the matched 2D point on the same position as the camera on the list.
      qualityScores - quality scores corresponding to each provided view.
      Throws:
      IllegalArgumentException - if provided lists or quality scores don't have the same length or their length is less than 2 views, which is the minimum required to compute triangulation.
    • PROSACRobustSinglePoint3DTriangulator

      public PROSACRobustSinglePoint3DTriangulator(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, double[] qualityScores, RobustSinglePoint3DTriangulatorListener listener)
      Constructor.
      Parameters:
      points - Matched 2D points. Each point in the list is assumed to be projected by the corresponding camera in the list.
      cameras - List of cameras associated to the matched 2D point on the same position as the camera on the list.
      qualityScores - quality scores corresponding to each provided view.
      listener - listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
      Throws:
      IllegalArgumentException - if provided lists or quality scores don't have the same length or their length is less than 2 views, which is the minimum required to compute triangulation.
  • Method Details

    • getThreshold

      public double getThreshold()
      Returns threshold to determine whether points are inliers or not when testing possible estimation solutions. The threshold refers to the amount of error (i.e. Euclidean distance) a possible solution has on projected 2D points.
      Returns:
      threshold to determine whether points are inliers or not when testing possible estimation solutions.
    • setThreshold

      public void setThreshold(double threshold) throws com.irurueta.geometry.estimators.LockedException
      Sets threshold to determine whether points are inliers or not when testing possible estimation solutions. The threshold refers to the amount of error (i.e. Euclidean distance) a possible solution has on projected 2D points.
      Parameters:
      threshold - threshold to be set.
      Throws:
      IllegalArgumentException - if provided value is equal or less than zero.
      com.irurueta.geometry.estimators.LockedException - if robust estimator is locked because an estimation is already in progress.
    • getQualityScores

      public double[] getQualityScores()
      Returns quality scores corresponding to each provided view. The larger the score value the better the quality of the sampled view.
      Overrides:
      getQualityScores in class RobustSinglePoint3DTriangulator
      Returns:
      quality scores corresponding to each view.
    • setQualityScores

      public void setQualityScores(double[] qualityScores) throws com.irurueta.geometry.estimators.LockedException
      Sets quality scores corresponding to each provided view. The larger the score value the better the quality of the sampled view.
      Overrides:
      setQualityScores in class RobustSinglePoint3DTriangulator
      Parameters:
      qualityScores - quality scores corresponding to each view.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if robust estimator is locked because an estimation is already in progress.
      IllegalArgumentException - if provided quality scores length is smaller than MIN_REQUIRED_VIEWS (i.e. 2 views).
    • isReady

      public boolean isReady()
      Indicates if triangulator is ready to start the 3D point triangulation. This is true when input data (i.e. 2D points, cameras and quality scores) are provided and a minimum of 2 views are available.
      Overrides:
      isReady in class RobustSinglePoint3DTriangulator
      Returns:
      true if estimator is ready, false otherwise.
    • triangulate

      public com.irurueta.geometry.Point3D triangulate() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, com.irurueta.numerical.robust.RobustEstimatorException
      Triangulates provided matched 2D points being projected by each corresponding camera into a single 3D point. At least 2 matched 2D points and their corresponding 2 cameras are required to compute triangulation. If more views are provided, an averaged solution can be found.
      Specified by:
      triangulate in class RobustSinglePoint3DTriangulator
      Returns:
      computed triangulated 3D point.
      Throws:
      com.irurueta.geometry.estimators.LockedException - if this instance is locked.
      com.irurueta.geometry.estimators.NotReadyException - if lists of points and cameras don't have the same length or less than 2 views are provided.
      com.irurueta.numerical.robust.RobustEstimatorException - if estimation fails for any reason (i.e. numerical instability, no solution available, etc).
    • getMethod

      public com.irurueta.numerical.robust.RobustEstimatorMethod getMethod()
      Returns method being used for robust estimation.
      Specified by:
      getMethod in class RobustSinglePoint3DTriangulator
      Returns:
      method being used for robust estimation.
    • internalSetQualityScores

      private void internalSetQualityScores(double[] qualityScores)
      Sets quality scores corresponding to each provided view. This method is used internally and does not check whether instance is locked or not.
      Parameters:
      qualityScores - quality scores to be set.
      Throws:
      IllegalArgumentException - if provided quality scores length is smaller than MINIMUM_SIZE.