Class PointCorrespondencePinholeCameraEstimator

java.lang.Object
com.irurueta.geometry.estimators.PinholeCameraEstimator
com.irurueta.geometry.estimators.PointCorrespondencePinholeCameraEstimator
Direct Known Subclasses:
DLTPointCorrespondencePinholeCameraEstimator, EPnPPointCorrespondencePinholeCameraEstimator, UPnPPointCorrespondencePinholeCameraEstimator, WeightedPointCorrespondencePinholeCameraEstimator

public abstract class PointCorrespondencePinholeCameraEstimator extends PinholeCameraEstimator
This file contains abstract implementation for pinhole camera estimators based on point correspondences.
  • Field Details

    • MIN_NUMBER_OF_POINT_CORRESPONDENCES

      public static final int MIN_NUMBER_OF_POINT_CORRESPONDENCES
      Minimum number of required point correspondences to estimate a pinhole camera.
      See Also:
    • DEFAULT_NORMALIZE_POINT_CORRESPONDENCES

      public static final boolean DEFAULT_NORMALIZE_POINT_CORRESPONDENCES
      Indicates if by default provided point correspondences are normalized to increase the accuracy of the estimation.
      See Also:
    • EPS

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

      protected List<Point3D> points3D
      List of corresponding 3D points.
    • points2D

      protected List<Point2D> points2D
      List of corresponding 2D points.
    • normalizePointCorrespondences

      private boolean normalizePointCorrespondences
      Indicates if provided point correspondences are normalized to increase the accuracy of the estimation.
  • Constructor Details

    • PointCorrespondencePinholeCameraEstimator

      protected PointCorrespondencePinholeCameraEstimator()
      Constructor.
    • PointCorrespondencePinholeCameraEstimator

      protected PointCorrespondencePinholeCameraEstimator(PinholeCameraEstimatorListener listener)
      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

      public List<Point3D> getPoints3D() throws NotAvailableException
      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

      public List<Point2D> getPoints2D() throws NotAvailableException
      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

      public static boolean areValidLists(List<Point3D> points3D, List<Point2D> points2D)
      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

      public void setPointCorrespondencesNormalized(boolean normalize) throws LockedException
      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

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

      protected PinholeCamera attemptRefine(PinholeCamera pinholeCamera)
      Attempts to refine provided camera using requested suggestions. If no suggestions are requested or if refinement fails, provided camera is returned instead.
      Specified by:
      attemptRefine in class PinholeCameraEstimator
      Parameters:
      pinholeCamera - camera to be refined.
      Returns:
      refined camera.