Package com.irurueta.ar.sfm
Class PROSACRobustSinglePoint3DTriangulator
java.lang.Object
com.irurueta.ar.sfm.RobustSinglePoint3DTriangulator
com.irurueta.ar.sfm.PROSACRobustSinglePoint3DTriangulator
Robustly triangulates 3D points from matched 2D points and their
corresponding cameras on several views using PROSAC algorithm.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Constant defining default threshold to determine whether samples are inliers or not.static final double
Minimum value that can be set as threshold.private double[]
Quality scores corresponding to each provided view.private double
Threshold to determine whether samples are inliers or not when testing possible estimation solutions.Fields inherited from class com.irurueta.ar.sfm.RobustSinglePoint3DTriangulator
cameras, confidence, DEFAULT_CONFIDENCE, DEFAULT_MAX_ITERATIONS, DEFAULT_PROGRESS_DELTA, DEFAULT_ROBUST_METHOD, DEFAULT_USE_HOMOGENEOUS_SOLUTION, listener, locked, MAX_CONFIDENCE, MAX_PROGRESS_DELTA, maxIterations, MIN_CONFIDENCE, MIN_ITERATIONS, MIN_PROGRESS_DELTA, MIN_REQUIRED_VIEWS, points2D, progressDelta, useHomogeneousSolution
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.PROSACRobustSinglePoint3DTriangulator
(double[] qualityScores) Constructor.PROSACRobustSinglePoint3DTriangulator
(double[] qualityScores, RobustSinglePoint3DTriangulatorListener listener) Constructor.Constructor.PROSACRobustSinglePoint3DTriangulator
(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras) Constructor.PROSACRobustSinglePoint3DTriangulator
(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, double[] qualityScores) Constructor.PROSACRobustSinglePoint3DTriangulator
(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, double[] qualityScores, RobustSinglePoint3DTriangulatorListener listener) Constructor.PROSACRobustSinglePoint3DTriangulator
(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, RobustSinglePoint3DTriangulatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncom.irurueta.numerical.robust.RobustEstimatorMethod
Returns method being used for robust estimation.double[]
Returns quality scores corresponding to each provided view.double
Returns threshold to determine whether points are inliers or not when testing possible estimation solutions.private void
internalSetQualityScores
(double[] qualityScores) Sets quality scores corresponding to each provided view.boolean
isReady()
Indicates if triangulator is ready to start the 3D point triangulation.void
setQualityScores
(double[] qualityScores) Sets quality scores corresponding to each provided view.void
setThreshold
(double threshold) Sets threshold to determine whether points are inliers or not when testing possible estimation solutions.com.irurueta.geometry.Point3D
Triangulates provided matched 2D points being projected by each corresponding camera into a single 3D point.Methods inherited from class com.irurueta.ar.sfm.RobustSinglePoint3DTriangulator
create, create, create, create, create, create, getCameras, getConfidence, getListener, getMaxIterations, getPoints2D, getProgressDelta, isListenerAvailable, isLocked, isUseHomogeneousSolution, setConfidence, setListener, setMaxIterations, setPointsAndCameras, setProgressDelta, setUseHomogeneousSolution
-
Field Details
-
DEFAULT_THRESHOLD
public static final double DEFAULT_THRESHOLDConstant 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_THRESHOLDMinimum value that can be set as threshold. Threshold must be strictly greater than 0.0.- See Also:
-
threshold
private double thresholdThreshold 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[] qualityScoresQuality 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
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 classRobustSinglePoint3DTriangulator
- 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 classRobustSinglePoint3DTriangulator
- 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 classRobustSinglePoint3DTriangulator
- 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.RobustEstimatorExceptionTriangulates 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 classRobustSinglePoint3DTriangulator
- 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 classRobustSinglePoint3DTriangulator
- 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.
-