Package com.irurueta.geometry.estimators
Class WeightedLinePlaneCorrespondencePinholeCameraEstimator
java.lang.Object
com.irurueta.geometry.estimators.PinholeCameraEstimator
com.irurueta.geometry.estimators.LinePlaneCorrespondencePinholeCameraEstimator
com.irurueta.geometry.estimators.WeightedLinePlaneCorrespondencePinholeCameraEstimator
public class WeightedLinePlaneCorrespondencePinholeCameraEstimator
extends LinePlaneCorrespondencePinholeCameraEstimator
This class implements pinhole camera estimator using a weighted algorithm and
point correspondences.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault number of 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.static final doubleDefines tiny value considered as machine precision.private intMaximum number of 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.LinePlaneCorrespondencePinholeCameraEstimator
lines2D, MIN_NUMBER_OF_LINE_PLANE_CORRESPONDENCES, planesFields 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.WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D) Constructor.WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D, double[] weights) Constructor.WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D, double[] weights, PinholeCameraEstimatorListener listener) Constructor.WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D, PinholeCameraEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareValidListsAndWeights(List<Plane> planes, List<Line2D> lines2D, double[] weights) Indicates if lists of corresponding planes and lines are valid.booleanReturns boolean indicating whether weights have been provided and are available for retrieval.estimate()Estimates a pinhole camera.intReturns maximum number of 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.private voidinternalSetListsAndWeights(List<Plane> planes, List<Line2D> lines2D, 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<Plane> planes, List<Line2D> lines2D, double[] weights) Sets list of corresponding planes and lines.voidsetMaxCorrespondences(int maxCorrespondences) Sets maximum number of 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.LinePlaneCorrespondencePinholeCameraEstimator
areListsAvailable, areValidLists, attemptRefine, getLines2D, getPlanes, setListsMethods 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_CORRESPONDENCES
public static final int DEFAULT_MAX_CORRESPONDENCESDefault number of 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:
-
EPS
public static final double EPSDefines tiny value considered as machine precision.- See Also:
-
maxCorrespondences
private int maxCorrespondencesMaximum number of 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
-
WeightedLinePlaneCorrespondencePinholeCameraEstimator
public WeightedLinePlaneCorrespondencePinholeCameraEstimator()Constructor. -
WeightedLinePlaneCorrespondencePinholeCameraEstimator
public WeightedLinePlaneCorrespondencePinholeCameraEstimator(PinholeCameraEstimatorListener listener) Constructor with listener.- Parameters:
listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
WeightedLinePlaneCorrespondencePinholeCameraEstimator
public WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D) throws WrongListSizesException Constructor.- Parameters:
planes- list of corresponding 3D planes.lines2D- list of corresponding 2D lines.- Throws:
IllegalArgumentException- if any of the lists are null.WrongListSizesException- if provided lists of correspondences don't have the same size and enough correspondences.
-
WeightedLinePlaneCorrespondencePinholeCameraEstimator
public WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D, PinholeCameraEstimatorListener listener) throws WrongListSizesException Constructor.- Parameters:
planes- list of corresponding 3D planes.lines2D- list of corresponding 2D lines.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 correspondences don't have the same size and enough correspondences.
-
WeightedLinePlaneCorrespondencePinholeCameraEstimator
public WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D, double[] weights) throws WrongListSizesException Constructor.- Parameters:
planes- list of corresponding 3D planes.lines2D- list of corresponding 2D lines.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 correspondences don't have the same size and enough correspondences.
-
WeightedLinePlaneCorrespondencePinholeCameraEstimator
public WeightedLinePlaneCorrespondencePinholeCameraEstimator(List<Plane> planes, List<Line2D> lines2D, double[] weights, PinholeCameraEstimatorListener listener) throws WrongListSizesException Constructor.- Parameters:
planes- list of corresponding 3D planes.lines2D- list of corresponding 2D lines.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 correspondences don't have the same size and enough correspondences.
-
-
Method Details
-
internalSetListsAndWeights
private void internalSetListsAndWeights(List<Plane> planes, List<Line2D> lines2D, double[] weights) throws WrongListSizesException Internal method to set list of corresponding points (it does not check if estimator is locked).- Parameters:
planes- list of corresponding 3D planes.lines2D- list of corresponding 2D lines.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 correspondences don't have the same size and enough correspondences.
-
setListsAndWeights
public void setListsAndWeights(List<Plane> planes, List<Line2D> lines2D, double[] weights) throws LockedException, WrongListSizesException Sets list of corresponding planes and lines.- Parameters:
planes- list of corresponding 3D planes.lines2D- list of corresponding 2D lines.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 correspondences don't have the same size and enough correspondences.
-
areValidListsAndWeights
public static boolean areValidListsAndWeights(List<Plane> planes, List<Line2D> lines2D, double[] weights) Indicates if lists of corresponding planes and lines are valid. Lists are considered valid if they have the same number of correspondences and both have more than the required minimum of correspondences (which is 4).- Parameters:
planes- list of corresponding 3D planes.lines2D- list of corresponding 2D lines.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 planes and lines 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.
-
getMaxCorrespondences
public int getMaxCorrespondences()Returns maximum number of correspondences to be weighted and taken into account.- Returns:
- maximum number of points to be weighted.
-
setMaxCorrespondences
Sets maximum number of correspondences to be weighted and taken into account.- Parameters:
maxCorrespondences- maximum number of correspondences 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.
-
estimate
public PinholeCamera estimate() throws LockedException, NotReadyException, PinholeCameraEstimatorExceptionEstimates a pinhole camera.- Specified by:
estimatein classPinholeCameraEstimator- Returns:
- estimated pinhole camera.
- Throws:
LockedException- if estimator is locked.NotReadyException- if input has not yet been provided.PinholeCameraEstimatorException- if an error occurs during estimation, usually because input data is not valid.
-
getType
Returns type of pinhole camera estimator.- Specified by:
getTypein classPinholeCameraEstimator- Returns:
- type of pinhole camera estimator.
-