Package com.irurueta.geometry.estimators
Class PointCorrespondencePinholeCameraEstimator
java.lang.Object
com.irurueta.geometry.estimators.PinholeCameraEstimator
com.irurueta.geometry.estimators.PointCorrespondencePinholeCameraEstimator
- Direct Known Subclasses:
DLTPointCorrespondencePinholeCameraEstimator,EPnPPointCorrespondencePinholeCameraEstimator,UPnPPointCorrespondencePinholeCameraEstimator,WeightedPointCorrespondencePinholeCameraEstimator
This file contains abstract implementation for pinhole camera estimators
based on point correspondences.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanIndicates if by default provided point correspondences are normalized to increase the accuracy of the estimation.static final doubleDefines tiny value considered as machine precision.static final intMinimum number of required point correspondences to estimate a pinhole camera.private booleanIndicates if provided point correspondences are normalized to increase the accuracy of the estimation.List of corresponding 2D points.List of corresponding 3D points.Fields 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
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedConstructor.protectedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D) Constructor.protectedPointCorrespondencePinholeCameraEstimator(List<Point3D> points3D, List<Point2D> points2D, PinholeCameraEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates if lists have already been provided and are available for retrieval.booleanIndicates if provided point correspondences are normalized to increase the accuracy of the estimation.static booleanareValidLists(List<Point3D> points3D, List<Point2D> points2D) Indicates if lists of corresponding 2D/3D points are valid.protected PinholeCameraattemptRefine(PinholeCamera pinholeCamera) Attempts to refine provided camera using requested suggestions.estimate()Estimates a pinhole camera.Returns list of corresponding 2D points.Returns list of corresponding 3D points.protected abstract com.irurueta.algebra.MatrixinternalEstimate(List<Point3D> points3D, List<Point2D> points2D) Internal method that actually computes the normalized pinhole camera internal matrix.private voidinternalSetLists(List<Point3D> points3D, List<Point2D> points2D) Internal method to set list of corresponding points (it does not check if estimator is locked).voidSets list of corresponding points.voidsetPointCorrespondencesNormalized(boolean normalize) Specifies whether provided point correspondences are normalized to increase the accuracy of the estimation.transformPoints2D(List<Point2D> list, ProjectiveTransformation2D inverseTransformation) Transforms 2D points so that they have zero mean and unitary standard deviation.transformPoints3D(List<Point3D> list, ProjectiveTransformation3D transformation) Transforms 3D points so that they have zero mean and unitary standard deviation.Methods inherited from class com.irurueta.geometry.estimators.PinholeCameraEstimator
create, create, getListener, getMaxSuggestionWeight, getMinSuggestionWeight, getSuggestedAspectRatioValue, getSuggestedCenterValue, getSuggestedHorizontalFocalLengthValue, getSuggestedPrincipalPointValue, getSuggestedRotationValue, getSuggestedSkewnessValue, getSuggestedVerticalFocalLengthValue, getSuggestionWeightStep, getType, hasSuggestions, isLocked, isReady, 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
-
MIN_NUMBER_OF_POINT_CORRESPONDENCES
public static final int MIN_NUMBER_OF_POINT_CORRESPONDENCESMinimum number of required point correspondences to estimate a pinhole camera.- See Also:
-
DEFAULT_NORMALIZE_POINT_CORRESPONDENCES
public static final boolean DEFAULT_NORMALIZE_POINT_CORRESPONDENCESIndicates if by default provided point correspondences are normalized to increase the accuracy of the estimation.- See Also:
-
EPS
public static final double EPSDefines tiny value considered as machine precision.- See Also:
-
points3D
List of corresponding 3D points. -
points2D
List of corresponding 2D points. -
normalizePointCorrespondences
private boolean normalizePointCorrespondencesIndicates if provided point correspondences are normalized to increase the accuracy of the estimation.
-
-
Constructor Details
-
PointCorrespondencePinholeCameraEstimator
protected PointCorrespondencePinholeCameraEstimator()Constructor. -
PointCorrespondencePinholeCameraEstimator
Constructor.- Parameters:
listener- listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
PointCorrespondencePinholeCameraEstimator
protected PointCorrespondencePinholeCameraEstimator(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.
-
PointCorrespondencePinholeCameraEstimator
protected PointCorrespondencePinholeCameraEstimator(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.
-
-
Method Details
-
internalSetLists
private void internalSetLists(List<Point3D> points3D, List<Point2D> points2D) 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.- Throws:
IllegalArgumentException- if any of the lists are null.WrongListSizesException- if provided lists of points don't have the same size and enough points.
-
setLists
public void setLists(List<Point3D> points3D, List<Point2D> points2D) throws LockedException, WrongListSizesException Sets list of corresponding points.- Parameters:
points3D- list of corresponding 3D points.points2D- list of corresponding 2D points.- 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.
-
getPoints3D
Returns list of corresponding 3D points. Notice that this method returns an unmodifiable list of points to avoid undesired modifications.- Returns:
- list of corresponding 3D points.
- Throws:
NotAvailableException- if list of points is not yet available.
-
getPoints2D
Returns list of corresponding 2D points. Notice that this method returns an unmodifiable list of points to avoid undesired modifications.- Returns:
- list of corresponding 2D points.
- Throws:
NotAvailableException- if list of points is not yet available.
-
areValidLists
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.- Returns:
- true if corresponding 2D/3D points are valid, false otherwise.
-
areListsAvailable
public boolean areListsAvailable()Indicates if lists have already been provided and are available for retrieval.- Returns:
- true if available, false otherwise.
-
arePointCorrespondencesNormalized
public boolean arePointCorrespondencesNormalized()Indicates if provided point correspondences are normalized to increase the accuracy of the estimation.- Returns:
- true if input point correspondences will be normalized, false otherwise.
-
setPointCorrespondencesNormalized
Specifies whether provided point correspondences are normalized to increase the accuracy of the estimation.- Parameters:
normalize- true if input point correspondences will be normalized, false otherwise.- Throws:
LockedException- if estimator is locked.
-
transformPoints2D
private List<Point2D> transformPoints2D(List<Point2D> list, ProjectiveTransformation2D inverseTransformation) throws PinholeCameraEstimatorException Transforms 2D points so that they have zero mean and unitary standard deviation. Provided transformation will be updated containing the transformation used for input points.- Parameters:
list- list of input 2D points.inverseTransformation- inverseTransformation used on input points. This is an output variable.- Returns:
- transformed 2D points.
- Throws:
PinholeCameraEstimatorException- if transformation cannot be computed because point configuration might be degenerate.
-
transformPoints3D
private List<Point3D> transformPoints3D(List<Point3D> list, ProjectiveTransformation3D transformation) throws PinholeCameraEstimatorException Transforms 3D points so that they have zero mean and unitary standard deviation. Provided transformation will be updated containing the transformation used for input points.- Parameters:
list- list of input 3D points.transformation- transformation used on input points. This is an output variable.- Returns:
- transformed 3D points.
- Throws:
PinholeCameraEstimatorException- if transformation cannot be computed because point configuration might be degenerate.
-
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.
-
internalEstimate
protected abstract 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).- 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).
-
attemptRefine
Attempts to refine provided camera using requested suggestions. If no suggestions are requested or if refinement fails, provided camera is returned instead.- Specified by:
attemptRefinein classPinholeCameraEstimator- Parameters:
pinholeCamera- camera to be refined.- Returns:
- refined camera.
-