Class WeightedImageOfAbsoluteConicEstimator
java.lang.Object
com.irurueta.ar.calibration.estimators.ImageOfAbsoluteConicEstimator
com.irurueta.ar.calibration.estimators.WeightedImageOfAbsoluteConicEstimator
This class implements an Image of Absolute Conic (IAC) estimator using a
weighted algorithm and correspondences.
Weights can be used so that homographies assumed to have a better quality
(i.e. more precisely estimated) are considered to be more relevant.
Aside from enabling constraints whenever possible to obtain more stable and
accurate results, its is discouraged to use a large number of homographies,
even if they are correctly weighted, since as the number of homographies
increase so do the rounding errors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of homographies to be weighted and taken into account.static final booleanIndicates if weights are sorted by default so that largest weighted correspondences are used first.private intMaximum number of homographies (i.e. correspondences) to be weighted and taken into account.private booleanIndicates if weights are sorted by default so that largest weighted correspondences are used first.private double[]Array containing weights for all homographies.Fields inherited from class com.irurueta.ar.calibration.estimators.ImageOfAbsoluteConicEstimator
DEFAULT_ESTIMATOR_TYPE, DEFAULT_FOCAL_DISTANCE_ASPECT_RATIO, DEFAULT_FOCAL_DISTANCE_ASPECT_RATIO_KNOWN, DEFAULT_PRINCIPAL_POINT_AT_ORIGIN, DEFAULT_ZERO_SKEWNESS, focalDistanceAspectRatio, focalDistanceAspectRatioKnown, homographies, listener, locked, MIN_ABS_FOCAL_DISTANCE_ASPECT_RATIO, MIN_REQUIRED_EQUATIONS, principalPointAtOrigin, zeroSkewness -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor with listener.WeightedImageOfAbsoluteConicEstimator(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights) Constructor.WeightedImageOfAbsoluteConicEstimator(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights, ImageOfAbsoluteConicEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns boolean indicating whether weights have been provided and are available for retrieval.estimate()Estimates Image of Absolute Conic (IAC).private ImageOfAbsoluteConicEstimates Image of Absolute Conic (IAC) without constraints.private ImageOfAbsoluteConicEstimates Image of Absolute Conic (IAC) assuming that principal point is located at origin of coordinates.private ImageOfAbsoluteConicEstimates Image of Absolute Conic (IAC) assuming that skewness is zero.private ImageOfAbsoluteConicEstimates Image of Absolute Conic (IAC) assuming that skewness is zero and that aspect ratio of focal distances is known.private ImageOfAbsoluteConicEstimates Image of Absolute Conic (IAC) assuming that skewness is zero and that principal point is located at origin of coordinates.private ImageOfAbsoluteConicEstimates Image of Absolute Conic (IAC) assuming that skewness is zero, principal point is located at origin of coordinates and that aspect ratio of focal distances is known.intReturns maximum number of homographies to be weighted and taken into account.getType()Returns type of IAC estimator.double[]Returns array containing a weight amount for each homography.private voidinternalSetHomographiesAndWeights(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights) Sets list of homographies to estimate IAC.booleanisReady()Indicates if this estimator is ready to start the estimation.booleanIndicates if weights are sorted by so that largest weighted homographies are used first.voidsetHomographies(List<com.irurueta.geometry.Transformation2D> homographies) Sets list of homographies to estimate IAC.voidsetHomographiesAndWeights(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights) Sets list of homographies to estimate IAC along with their corresponding weights.voidsetMaxHomographies(int maxHomographies) Sets maximum number of homographies to be weighted and taken into account.voidsetSortWeightsEnabled(boolean sortWeights) Specifies whether weights are sorted by so that largest weighted homographies are used first.Methods inherited from class com.irurueta.ar.calibration.estimators.ImageOfAbsoluteConicEstimator
create, create, create, create, create, create, create, create, getFocalDistanceAspectRatio, getHomographies, getListener, getMinNumberOfRequiredHomographies, internalSetHomographies, isFocalDistanceAspectRatioKnown, isLocked, isPrincipalPointAtOrigin, isZeroSkewness, setFocalDistanceAspectRatio, setFocalDistanceAspectRatioKnown, setListener, setPrincipalPointAtOrigin, setZeroSkewness
-
Field Details
-
DEFAULT_MAX_HOMOGRAPHIES
public static final int DEFAULT_MAX_HOMOGRAPHIESDefault number of homographies to be weighted and taken into account.- See Also:
-
DEFAULT_SORT_WEIGHTS
public static final boolean DEFAULT_SORT_WEIGHTSIndicates if weights are sorted by default so that largest weighted correspondences are used first.- See Also:
-
maxHomographies
private int maxHomographiesMaximum number of homographies (i.e. correspondences) to be weighted and taken into account. -
sortWeights
private boolean sortWeightsIndicates if weights are sorted by default so that largest weighted correspondences are used first. -
weights
private double[] weightsArray containing weights for all homographies.
-
-
Constructor Details
-
WeightedImageOfAbsoluteConicEstimator
public WeightedImageOfAbsoluteConicEstimator()Constructor. -
WeightedImageOfAbsoluteConicEstimator
Constructor with listener.- Parameters:
listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
WeightedImageOfAbsoluteConicEstimator
public WeightedImageOfAbsoluteConicEstimator(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights) Constructor.- Parameters:
homographies- list of homographies (2D transformations) used to estimate the image of absolute conic (IAC), which can be used to obtain pinhole camera intrinsic parameters.weights- array containing a weight amount for each homography. The larger the value of a weight, the most significant the correspondence will be.- Throws:
IllegalArgumentException- if not enough homographies are provided for default constraints during IAC estimation.
-
WeightedImageOfAbsoluteConicEstimator
public WeightedImageOfAbsoluteConicEstimator(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights, ImageOfAbsoluteConicEstimatorListener listener) Constructor.- Parameters:
homographies- list of homographies (2D transformations) used to estimate the image of absolute conic (IAC), which can be used to obtain pinhole camera intrinsic parameters.weights- array containing a weight amount for each homography. The larger the value of a weight, the most significant the correspondence will be.listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.- Throws:
IllegalArgumentException- if not enough homographies are provided for default constraints during IAC estimation.
-
-
Method Details
-
setHomographies
Sets list of homographies to estimate IAC. This method override always throws an IllegalArgumentException because it is expected to provide both homographies and their weights.- Overrides:
setHomographiesin classImageOfAbsoluteConicEstimator- Parameters:
homographies- list of homographies to estimate IAC.- Throws:
IllegalArgumentException- always thrown in this implementation.
-
setHomographiesAndWeights
public void setHomographiesAndWeights(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights) throws com.irurueta.geometry.estimators.LockedException Sets list of homographies to estimate IAC along with their corresponding weights.- Parameters:
homographies- list of homographies to estimate IAC.weights- array containing a weight amount for each homography. The larger the value of a weight, the most significant the correspondence will be.- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.IllegalArgumentException- if not enough homographies are provided for default constraints during IAC estimation.
-
getWeights
public double[] getWeights()Returns array containing a weight amount for each homography. The larger the value of a weight, the most significant the correspondence will be.- Returns:
- array containing weights for each correspondence.
-
areWeightsAvailable
public boolean areWeightsAvailable()Returns boolean indicating whether weights have been provided and are available for retrieval.- Returns:
- true if weights are available, false otherwise.
-
getMaxHomographies
public int getMaxHomographies()Returns maximum number of homographies to be weighted and taken into account.- Returns:
- maximum number of homographies to be weighted.
-
setMaxHomographies
public void setMaxHomographies(int maxHomographies) throws com.irurueta.geometry.estimators.LockedException Sets maximum number of homographies to be weighted and taken into account. This method must be called after enforcing constraints, because the minimum number of required homographies will be checked based on current settings.- Parameters:
maxHomographies- maximum number of homographies to be weighted.- Throws:
IllegalArgumentException- if provided value is less than the minimum allowed number of homographies.com.irurueta.geometry.estimators.LockedException- if this instance is locked.
-
isSortWeightsEnabled
public boolean isSortWeightsEnabled()Indicates if weights are sorted by so that largest weighted homographies are used first.- Returns:
- true if weights are sorted, false otherwise.
-
setSortWeightsEnabled
public void setSortWeightsEnabled(boolean sortWeights) throws com.irurueta.geometry.estimators.LockedException Specifies whether weights are sorted by so that largest weighted homographies are used first.- Parameters:
sortWeights- true if weights are sorted, false otherwise.- Throws:
com.irurueta.geometry.estimators.LockedException- if this instance is locked.
-
isReady
public boolean isReady()Indicates if this estimator is ready to start the estimation. Estimator will be ready once both list of homographies and weights are available and enough homobraphies have been provided- Overrides:
isReadyin classImageOfAbsoluteConicEstimator- Returns:
- true if estimator is ready, false otherwise.
-
estimate
public ImageOfAbsoluteConic estimate() throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, ImageOfAbsoluteConicEstimatorExceptionEstimates Image of Absolute Conic (IAC).- Specified by:
estimatein classImageOfAbsoluteConicEstimator- Returns:
- estimated IAC.
- Throws:
com.irurueta.geometry.estimators.LockedException- if estimator is locked.com.irurueta.geometry.estimators.NotReadyException- if input has not yet been provided.ImageOfAbsoluteConicEstimatorException- if an error occurs during estimation, usually because repeated homographies are provided, or homographies corresponding to degenerate camera movements such as pure parallel translations where no additional data is really provided. Indeed, if provided homographies belong to the group of affine transformations (or other groups contained within such as metric or Euclidean ones), this exception will raise because camera movements will be degenerate. To avoid this exception, homographies must be purely projective.
-
getType
Returns type of IAC estimator.- Specified by:
getTypein classImageOfAbsoluteConicEstimator- Returns:
- type of IAC estimator.
-
internalSetHomographiesAndWeights
private void internalSetHomographiesAndWeights(List<com.irurueta.geometry.Transformation2D> homographies, double[] weights) Sets list of homographies to estimate IAC. This method does not check whether estimator is locked.- Parameters:
homographies- list of homographies to estimate IAC.weights- array containing a weight amount for each homography. The larger the value of a weight, the more significant the correspondence will be.- Throws:
IllegalArgumentException- if provided list of homographies does not contain enough elements to estimate the IAC using current settings.
-
estimateNoConstraints
Estimates Image of Absolute Conic (IAC) without constraints.- Returns:
- estimated IAC.
- Throws:
ImageOfAbsoluteConicEstimatorException- if an error occurs during estimation, usually because repeated homographies are provided, or homographies corresponding to degenerate camera movements such as pure parallel translations where no additional data is really provided.
-
estimateZeroSkewness
Estimates Image of Absolute Conic (IAC) assuming that skewness is zero.- Returns:
- estimated IAC.
- Throws:
ImageOfAbsoluteConicEstimatorException- if an error occurs during estimation, usually because repeated homographies are provided, or homographies corresponding to degenerate camera movements such as pure parallel translations where no additional data is really provided.
-
estimatePrincipalPointAtOrigin
private ImageOfAbsoluteConic estimatePrincipalPointAtOrigin() throws ImageOfAbsoluteConicEstimatorExceptionEstimates Image of Absolute Conic (IAC) assuming that principal point is located at origin of coordinates.- Returns:
- estimated IAC.
- Throws:
ImageOfAbsoluteConicEstimatorException- if an error occurs during estimation, usually because repeated homographies are provided, or homographies corresponding to degenerate camera movements such as pure parallel translations where no additional data is really provided.
-
estimateZeroSkewnessAndPrincipalPointAtOrigin
private ImageOfAbsoluteConic estimateZeroSkewnessAndPrincipalPointAtOrigin() throws ImageOfAbsoluteConicEstimatorExceptionEstimates Image of Absolute Conic (IAC) assuming that skewness is zero and that principal point is located at origin of coordinates.- Returns:
- estimated IAC.
- Throws:
ImageOfAbsoluteConicEstimatorException- if an error occurs during estimation, usually because repeated homographies are provided, or homographies corresponding to degenerate camera movements such as pure parallel translations where no additional data is really provided.
-
estimateZeroSkewnessAndKnownFocalDistanceAspectRatio
private ImageOfAbsoluteConic estimateZeroSkewnessAndKnownFocalDistanceAspectRatio() throws ImageOfAbsoluteConicEstimatorExceptionEstimates Image of Absolute Conic (IAC) assuming that skewness is zero and that aspect ratio of focal distances is known.- Returns:
- estimated IAC.
- Throws:
ImageOfAbsoluteConicEstimatorException- if an error occurs during estimation, usually because repeated homographies are provided, or homographies corresponding to degenerate camera movements such as pure parallel translations where no additional data is really provided.
-
estimateZeroSkewnessPrincipalPointAtOriginAndKnownFocalDistanceAspectRatio
private ImageOfAbsoluteConic estimateZeroSkewnessPrincipalPointAtOriginAndKnownFocalDistanceAspectRatio() throws ImageOfAbsoluteConicEstimatorExceptionEstimates Image of Absolute Conic (IAC) assuming that skewness is zero, principal point is located at origin of coordinates and that aspect ratio of focal distances is known.- Returns:
- estimated IAC.
- Throws:
ImageOfAbsoluteConicEstimatorException- if an error occurs during estimation, usually because repeated homographies are provided, or homographies corresponding to degenerate camera movements such as pure parallel translations where no additional data is really provided.
-