Class WeightedDualAbsoluteQuadricEstimator

java.lang.Object
com.irurueta.ar.calibration.estimators.DualAbsoluteQuadricEstimator
com.irurueta.ar.calibration.estimators.WeightedDualAbsoluteQuadricEstimator

public class WeightedDualAbsoluteQuadricEstimator extends DualAbsoluteQuadricEstimator
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 Details

    • DEFAULT_MAX_CAMERAS

      public static final int DEFAULT_MAX_CAMERAS
      Default number of cameras (i.e. correspondences) to be weighted and taken into account.
      See Also:
    • DEFAULT_SORT_WEIGHTS

      public static final boolean DEFAULT_SORT_WEIGHTS
      Indicates if weights are sorted by default so that largest weighted cameras are used first.
      See Also:
    • maxCameras

      private int maxCameras
      Maximum number of cameras (i.e. correspondences) to be weighted and taken into account.
    • sortWeights

      private boolean sortWeights
      Indicates if weights are sorted by default so that largest weighted cameras are used first.
    • weights

      private double[] weights
      Array containing weights for all cameras.
  • Constructor Details

    • WeightedDualAbsoluteQuadricEstimator

      public WeightedDualAbsoluteQuadricEstimator()
      Constructor.
    • WeightedDualAbsoluteQuadricEstimator

      public WeightedDualAbsoluteQuadricEstimator(DualAbsoluteQuadricEstimatorListener listener)
      Constructor with listener.
      Parameters:
      listener - listener to be notified of events such as when estimation starts, ends or estimation progress changes.
    • WeightedDualAbsoluteQuadricEstimator

      public WeightedDualAbsoluteQuadricEstimator(List<com.irurueta.geometry.PinholeCamera> cameras)
      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 class DualAbsoluteQuadricEstimator
      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 class DualAbsoluteQuadricEstimator
      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 class DualAbsoluteQuadricEstimator
      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 class DualAbsoluteQuadricEstimator
      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.