Class WeightedPointCorrespondencePinholeCameraEstimator


public class WeightedPointCorrespondencePinholeCameraEstimator extends PointCorrespondencePinholeCameraEstimator
This class implements pinhole camera estimator using a weighted algorithm and point correspondences.
  • Field Details

    • DEFAULT_MAX_POINTS

      public static final int DEFAULT_MAX_POINTS
      Default number of points (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 correspondences are used first.
      See Also:
    • maxPoints

      private int maxPoints
      Maximum number of points (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 correspondences are used first.
    • weights

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

    • WeightedPointCorrespondencePinholeCameraEstimator

      public WeightedPointCorrespondencePinholeCameraEstimator()
      Constructor.
    • WeightedPointCorrespondencePinholeCameraEstimator

      public WeightedPointCorrespondencePinholeCameraEstimator(PinholeCameraEstimatorListener listener)
      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

      public double[] getWeights() throws NotAvailableException
      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

      public void setMaxPoints(int maxPoints) throws LockedException
      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

      public void setSortWeightsEnabled(boolean sortWeights) throws LockedException
      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:
      isReady in class PinholeCameraEstimator
      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:
      internalEstimate in class PointCorrespondencePinholeCameraEstimator
      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

      public PinholeCameraEstimatorType getType()
      Returns type of pinhole camera estimator.
      Specified by:
      getType in class PinholeCameraEstimator
      Returns:
      type of pinhole camera estimator.