Package com.irurueta.ar.sfm
Class PROMedSRobustSinglePoint3DTriangulator
java.lang.Object
com.irurueta.ar.sfm.RobustSinglePoint3DTriangulator
com.irurueta.ar.sfm.PROMedSRobustSinglePoint3DTriangulator
Robustly triangulates 3D points from matched 2D points and their
corresponding cameras on several views using PROMedS algorithm.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Default value to be used for stop threshold.static final double
Minimum allowed stop threshold value.private double[]
Quality scores corresponding to each provided point.private double
Threshold to be used to keep the algorithm iterating in case that best estimated threshold using median of residuals is not small enough.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.PROMedSRobustSinglePoint3DTriangulator
(double[] qualityScores) Constructor.PROMedSRobustSinglePoint3DTriangulator
(double[] qualityScores, RobustSinglePoint3DTriangulatorListener listener) Constructor.Constructor.PROMedSRobustSinglePoint3DTriangulator
(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras) Constructor.PROMedSRobustSinglePoint3DTriangulator
(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, double[] qualityScores) Constructor.PROMedSRobustSinglePoint3DTriangulator
(List<com.irurueta.geometry.Point2D> points, List<com.irurueta.geometry.PinholeCamera> cameras, double[] qualityScores, RobustSinglePoint3DTriangulatorListener listener) Constructor.PROMedSRobustSinglePoint3DTriangulator
(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 be used to keep the algorithm iterating in case that best estimated threshold using median of residuals is not small enough.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
setStopThreshold
(double stopThreshold) Sets threshold to be used to keep the algorithm iterating in case that best estimated threshold using median of residuals is not small enough.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_STOP_THRESHOLD
public static final double DEFAULT_STOP_THRESHOLDDefault value to be used for stop threshold. Stop threshold can be used to keep the algorithm iterating in case that best estimated threshold using median of residuals is not small enough. Once a solution is found that generates a threshold below this value, the algorithm will stop. The stop threshold can be used to prevent the LMedS algorithm iterating too many times in cases where samples have a very similar accuracy. For instance, in cases where proportion of outliers is very small (close to 0%), and samples are very accurate (i.e. 1e-6), the algorithm would iterate for a long time trying to find the best solution when indeed there is no need to do that if a reasonable threshold has already been reached. Because of this behaviour the stop threshold can be set to a value much lower than the one typically used in RANSAC, and yet the algorithm could still produce even smaller thresholds in estimated results.- See Also:
-
MIN_STOP_THRESHOLD
public static final double MIN_STOP_THRESHOLDMinimum allowed stop threshold value.- See Also:
-
stopThreshold
private double stopThresholdThreshold to be used to keep the algorithm iterating in case that best estimated threshold using median of residuals is not small enough. Once a solution is found that generates a threshold below this value, the algorithm will stop. The stop threshold can be used to prevent the LMedS algorithm iterating too many times in cases where samples have a very similar accuracy. For instance, in cases where proportion of outliers is very small (close to 0%), and samples are very accurate (i.e. 1e-6), the algorithm would iterate for a long time trying to find the best solution when indeed there is no need to do that if a reasonable threshold has already been reached. Because of this behaviour the stop threshold can be set to a value much lower than the one typically used in RANSAC, and yet the algorithm could still produce even smaller thresholds in estimated results. -
qualityScores
private double[] qualityScoresQuality scores corresponding to each provided point. The larger the score value the better the quality of the sample.
-
-
Constructor Details
-
PROMedSRobustSinglePoint3DTriangulator
public PROMedSRobustSinglePoint3DTriangulator()Constructor. -
PROMedSRobustSinglePoint3DTriangulator
Constructor.- Parameters:
listener
- listener to be notified of events such as when estimation starts, ends or its progress significantly changes.
-
PROMedSRobustSinglePoint3DTriangulator
public PROMedSRobustSinglePoint3DTriangulator(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.
-
PROMedSRobustSinglePoint3DTriangulator
public PROMedSRobustSinglePoint3DTriangulator(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.
-
PROMedSRobustSinglePoint3DTriangulator
public PROMedSRobustSinglePoint3DTriangulator(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).
-
PROMedSRobustSinglePoint3DTriangulator
public PROMedSRobustSinglePoint3DTriangulator(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).
-
PROMedSRobustSinglePoint3DTriangulator
public PROMedSRobustSinglePoint3DTriangulator(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.
-
PROMedSRobustSinglePoint3DTriangulator
public PROMedSRobustSinglePoint3DTriangulator(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
-
getStopThreshold
public double getStopThreshold()Returns threshold to be used to keep the algorithm iterating in case that best estimated threshold using median of residuals is not small enough. Once a solution is found that generates a threshold below this value, the algorithm will stop. The stop threshold can be used to prevent the LMedS algorithm iterating too many times in cases where samples have a very similar accuracy. For instance, in cases where proportion of outliers is very small (close to 0%), and samples are very accurate (i.e. 1e-6), the algorithm would iterate for a long time trying to find the best solution when indeed there is no need to do that if a reasonable threshold has already been reached. Because of this behaviour the stop threshold can be set to a value much lower than the one typically used in RANSAC, and yet the algorithm could still produce even smaller thresholds in estimated results.- Returns:
- stop threshold to stop the algorithm prematurely when a certain accuracy has been reached.
-
setStopThreshold
public void setStopThreshold(double stopThreshold) throws com.irurueta.geometry.estimators.LockedException Sets threshold to be used to keep the algorithm iterating in case that best estimated threshold using median of residuals is not small enough. Once a solution is found that generates a threshold below this value, the algorithm will stop. The stop threshold can be used to prevent the LMedS algorithm iterating too many times in cases where samples have a very similar accuracy. For instance, in cases where proportion of outliers is very small (close to 0%), and samples are very accurate (i.e. 1e-6), the algorithm would iterate for a long time trying to find the best solution when indeed there is no need to do that if a reasonable threshold has already been reached. Because of this behaviour the stop threshold can be set to a value much lower than the one typically used in RANSAC, and yet the algorithm could still produce even smaller thresholds in estimated results.- Parameters:
stopThreshold
- stop threshold to stop the algorithm prematurely when a certain accuracy has been reached.- Throws:
IllegalArgumentException
- if provided value is zero or negative.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.
-