Class WeightedLinePlaneCorrespondencePinholeCameraEstimator


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

    • DEFAULT_MAX_CORRESPONDENCES

      public static final int DEFAULT_MAX_CORRESPONDENCES
      Default number of 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:
    • EPS

      public static final double EPS
      Defines tiny value considered as machine precision.
      See Also:
    • maxCorrespondences

      private int maxCorrespondences
      Maximum number of 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

    • 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

      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.
    • 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

      public void setMaxCorrespondences(int maxCorrespondences) throws LockedException
      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

      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.
    • estimate

      Estimates a pinhole camera.
      Specified by:
      estimate in class PinholeCameraEstimator
      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

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