Package com.irurueta.geometry.estimators
Class MetricTransformation2DEstimator
java.lang.Object
com.irurueta.geometry.estimators.MetricTransformation2DEstimator
Estimator of a 2D metric transformation based on point correspondences.
A minimum of 3 non-coincident matched 2D input/output points is required for
estimation.
If more points are provided an LMSE (Least Mean Squared Error) solution will
be found.
-
Field Summary
FieldsModifier and TypeFieldDescription2D input points.Listener to be notified of events such as when estimation starts or ends.private booleanIndicates if this estimator is locked because an estimation is being computed.static final intMinimum required number of matched points.2D output points.static final intFor some point configurations a solution can be found with only 2 points.private booleanIndicates whether estimation can start with only 2 points or not. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.MetricTransformation2DEstimator(boolean weakMinimumSizeAllowed) Constructor.Constructor.MetricTransformation2DEstimator(MetricTransformation2DEstimatorListener listener, boolean weakMinimumSizeAllowed) Constructor.MetricTransformation2DEstimator(MetricTransformation2DEstimatorListener listener, List<Point2D> inputPoints, List<Point2D> outputPoints) Constructor.MetricTransformation2DEstimator(MetricTransformation2DEstimatorListener listener, List<Point2D> inputPoints, List<Point2D> outputPoints, boolean weakMinimumSizeAllowed) Constructor.MetricTransformation2DEstimator(List<Point2D> inputPoints, List<Point2D> outputPoints) Constructor.MetricTransformation2DEstimator(List<Point2D> inputPoints, List<Point2D> outputPoints, boolean weakMinimumSizeAllowed) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate static com.irurueta.algebra.MatrixcomputeCentroid(List<Point2D> points) Computes centroid of provided list of points using inhomogeneous coordinates.estimate()Estimates a metric 2D transformation using the list of matched input and output 2D points.voidestimate(MetricTransformation2D result) Estimates a metric 2D transformation using the list of matched input and output 2D points.Returns list of input points to be used to estimate a metric 2D transformation.Returns reference to listener to be notified of events such as when estimation starts or ends.intRequired minimum number of point correspondences to start the estimation.Returns list of output points to be used to estimate a metric 2D transformation.private voidinternalSetPoints(List<Point2D> inputPoints, List<Point2D> outputPoints) Internal method to set lists of points to be used to estimate a metric 2D transformation.booleanIndicates whether listener has been provided and is available for retrieval.booleanisLocked()Indicates if this instance is locked because estimation is being computed.booleanisReady()Indicates if estimator is ready to start the metric 2D transformation estimation.booleanIndicates whether estimation can start with only 2 points or not.voidSets listener to be notified of events such as when estimation starts or ends.voidSets list of points to be used to estimate a metric 2D transformation.voidsetWeakMinimumSizeAllowed(boolean weakMinimumSizeAllowed) Specifies whether estimation can start with only 2 points or not.
-
Field Details
-
MINIMUM_SIZE
public static final int MINIMUM_SIZEMinimum required number of matched points.- See Also:
-
WEAK_MINIMUM_SIZE
public static final int WEAK_MINIMUM_SIZEFor some point configurations a solution can be found with only 2 points.- See Also:
-
inputPoints
2D input points. -
outputPoints
2D output points. -
listener
Listener to be notified of events such as when estimation starts or ends. -
weakMinimumSizeAllowed
private boolean weakMinimumSizeAllowedIndicates whether estimation can start with only 2 points or not. True allows 2 points, false requires 3. -
locked
private boolean lockedIndicates if this estimator is locked because an estimation is being computed.
-
-
Constructor Details
-
MetricTransformation2DEstimator
public MetricTransformation2DEstimator()Constructor. -
MetricTransformation2DEstimator
Constructor.- Parameters:
inputPoints- 2D input points.outputPoints- 2D output points.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size or their size is smaller than 2.
-
MetricTransformation2DEstimator
Constructor.- Parameters:
listener- listener to be notified of events such as when estimation starts or ends.
-
MetricTransformation2DEstimator
public MetricTransformation2DEstimator(MetricTransformation2DEstimatorListener listener, List<Point2D> inputPoints, List<Point2D> outputPoints) Constructor.- Parameters:
listener- listener to be notified of events such as when estimation starts or ends.inputPoints- 3D input points.outputPoints- 3D output points.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size or their size is smaller than 2.
-
MetricTransformation2DEstimator
public MetricTransformation2DEstimator(boolean weakMinimumSizeAllowed) Constructor.- Parameters:
weakMinimumSizeAllowed- true allows 3 points, false requires 4.
-
MetricTransformation2DEstimator
public MetricTransformation2DEstimator(List<Point2D> inputPoints, List<Point2D> outputPoints, boolean weakMinimumSizeAllowed) Constructor.- Parameters:
inputPoints- 2D input points.outputPoints- 2D output points.weakMinimumSizeAllowed- true allows 3 points, false requires 4.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size or their size is smaller than 2.
-
MetricTransformation2DEstimator
public MetricTransformation2DEstimator(MetricTransformation2DEstimatorListener listener, boolean weakMinimumSizeAllowed) Constructor.- Parameters:
listener- listener to be notified of events such as when estimation starts or ends.weakMinimumSizeAllowed- true allows 3 points, false requires 4.
-
MetricTransformation2DEstimator
public MetricTransformation2DEstimator(MetricTransformation2DEstimatorListener listener, List<Point2D> inputPoints, List<Point2D> outputPoints, boolean weakMinimumSizeAllowed) Constructor.- Parameters:
listener- listener to be notified of events such as when estimation starts or ends.inputPoints- 3D input points.outputPoints- 3D output points.weakMinimumSizeAllowed- true allows 3 points, false requires 4.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size or their size is smaller than 2.
-
-
Method Details
-
getInputPoints
Returns list of input points to be used to estimate a metric 2D transformation. Each point in the list of input points must be matched with the corresponding point in the list of output points located at the same position. Hence, both input points and output points must have the same size, and their size must be greater or equal than MINIMUM_SIZE.- Returns:
- list of input points to be used to estimate a metric 2D transformation.
-
getOutputPoints
Returns list of output points to be used to estimate a metric 2D transformation. Each point in the list of output points must be matched with the corresponding point in the list of input points located at the same position. Hence, both input points and output points must have the same size, and their size must be greater or equal than MINIMUM_SIZE.- Returns:
- list of output points to be used to estimate a metric 2D transformation.
-
setPoints
Sets list of points to be used to estimate a metric 2D transformation. Points in the list located at the same position are considered to be matched. Hence, both lists must have the same size, and their size must be greater or equal than MINIMUM_SIZE.- Parameters:
inputPoints- list of input points to be used to estimate a metric 2D transformation.outputPoints- list of output points to be used to estimate a metric 2D transformation.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size or their size is smaller than MINIMUM_SIZE.LockedException- if estimator is locked because a computation is already in progress.
-
getListener
Returns reference to listener to be notified of events such as when estimation starts or ends.- Returns:
- listener to be notified of events.
-
setListener
Sets listener to be notified of events such as when estimation starts or ends.- Parameters:
listener- listener to be notified of events.- Throws:
LockedException- if estimator is locked.
-
isWeakMinimumSizeAllowed
public boolean isWeakMinimumSizeAllowed()Indicates whether estimation can start with only 2 points or not.- Returns:
- true allows 2 points, false requires 3.
-
setWeakMinimumSizeAllowed
Specifies whether estimation can start with only 2 points or not.- Parameters:
weakMinimumSizeAllowed- true allows 2 points, false requires 3.- Throws:
LockedException- if estimator is locked.
-
getMinimumPoints
public int getMinimumPoints()Required minimum number of point correspondences to start the estimation. Can be either 2 or 3.- Returns:
- minimum number of point correspondences.
-
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.
-
isReady
public boolean isReady()Indicates if estimator is ready to start the metric 2D transformation estimation. This is true when input data (i.e. lists of matched points) are provided and a minimum of MINIMUM_SIZE points are available.- Returns:
- true if estimator is ready, false otherwise.
-
estimate
public MetricTransformation2D estimate() throws LockedException, NotReadyException, CoincidentPointsExceptionEstimates a metric 2D transformation using the list of matched input and output 2D points. A minimum of 2 matched non-coincident points is required. If more points are provided an LMSE (Least Mean Squared Error) solution will be found.- Returns:
- estimated metric 2D transformation.
- Throws:
LockedException- if estimator is locked.NotReadyException- if not enough data has been provided.CoincidentPointsException- raised if transformation cannot be estimated for some reason (point configuration degeneracy, duplicate points or numerical instabilities).
-
estimate
public void estimate(MetricTransformation2D result) throws LockedException, NotReadyException, CoincidentPointsException Estimates a metric 2D transformation using the list of matched input and output 2D points. A minimum of 2 matched non-coincident points is required. If more points are provided an LMSE (Least Mean Squared Error) solution will be found.- Parameters:
result- instance where result will be stored.- Throws:
LockedException- if estimator is locked.NotReadyException- if not enough data has been provided.CoincidentPointsException- raised if transformation cannot be estimated for some reason (point configuration degeneracy, duplicate points or numerical instabilities).
-
computeCentroid
private static com.irurueta.algebra.Matrix computeCentroid(List<Point2D> points) throws com.irurueta.algebra.AlgebraException Computes centroid of provided list of points using inhomogeneous coordinates.- Parameters:
points- list of points to compute centroid.- Returns:
- centroid.
- Throws:
com.irurueta.algebra.AlgebraException- never thrown.
-
internalSetPoints
Internal method to set lists of points to be used to estimate a metric 2D transformation. This method does not check whether estimator is locked or not.- Parameters:
inputPoints- list of input points to be used to estimate a metric 2D transformation.outputPoints- list of output points to be used to estimate a metric 2D transformation.- Throws:
IllegalArgumentException- if provided lists of points don't have the same size or their size is smaller than #getMinimumPoints.
-