Class WeightedDualAbsoluteQuadricEstimator
java.lang.Object
com.irurueta.ar.calibration.estimators.DualAbsoluteQuadricEstimator
com.irurueta.ar.calibration.estimators.WeightedDualAbsoluteQuadricEstimator
Implementation of a Dual Absolute Quadric estimator using a weighted solution
for provided pinhole cameras.
This implementation assumes that:
- cameras are arbitrary (usually the initial camera is the identity and must
be discarded) as it creates a numerical degeneracy.
- all provided cameras have the same intrinsic parameters
- it is assumed that skewness is zero, the principal point is at the center
of the image plane (zero), and both horizontal and vertical focal planes are
equal.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default number of cameras (i.e. correspondences) to be weighted and taken into account.static final boolean
Indicates if weights are sorted by default so that largest weighted cameras are used first.private int
Maximum number of cameras (i.e. correspondences) to be weighted and taken into account.private boolean
Indicates if weights are sorted by default so that largest weighted cameras are used first.private double[]
Array containing weights for all cameras.Fields inherited from class com.irurueta.ar.calibration.estimators.DualAbsoluteQuadricEstimator
cameras, DEFAULT_DETERMINANT_THRESHOLD, DEFAULT_ENFORCE_SINGULARITY, DEFAULT_ESTIMATOR_TYPE, DEFAULT_FOCAL_DISTANCE_ASPECT_RATIO, DEFAULT_FOCAL_DISTANCE_ASPECT_RATIO_KNOWN, DEFAULT_PRINCIPAL_POINT_AT_ORIGIN, DEFAULT_VALIDATE_ENFORCED_SINGULARITY, DEFAULT_ZERO_SKEWNESS, determinantThreshold, focalDistanceAspectRatio, focalDistanceAspectRatioKnown, listener, locked, MIN_ABS_FOCAL_DISTANCE_ASPECT_RATIO, MIN_REQUIRED_EQUATIONS, principalPointAtOrigin, singularityEnforced, validateEnforcedSingularity, zeroSkewness
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor with listener.WeightedDualAbsoluteQuadricEstimator
(List<com.irurueta.geometry.PinholeCamera> cameras) Constructor.WeightedDualAbsoluteQuadricEstimator
(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights) Constructor.WeightedDualAbsoluteQuadricEstimator
(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights, DualAbsoluteQuadricEstimatorListener listener) Constructor.WeightedDualAbsoluteQuadricEstimator
(List<com.irurueta.geometry.PinholeCamera> cameras, DualAbsoluteQuadricEstimatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
applyWeight
(com.irurueta.algebra.Matrix a, int row, double weight) Apply provided weight to matrix at provided row.static boolean
areValidCamerasAndWeights
(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights) Indicates whether provided cameras and weights are valid or not.boolean
Indicates whether current constraints are enough to start the estimation.boolean
Indicates whether weights have already been provided or not.void
estimate
(DualAbsoluteQuadric result) Estimates the Dual Absolute Quadric using provided cameras.private void
Estimates Dual Absolute Quadric (DAQ) assuming that principal point is zero.private void
Estimates Dual Absolute Quadric (DAQ) assuming that skewness is zero, and principal point is located at origin of coordinates.private void
estimateZeroSkewnessPrincipalPointAtOriginAndKnownFocalDistanceAspectRatio
(DualAbsoluteQuadric result) Estimates Dual Absolute Quadric (DAQ) assuming that skewness is zero, principal point is located at origin of coordinates and that aspect ratio of focal distances is known.int
Gets the maximum number of cameras (i.e. correspondences) to be weighted and taken into account.getType()
Returns type of Dual Absolute Quadric estimator.double[]
Returns array containing a weight amount for each corresponding camera.boolean
isReady()
Indicates if this estimator is ready to start the estimation.boolean
Indicates if weights are sorted by default so that largest weighted cameras are used first.void
setCamerasAndWeights
(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights) Sets list of cameras and corresponding weights.void
setMaxCameras
(int maxCameras) Sets the maximum number of cameras (i.e. correspondences) to be weighted and taken into account.void
setSortWeightsEnabled
(boolean sortWeights) Specifies whether weights are sorted by default so that largest weighted cameras are used first.final void
setWeights
(double[] weights) Sets array of camera weight for each corresponding camera.Methods inherited from class com.irurueta.ar.calibration.estimators.DualAbsoluteQuadricEstimator
create, create, create, create, create, create, create, create, enforceRank3IfNeeded, estimate, fill1stRowEqualTo2ndRowEquation, fill2ndRowAnd1stRowEquation, fill3rdRowAnd1stRowEquation, fill3rdRowAnd2ndRowEquation, getCameras, getDeterminantThreshold, getFocalDistanceAspectRatio, getListener, getMinNumberOfRequiredCameras, isEnforcedSingularityValidated, isFocalDistanceAspectRatioKnown, isLocked, isPrincipalPointAtOrigin, isSingularityEnforced, isZeroSkewness, normalizeRow, setCameras, setDeterminantThreshold, setEnforcedSingularityValidated, setFocalDistanceAspectRatio, setFocalDistanceAspectRatioKnown, setListener, setPrincipalPointAtOrigin, setSingularityEnforced, setZeroSkewness
-
Field Details
-
DEFAULT_MAX_CAMERAS
public static final int DEFAULT_MAX_CAMERASDefault number of cameras (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 cameras are used first.- See Also:
-
maxCameras
private int maxCamerasMaximum number of cameras (i.e. correspondences) to be weighted and taken into account. -
sortWeights
private boolean sortWeightsIndicates if weights are sorted by default so that largest weighted cameras are used first. -
weights
private double[] weightsArray containing weights for all cameras.
-
-
Constructor Details
-
WeightedDualAbsoluteQuadricEstimator
public WeightedDualAbsoluteQuadricEstimator()Constructor. -
WeightedDualAbsoluteQuadricEstimator
Constructor with listener.- Parameters:
listener
- listener to be notified of events such as when estimation starts, ends or estimation progress changes.
-
WeightedDualAbsoluteQuadricEstimator
Constructor.- Parameters:
cameras
- list of cameras used to estimate the Dual Absolute Quadric (DAQ).- Throws:
IllegalArgumentException
- if list of cameras is null.
-
WeightedDualAbsoluteQuadricEstimator
public WeightedDualAbsoluteQuadricEstimator(List<com.irurueta.geometry.PinholeCamera> cameras, DualAbsoluteQuadricEstimatorListener listener) Constructor.- Parameters:
cameras
- list of cameras used to estimate the Dual Absolute Quadric (DAQ).listener
- listener to be notified of events such as when estimation starts, ends or estimation progress changes.- Throws:
IllegalArgumentException
- if list of cameras is null.
-
WeightedDualAbsoluteQuadricEstimator
public WeightedDualAbsoluteQuadricEstimator(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights) Constructor.- Parameters:
cameras
- list of cameras used to estimate the Dual Absolute Quadric (DAQ).weights
- array containing a weight amount for each corresponding camera. The larger the value of a weight, the most significant the corresponding camera data will be.- Throws:
IllegalArgumentException
- if provided lists of cameras and weights don't have the same size or enough cameras.
-
WeightedDualAbsoluteQuadricEstimator
public WeightedDualAbsoluteQuadricEstimator(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights, DualAbsoluteQuadricEstimatorListener listener) Constructor.- Parameters:
cameras
- list of cameras used to estimate the Dual Absolute Quadric (DAQ).weights
- array containing a weight amount for each corresponding camera. The largest the value of a weight, the most significant the corresponding camera data will be.listener
- listener to be notified of events such as when estimation starts, ends or estimation progress changes.- Throws:
IllegalArgumentException
- if provided lists of cameras and weights don't have the same size or enough cameras.
-
-
Method Details
-
areValidCamerasAndWeights
public static boolean areValidCamerasAndWeights(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights) Indicates whether provided cameras and weights are valid or not. Cameras and weights must have the same length to be valid and their length must be greater than 1.- Parameters:
cameras
- list of cameras to check.weights
- array of weights to check.- Returns:
- true if cameras and weights are valid, false otherwise.
-
getWeights
public double[] getWeights()Returns array containing a weight amount for each corresponding camera. The largest the value of a weight, the more significant the corresponding camera data will be.- Returns:
- weights for each corresponding camera.
-
setWeights
public final void setWeights(double[] weights) throws com.irurueta.geometry.estimators.LockedException Sets array of camera weight for each corresponding camera. The largest the value of a weight, the more significant the corresponding camera data will be.- Parameters:
weights
- weights for each corresponding camera.- Throws:
IllegalArgumentException
- if provided lists of cameras and weights don't have the same size or enough cameras.com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
setCamerasAndWeights
public void setCamerasAndWeights(List<com.irurueta.geometry.PinholeCamera> cameras, double[] weights) throws com.irurueta.geometry.estimators.LockedException Sets list of cameras and corresponding weights.- Parameters:
cameras
- list of cameras used to estimate the Dual Absolute Quadric (DAQ).weights
- array containing a weight amount for each corresponding camera. The largest the value of a weight, the most significant the corresponding camera data will be.- Throws:
IllegalArgumentException
- if provided lists of cameras and weights don't have the same size or enough cameras.com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
areWeightsAvailable
public boolean areWeightsAvailable()Indicates whether weights have already been provided or not.- Returns:
- true if weights have been provided, false otherwise.
-
getMaxCameras
public int getMaxCameras()Gets the maximum number of cameras (i.e. correspondences) to be weighted and taken into account.- Returns:
- maximum number of cameras.
-
setMaxCameras
public void setMaxCameras(int maxCameras) throws com.irurueta.geometry.estimators.LockedException Sets the maximum number of cameras (i.e. correspondences) to be weighted and taken into account.- Parameters:
maxCameras
- maximum number of cameras.- Throws:
IllegalArgumentException
- if provided value is less than 2.com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
isSortWeightsEnabled
public boolean isSortWeightsEnabled()Indicates if weights are sorted by default so that largest weighted cameras are used first.- Returns:
- true if weights are sorted by default, false otherwise.
-
setSortWeightsEnabled
public void setSortWeightsEnabled(boolean sortWeights) throws com.irurueta.geometry.estimators.LockedException Specifies whether weights are sorted by default so that largest weighted cameras are used first.- Parameters:
sortWeights
- true if weights are sorted by default, false otherwise.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.
-
isReady
public boolean isReady()Indicates if this estimator is ready to start the estimation.- Overrides:
isReady
in classDualAbsoluteQuadricEstimator
- Returns:
- true if estimator is ready, false otherwise.
-
estimate
public void estimate(DualAbsoluteQuadric result) throws com.irurueta.geometry.estimators.LockedException, com.irurueta.geometry.estimators.NotReadyException, DualAbsoluteQuadricEstimatorException Estimates the Dual Absolute Quadric using provided cameras.- Specified by:
estimate
in classDualAbsoluteQuadricEstimator
- Parameters:
result
- instance where estimated Dual Absolute Quadric (DAQ) will be stored.- Throws:
com.irurueta.geometry.estimators.LockedException
- if estimator is locked.com.irurueta.geometry.estimators.NotReadyException
- if no valid input data has already been provided.DualAbsoluteQuadricEstimatorException
- if an error occurs during estimation, usually because input data is not valid or numerically unstable.
-
getType
Returns type of Dual Absolute Quadric estimator.- Specified by:
getType
in classDualAbsoluteQuadricEstimator
- Returns:
- type of DAQ estimator.
-
areValidConstraints
public boolean areValidConstraints()Indicates whether current constraints are enough to start the estimation. In order to obtain a linear solution for the DAQ estimation, we need at least the principal point at origin constraint.- Overrides:
areValidConstraints
in classDualAbsoluteQuadricEstimator
- Returns:
- true if constraints are valid, false otherwise.
-
estimateZeroSkewnessPrincipalPointAtOriginAndKnownFocalDistanceAspectRatio
private void estimateZeroSkewnessPrincipalPointAtOriginAndKnownFocalDistanceAspectRatio(DualAbsoluteQuadric result) throws DualAbsoluteQuadricEstimatorException Estimates Dual Absolute Quadric (DAQ) assuming that skewness is zero, principal point is located at origin of coordinates and that aspect ratio of focal distances is known.- Parameters:
result
- instance where resulting estimated Dual Absolute Quadric will be stored.- Throws:
DualAbsoluteQuadricEstimatorException
- if an error occurs during estimation, usually because repeated cameras are provided, or cameras corresponding to critical motion sequences such as pure parallel translations are provided, where no additional data is really provided.
-
estimateZeroSkewnessAndPrincipalPointAtOrigin
private void estimateZeroSkewnessAndPrincipalPointAtOrigin(DualAbsoluteQuadric result) throws DualAbsoluteQuadricEstimatorException Estimates Dual Absolute Quadric (DAQ) assuming that skewness is zero, and principal point is located at origin of coordinates.- Parameters:
result
- instance where resulting estimated Dual Absolute Quadrics will be stored.- Throws:
DualAbsoluteQuadricEstimatorException
- if an error occurs during estimation, usually because repeated cameras are provided, or cameras corresponding to critical motion sequences such as pure parallel translations are provided, where no additional data is really provided.
-
estimatePrincipalPointAtOrigin
private void estimatePrincipalPointAtOrigin(DualAbsoluteQuadric result) throws DualAbsoluteQuadricEstimatorException Estimates Dual Absolute Quadric (DAQ) assuming that principal point is zero.- Parameters:
result
- instance where resulting estimated Dual Absolute Quadrics will be stored.- Throws:
DualAbsoluteQuadricEstimatorException
- if an error occurs during estimation, usually because repeated cameras are provided, or cameras corresponding to critical motion sequences such as pure parallel translations are provided, where no additional data is really provided.
-
applyWeight
private void applyWeight(com.irurueta.algebra.Matrix a, int row, double weight) Apply provided weight to matrix at provided row.- Parameters:
a
- matrix to apply weight to.row
- row within matrix to apply weight.weight
- weight to be applied.
-