Package com.irurueta.geometry.estimators
Class WeightedPointCorrespondencePinholeCameraEstimator
java.lang.Object
com.irurueta.geometry.estimators.PinholeCameraEstimator
com.irurueta.geometry.estimators.PointCorrespondencePinholeCameraEstimator
com.irurueta.geometry.estimators.WeightedPointCorrespondencePinholeCameraEstimator
public class WeightedPointCorrespondencePinholeCameraEstimator
extends PointCorrespondencePinholeCameraEstimator
This class implements pinhole camera estimator using a weighted algorithm and
point correspondences.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of points (i.e. correspondences) 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 points (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 point correspondences.Fields inherited from class com.irurueta.geometry.estimators.PointCorrespondencePinholeCameraEstimator
DEFAULT_NORMALIZE_POINT_CORRESPONDENCES, EPS, MIN_NUMBER_OF_POINT_CORRESPONDENCES, points2D, points3DFields inherited from class com.irurueta.geometry.estimators.PinholeCameraEstimator
DEFAULT_ESTIMATOR_TYPE, DEFAULT_MAX_SUGGESTION_WEIGHT, DEFAULT_MIN_SUGGESTION_WEIGHT, DEFAULT_SUGGEST_ASPECT_RATIO_ENABLED, DEFAULT_SUGGEST_CENTER_ENABLED, DEFAULT_SUGGEST_HORIZONTAL_FOCAL_LENGTH_ENABLED, DEFAULT_SUGGEST_PRINCIPAL_POINT_ENABLED, DEFAULT_SUGGEST_ROTATION_ENABLED, DEFAULT_SUGGEST_SKEWNESS_VALUE_ENABLED, DEFAULT_SUGGEST_VERTICAL_FOCAL_LENGTH_ENABLED, DEFAULT_SUGGESTED_ASPECT_RATIO_VALUE, DEFAULT_SUGGESTED_SKEWNESS_VALUE, DEFAULT_SUGGESTION_WEIGHT_STEP, listener, locked, maxSuggestionWeight, minSuggestionWeight, suggestAspectRatioEnabled, suggestCenterEnabled, suggestedAspectRatioValue, suggestedCenterValue, suggestedHorizontalFocalLengthValue, suggestedPrincipalPointValue, suggestedRotationValue, suggestedSkewnessValue, suggestedVerticalFocalLengthValue, suggestHorizontalFocalLengthEnabled, suggestionWeightStep, suggestPrincipalPointEnabled, suggestRotationEnabled, suggestSkewnessValueEnabled, suggestVerticalFocalLengthEnabled -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor with listener.WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D) Constructor.WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D, double[] weights) Constructor.WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D, double[] weights, PinholeCameraEstimatorListener listener) Constructor.WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D, PinholeCameraEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareValidListsAndWeights(List<Point3D> points3D, List<Point2D> points2D, double[] weights) Indicates if lists of corresponding 2D/3D points are valid.booleanReturns boolean indicating whether weights have been provided and are available for retrieval.intReturns maximum number of points (i.e. correspondences) to be weighted and taken into account.getType()Returns type of pinhole camera estimator.double[]Returns array containing a weight amount for each correspondence.protected com.irurueta.algebra.MatrixinternalEstimate(List<Point3D> points3D, List<Point2D> points2D) Internal method that actually computes the normalized pinhole camera internal matrix.private voidinternalSetListsAndWeights(List<Point3D> points3D, List<Point2D> points2D, double[] weights) Internal method to set list of corresponding points (it does not check if estimator is locked).booleanisReady()Indicates if this estimator is ready to start the estimation.booleanIndicates if weights are sorted by so that largest weighted correspondences are used first.voidsetListsAndWeights(List<Point3D> points3D, List<Point2D> points2D, double[] weights) Sets list of corresponding points.voidsetMaxPoints(int maxPoints) Sets maximum number of points (i.e. correspondences) to be weighted and taken into account.voidsetSortWeightsEnabled(boolean sortWeights) Specifies whether weights are sorted by so that largest weighted correspondences are used first.Methods inherited from class com.irurueta.geometry.estimators.PointCorrespondencePinholeCameraEstimator
areListsAvailable, arePointCorrespondencesNormalized, areValidLists, attemptRefine, estimate, getPoints2D, getPoints3D, setLists, setPointCorrespondencesNormalizedMethods inherited from class com.irurueta.geometry.estimators.PinholeCameraEstimator
create, create, getListener, getMaxSuggestionWeight, getMinSuggestionWeight, getSuggestedAspectRatioValue, getSuggestedCenterValue, getSuggestedHorizontalFocalLengthValue, getSuggestedPrincipalPointValue, getSuggestedRotationValue, getSuggestedSkewnessValue, getSuggestedVerticalFocalLengthValue, getSuggestionWeightStep, hasSuggestions, isLocked, isSuggestAspectRatioEnabled, isSuggestCenterEnabled, isSuggestHorizontalFocalLengthEnabled, isSuggestPrincipalPointEnabled, isSuggestRotationEnabled, isSuggestSkewnessValueEnabled, isSuggestVerticalFocalLengthEnabled, setListener, setMaxSuggestionWeight, setMinMaxSuggestionWeight, setMinSuggestionWeight, setSuggestAspectRatioEnabled, setSuggestCenterEnabled, setSuggestedAspectRatioValue, setSuggestedCenterValue, setSuggestedHorizontalFocalLengthValue, setSuggestedPrincipalPointValue, setSuggestedRotationValue, setSuggestedSkewnessValue, setSuggestedVerticalFocalLengthValue, setSuggestHorizontalFocalLengthEnabled, setSuggestionWeightStep, setSuggestPrincipalPointEnabled, setSuggestRotationEnabled, setSuggestSkewnessValueEnabled, setSuggestVerticalFocalLengthEnabled
-
Field Details
-
DEFAULT_MAX_POINTS
public static final int DEFAULT_MAX_POINTSDefault number of points (i.e. correspondences) 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:
-
maxPoints
private int maxPointsMaximum number of points (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 point correspondences.
-
-
Constructor Details
-
WeightedPointCorrespondencePinholeCameraEstimator
public WeightedPointCorrespondencePinholeCameraEstimator()Constructor. -
WeightedPointCorrespondencePinholeCameraEstimator
Constructor with listener.- Parameters:
listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
WeightedPointCorrespondencePinholeCameraEstimator
public WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D) throws WrongListSizesException Constructor.- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.- Throws:
IllegalArgumentException- if any of the lists are null.WrongListSizesException- if provided lists of points don't have the same size and enough points.
-
WeightedPointCorrespondencePinholeCameraEstimator
public WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D, PinholeCameraEstimatorListener listener) throws WrongListSizesException Constructor.- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.- Throws:
IllegalArgumentException- if any of the lists are null.WrongListSizesException- if provided lists of points don't have the same size and enough points.
-
WeightedPointCorrespondencePinholeCameraEstimator
public WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D, double[] weights) throws WrongListSizesException Constructor.- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.weights- array containing a weight amount for each correspondence. The larger the value of a weight, the most significant the correspondence will be.- Throws:
IllegalArgumentException- if any of the lists are null.WrongListSizesException- if provided lists of points don't have the same size and enough points.
-
WeightedPointCorrespondencePinholeCameraEstimator
public WeightedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D, double[] weights, PinholeCameraEstimatorListener listener) throws WrongListSizesException Constructor.- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.weights- array containing a weight amount for each correspondence. 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 any of the lists are null.WrongListSizesException- if provided lists of points don't have the same size and enough points.
-
-
Method Details
-
internalSetListsAndWeights
private void internalSetListsAndWeights(List<Point3D> points3D, List<Point2D> points2D, double[] weights) throws WrongListSizesException Internal method to set list of corresponding points (it does not check if estimator is locked).- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.weights- array containing a weight amount for each correspondence. The larger the value of a weight, the most significant the correspondence will be.- Throws:
IllegalArgumentException- if any of the lists or arrays are null.WrongListSizesException- if provided lists of points don't have the same size and enough points or if the length of the weights array is not equal to the number of point correspondences.
-
setListsAndWeights
public void setListsAndWeights(List<Point3D> points3D, List<Point2D> points2D, double[] weights) throws LockedException, WrongListSizesException Sets list of corresponding points.- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.weights- array containing a weight amount for each correspondence. The larger the value of a weight, the most significant the correspondence will be.- Throws:
LockedException- if estimator is locked.IllegalArgumentException- if any of the lists are null.WrongListSizesException- if provided lists of points don't have the same size and enough points.
-
areValidListsAndWeights
public static boolean areValidListsAndWeights(List<Point3D> points3D, List<Point2D> points2D, double[] weights) Indicates if lists of corresponding 2D/3D points are valid. Lists are considered valid if they have the same number of points and both have more than the required minimum of correspondences (which is 6).- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.weights- array containing a weight amount for each correspondence. The larger the value of a weight, the most significant the correspondence will be.- Returns:
- true if corresponding 2D/3D points are valid, false otherwise.
-
getWeights
Returns array containing a weight amount for each correspondence. The larger the value of a weight, the most significant the correspondence will be.- Returns:
- array containing weights for each correspondence.
- Throws:
NotAvailableException- if weights are not available.
-
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.
-
getMaxPoints
public int getMaxPoints()Returns maximum number of points (i.e. correspondences) to be weighted and taken into account.- Returns:
- maximum number of points to be weighted.
-
setMaxPoints
Sets maximum number of points (i.e. correspondences) to be weighted and taken into account.- Parameters:
maxPoints- maximum number of points to be weighted.- Throws:
IllegalArgumentException- if provided value is less than the minimum allowed number of point correspondences.LockedException- if this instance is locked.
-
isSortWeightsEnabled
public boolean isSortWeightsEnabled()Indicates if weights are sorted by so that largest weighted correspondences are used first.- Returns:
- true if weights are sorted, false otherwise.
-
setSortWeightsEnabled
Specifies whether weights are sorted by so that largest weighted correspondences are used first.- Parameters:
sortWeights- true if weights are sorted, false otherwise.- Throws:
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 lists and weights are available.- Specified by:
isReadyin classPinholeCameraEstimator- Returns:
- true if estimator is ready, false otherwise.
-
internalEstimate
protected com.irurueta.algebra.Matrix internalEstimate(List<Point3D> points3D, List<Point2D> points2D) throws PinholeCameraEstimatorException Internal method that actually computes the normalized pinhole camera internal matrix. Returned matrix must have norm equal to one and might be estimated using any convenient algorithm (i.e. DLT or weighted DLT).- Specified by:
internalEstimatein classPointCorrespondencePinholeCameraEstimator- Parameters:
points3D- list of 3D points. Points might or might not be normalized.points2D- list of 2D points. Points might or might not be normalized.- Returns:
- matrix of estimated pinhole camera.
- Throws:
PinholeCameraEstimatorException- if estimation fails for some reason (i.e. numerical instability or geometric degeneracy).
-
getType
Returns type of pinhole camera estimator.- Specified by:
getTypein classPinholeCameraEstimator- Returns:
- type of pinhole camera estimator.
-